c21 commented on a change in pull request #35002:
URL: https://github.com/apache/spark/pull/35002#discussion_r775301890



##########
File path: 
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcArrayColumnVector.java
##########
@@ -31,26 +32,27 @@
  */
 public class OrcArrayColumnVector extends OrcColumnVector {
   private final OrcColumnVector data;
-  private final long[] offsets;
-  private final long[] lengths;
+  private ListColumnVector listData;
 
   OrcArrayColumnVector(
       DataType type,
       ColumnVector vector,
-      OrcColumnVector data,
-      long[] offsets,
-      long[] lengths) {
+      OrcColumnVector data) {
 
     super(type, vector);
 
     this.data = data;
-    this.offsets = offsets;
-    this.lengths = lengths;
+
+    if (vector instanceof ListColumnVector) {
+      listData = (ListColumnVector) vector;
+    } else {
+      throw new UnsupportedOperationException();
+    }
   }
 
   @Override
   public ColumnarArray getArray(int rowId) {
-    return new ColumnarArray(data, (int) offsets[rowId], (int) lengths[rowId]);
+    return new ColumnarArray(data, (int) listData.offsets[rowId], (int) 
listData.lengths[rowId]);

Review comment:
       We can just use `baseData` here:
   
   ```java
   public ColumnarArray getArray(int rowId) {
     int offset = (int) ((ListColumnVector) baseData).offsets[rowId];
     int length = (int) ((ListColumnVector) baseData).lengths[rowId];
     return new ColumnarArray(data, offset, length);
   }
   ```




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