Alima777 commented on a change in pull request #2859:
URL: https://github.com/apache/iotdb/pull/2859#discussion_r595972808
##########
File path:
tsfile/src/main/java/org/apache/iotdb/tsfile/read/query/timegenerator/TimeGenerator.java
##########
@@ -50,18 +53,35 @@ public boolean hasNext() throws IOException {
}
public long next() throws IOException {
+ if (!hasOrNode) {
+ if (leafValuesCache == null) {
+ leafValuesCache = new HashMap<>();
+ }
+ leafNodeCache.forEach(
+ (path, nodes) ->
+ leafValuesCache
+ .computeIfAbsent(path, k -> new ArrayList<>())
+ .add(nodes.get(0).currentValue()));
+ }
return operatorNode.next();
}
- public Object getValue(Path path, long time) {
- for (LeafNode leafNode : leafCache.get(path)) {
- if (!leafNode.currentTimeIs(time)) {
- continue;
- }
- return leafNode.currentValue();
+ /** ATTENTION: this method should only be used when there is no `OR` node */
+ public Object[] getValues(Path path) throws IOException {
+ if (leafValuesCache.get(path) == null) {
+ throw new IOException(
+ "getValues() method should not be invoked by non-existent path in
where clause");
}
+ return leafValuesCache.remove(path).toArray();
+ }
Review comment:
Fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]