zhztheplayer commented on code in PR #6458:
URL: https://github.com/apache/incubator-gluten/pull/6458#discussion_r1721276174


##########
backends-velox/src/test/java/org/apache/gluten/columnarbatch/ColumnarBatchTest.java:
##########
@@ -134,4 +151,23 @@ private static ColumnarBatch newArrowBatch(String schema, 
int numRows) {
     batch.setNumRows(numRows);
     return batch;
   }
+
+  private static ColumnarBatch newArrowBatch(int numRows) {
+    String schema = "a boolean, b int";
+    final ArrowWritableColumnVector[] columns =
+        ArrowWritableColumnVector.allocateColumns(numRows, 
StructType.fromDDL(schema));
+    ArrowWritableColumnVector col1 = columns[0];
+    ArrowWritableColumnVector col2 = columns[1];
+    for (int j = 0; j < numRows; j++) {
+      col1.putBoolean(j, j % 2 == 0);
+      col2.putInt(j, 15 - j);
+    }
+    col2.putNull(numRows - 1);
+    for (ArrowWritableColumnVector col : columns) {
+      col.setValueCount(numRows);
+    }
+    final ColumnarBatch batch = new ColumnarBatch(columns);
+    batch.setNumRows(numRows);
+    return batch;
+  }

Review Comment:
   Can we remove this method? Could fill in the vectors in test case's code.
   
   E.g.,
   
   ``` scala
             final int numRows = 100;
             final ColumnarBatch batch = newArrowBatch("a boolean, b int", 
numRows);
             final ArrowWritableColumnVector col0 = (ArrowWritableColumnVector) 
batch.column(0);
             final ArrowWritableColumnVector col1 = (ArrowWritableColumnVector) 
batch.column(1);
             for (int j = 0; j < numRows; j++) {
               col0.putBoolean(j, j % 2 == 0);
               col1.putInt(j, 15 - j);
             }
             col1.putNull(numRows - 1);
   ```
   



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to