Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Loading status checks…
[IOTDB-4225] Fix QueryContext occupies too much memory
THUMarkLau
committed
Aug 26, 2022
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent
1a2e5d7
commit e5e4f17f703fa7c8e7623d0a8d3120acb0e89fa6
Showing
1 changed file
with
5 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| * Find the modifications of timeseries 'path' in 'modFile'. If they are not in the cache, read | |||
| * them from 'modFile' and put then into the cache. | |||
| */ | |||
| public List<Modification> getPathModifications(ModificationFile modFile, PartialPath path) { | |||
| // if the mods file does not exist, do not add it to the cache | |||
| if (!modFile.exists()) { | |||
| return Collections.emptyList(); | |||
| } | |||
| Map<String, List<Modification>> fileModifications = | |||
| filePathModCache.computeIfAbsent(modFile.getFilePath(), k -> new ConcurrentHashMap<>()); | |||
|
|||
|
|||
| return fileModifications.computeIfAbsent( | |||
| path.getFullPath(), | |||
| k -> { | |||
| List<Modification> allModifications = fileModCache.get(modFile.getFilePath()); | |||
| if (allModifications == null) { | |||
| allModifications = (List<Modification>) modFile.getModifications(); | |||
| fileModCache.put(modFile.getFilePath(), allModifications); | |||
| } | |||
| List<Modification> finalPathModifications = new ArrayList<>(); | |||
| if (!allModifications.isEmpty()) { | |||
| allModifications.forEach( | |||
| modification -> { | |||
| if (modification.getPath().matchFullPath(path)) { | |||
| finalPathModifications.add(modification); | |||
| } | |||
| }); | |||
| } | |||
| return finalPathModifications; | |||
|
|||
| }); | |||
| } | |||
| /** | |||