JackieTien97 commented on a change in pull request #818: [IOTDB-482] Vectorized 
TimeGenerator
URL: https://github.com/apache/incubator-iotdb/pull/818#discussion_r380409556
 
 

 ##########
 File path: 
tsfile/src/main/java/org/apache/iotdb/tsfile/read/query/timegenerator/node/OrNode.java
 ##########
 @@ -19,80 +19,109 @@
 package org.apache.iotdb.tsfile.read.query.timegenerator.node;
 
 import java.io.IOException;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
+import org.apache.iotdb.tsfile.read.common.TimeColumn;
 
 public class OrNode implements Node {
 
+  private final int fetchSize = TSFileDescriptor.getInstance().getConfig()
+      .getFetchSizeOfTimeGenerator();
+
   private Node leftChild;
   private Node rightChild;
 
-  private boolean hasCachedLeftValue;
-  private long cachedLeftValue;
-  private boolean hasCachedRightValue;
-  private long cachedRightValue;
+  private TimeColumn leftTimeColumn;
+  private TimeColumn rightTimeColumn;
+
+  private TimeColumn cachedTimeColumn;
+  private boolean hasCachedValue;
+
 
   public OrNode(Node leftChild, Node rightChild) {
     this.leftChild = leftChild;
     this.rightChild = rightChild;
-    this.hasCachedLeftValue = false;
-    this.hasCachedRightValue = false;
   }
 
   @Override
-  public boolean hasNext() throws IOException {
-    if (hasCachedLeftValue || hasCachedRightValue) {
+  public boolean hasNextTimeColumn() throws IOException {
+    if (hasCachedValue) {
       return true;
     }
-    return leftChild.hasNext() || rightChild.hasNext();
-  }
 
-  private boolean hasLeftValue() throws IOException {
-    return hasCachedLeftValue || leftChild.hasNext();
+    return leftChild.hasNextTimeColumn() || rightChild.hasNextTimeColumn()
+        || leftTimeColumn.hasCurrent() || rightTimeColumn.hasCurrent();
   }
 
-  private long getLeftValue() throws IOException {
-    if (hasCachedLeftValue) {
-      hasCachedLeftValue = false;
-      return cachedLeftValue;
+  @Override
+  public TimeColumn nextTimeColumn() throws IOException {
+    if (hasCachedValue) {
+      hasCachedValue = false;
+      return cachedTimeColumn;
     }
-    return leftChild.next();
-  }
+    hasCachedValue = false;
+    cachedTimeColumn = new TimeColumn(1000);
 
 Review comment:
   The same magic number here. You can use a constant and put it into Node.java

----------------------------------------------------------------
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

Reply via email to