Repository: carbondata
Updated Branches:
  refs/heads/master dbb7ca1b1 -> 7584bf7d5


[CARBONDATA-3121] Improvement of CarbonReader build time

CarbonReader builder is taking huge time.

Reason
Initialization of ChunkRowIterator is triggering actual I/O operation, and thus 
huge build time.

Solution
remove CarbonIterator.hasNext() and CarbonIterator.next() from build.

This closes #2942


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/7584bf7d
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/7584bf7d
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/7584bf7d

Branch: refs/heads/master
Commit: 7584bf7d5660e72c2658bae1eb9eeeceabbf7c8f
Parents: dbb7ca1
Author: Naman Rastogi <[email protected]>
Authored: Thu Nov 22 13:57:50 2018 +0530
Committer: kunal642 <[email protected]>
Committed: Tue Nov 27 14:49:16 2018 +0530

----------------------------------------------------------------------
 .../scan/result/iterator/ChunkRowIterator.java   | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/7584bf7d/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ChunkRowIterator.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ChunkRowIterator.java
 
b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ChunkRowIterator.java
index 3ce69ed..03efc3d 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ChunkRowIterator.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ChunkRowIterator.java
@@ -39,9 +39,6 @@ public class ChunkRowIterator extends 
CarbonIterator<Object[]> {
 
   public ChunkRowIterator(CarbonIterator<RowBatch> iterator) {
     this.iterator = iterator;
-    if (iterator.hasNext()) {
-      currentChunk = iterator.next();
-    }
   }
 
   /**
@@ -52,17 +49,11 @@ public class ChunkRowIterator extends 
CarbonIterator<Object[]> {
    * @return {@code true} if the iteration has more elements
    */
   @Override public boolean hasNext() {
-    if (null != currentChunk) {
-      if ((currentChunk.hasNext())) {
-        return true;
-      } else if (!currentChunk.hasNext()) {
-        while (iterator.hasNext()) {
-          currentChunk = iterator.next();
-          if (currentChunk != null && currentChunk.hasNext()) {
-            return true;
-          }
-        }
-      }
+    if (currentChunk != null && currentChunk.hasNext()) {
+      return true;
+    } else if (iterator != null && iterator.hasNext()) {
+      currentChunk = iterator.next();
+      return hasNext();
     }
     return false;
   }

Reply via email to