This is an automated email from the ASF dual-hosted git repository.

william pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new 0d829f7  ORC-839: Fix head command for batch reader
0d829f7 is described below

commit 0d829f7f710a13677ad7c1c46f8a58432de01f8e
Author: Yukihiro Okada <[email protected]>
AuthorDate: Sun Jul 4 14:03:15 2021 +0900

    ORC-839: Fix head command for batch reader
    
    Closes #737
    
    Signed-off-by: William Hyun <[email protected]>
---
 java/tools/src/java/org/apache/orc/tools/PrintData.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/tools/src/java/org/apache/orc/tools/PrintData.java 
b/java/tools/src/java/org/apache/orc/tools/PrintData.java
index 95df4ec..875a6a2 100644
--- a/java/tools/src/java/org/apache/orc/tools/PrintData.java
+++ b/java/tools/src/java/org/apache/orc/tools/PrintData.java
@@ -208,6 +208,9 @@ public class PrintData {
       VectorizedRowBatch batch = schema.createRowBatch();
       Integer counter = 0;
       while (rows.nextBatch(batch)) {
+        if (numberOfRows.isPresent() && counter >= numberOfRows.get()){
+            break;
+        }
         for (int r=0; r < batch.size; ++r) {
           JSONWriter writer = new JSONWriter(out);
           printRow(writer, batch, schema, r);
@@ -221,7 +224,6 @@ public class PrintData {
             if (counter >= numberOfRows.get()){
               break;
             }
-
           }
         }
       }

Reply via email to