JackieTien97 commented on a change in pull request #818: [IOTDB-482] Vectorized
TimeGenerator
URL: https://github.com/apache/incubator-iotdb/pull/818#discussion_r380151129
##########
File path:
server/src/main/java/org/apache/iotdb/db/query/timegenerator/EngineTimeGenerator.java
##########
@@ -51,12 +55,32 @@ private void initNode(QueryContext context) throws
StorageEngineException {
@Override
public boolean hasNext() throws IOException {
- return operatorNode.hasNext();
+ if (hasCache) {
+ return true;
+ }
+ if (cacheTimes != null && cacheTimes.hasMoreData()) {
+ hasCache = true;
+ return true;
+ }
+ while (operatorNode.hasNextTimeColumn()) {
+ cacheTimes = operatorNode.nextTimeColumn();
+ if (cacheTimes != null && cacheTimes.hasMoreData()) {
+ hasCache = true;
+ break;
+ }
+ }
+ return hasCache;
}
@Override
public long next() throws IOException {
- return operatorNode.next();
+ if (hasCache || hasNext()) {
+ hasCache = false;
+ long currentTime = cacheTimes.currentTime();
+ cacheTimes.next();
+ return currentTime;
+ }
+ throw new IOException("no more data");
Review comment:
I think the logic here should be same as TimeGeneratorImpl in tsfile,
hasCache should not be set to false directly. It may be better to be set to
cacheTimes.hasNext();
----------------------------------------------------------------
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]
With regards,
Apache Git Services