This is an automated email from the ASF dual-hosted git repository.
william pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/branch-1.7 by this push:
new 96b56f8 ORC-839: Fix head command for batch reader
96b56f8 is described below
commit 96b56f84327ad7b7e3c79db5df321ec1f00f72fe
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;
}
-
}
}
}