liutaohua commented on a change in pull request #818: [IOTDB-482] Vectorized
TimeGenerator
URL: https://github.com/apache/incubator-iotdb/pull/818#discussion_r380128211
##########
File path:
tsfile/src/main/java/org/apache/iotdb/tsfile/read/query/timegenerator/node/AndNode.java
##########
@@ -45,42 +50,78 @@ public boolean hasNext() throws IOException {
if (hasCachedValue) {
return true;
}
- if (leftChild.hasNext() && rightChild.hasNext()) {
- long leftValue = leftChild.next();
- long rightValue = rightChild.next();
- while (true) {
- if (leftValue == rightValue) {
- this.hasCachedValue = true;
- this.cachedValue = leftValue;
- return true;
- } else if (leftValue > rightValue) {
- if (rightChild.hasNext()) {
- rightValue = rightChild.next();
- } else {
- return false;
- }
- } else { // leftValue < rightValue
- if (leftChild.hasNext()) {
- leftValue = leftChild.next();
- } else {
- return false;
- }
+ cachedValue = new TimeSeries(1000);
+ //fill data
+ fillLeftData();
+ fillRightData();
+ /*
+ * [1,2,3,4,5] <- that was stopBatchTime mean
+ * [1,2,3,4,5,6]
+ */
+ long stopBatchTime = getStopBatchTime();
+
+ while (leftPageData.hasMoreData() && rightPageData.hasMoreData()) {
+ long leftValue = leftPageData.currentTime();
+ long rightValue = rightPageData.currentTime();
+ if (leftValue == rightValue) {
+ this.hasCachedValue = true;
+ this.cachedValue.add(leftValue);
+ leftPageData.next();
+ rightPageData.next();
+ } else if (leftValue > rightValue) {
+ rightPageData.next();
+ } else { // leftValue < rightValue
+ leftPageData.next();
+ }
+
+ if (leftValue > stopBatchTime && rightValue > stopBatchTime) {
+ if (hasCachedValue) {
+ break;
}
}
+ /*
+ * [1,2,3,4,5] <- reFill data and cal stopBatchTime
+ * [6,7,8,9,10,11]
+ */
+ fillLeftData();
+ fillRightData();
+ stopBatchTime = getStopBatchTime();
Review comment:
left child:[1,2,3] [4,5,6] [7,8,9]
right child:[1,10]
that will load many page into memory
----------------------------------------------------------------
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