zhangminglei commented on a change in pull request #3186:
URL: https://github.com/apache/iceberg/pull/3186#discussion_r745374480



##########
File path: 
spark/v2.4/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java
##########
@@ -119,6 +122,8 @@ public UTF8String getUTF8String(int rowId) {
 
   @Override
   protected ColumnVector getChild(int ordinal) {
-    throw new UnsupportedOperationException("ConstantColumnVector only 
supports primitives");
+    DataType sparkType = ((StructType) type).fields()[ordinal].dataType();
+    Type childType = SparkSchemaUtil.convert(sparkType);
+    return new ConstantColumnVector(childType, batchSize, ((InternalRow) 
constant).get(ordinal, sparkType));

Review comment:
       ```
   ColumnarRow #
   
     @Override
     public UTF8String getUTF8String(int ordinal) {
       return data.getChild(ordinal).getUTF8String(rowId);
     }
   ```
   To get a column value in a row use `getChild` when performing spark 
vectorization reads to fetch each column element.
   
   
![image](https://user-images.githubusercontent.com/6520673/140884504-fc9eb57c-0183-4713-b0c5-9be0c05fd441.png)
   




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