szehon-ho edited a comment on issue #2783:
URL: https://github.com/apache/iceberg/issues/2783#issuecomment-873875087


   Preliminary analysis:  The BaseFile class uses some pruning logic, keeping a 
mapping called 'fromProjectionPos' that maps indexes in a projection (a subset 
of its columns) to real indexes in its column list.
   
   Ie, if the projected array has three elements which are fields 1,2, and 10 
of the original schema respectively, fromProjectionPos becomes {1, 2, 10}.
   
   This is usually fine but the Spark generated code in Spark 3 uses the 
original index to get all the fields (It's entry point is StructInternalRow: 
https://github.com/apache/iceberg/blob/master/spark/src/main/java/org/apache/iceberg/spark/source/StructInternalRow.java#L124.
 (here 'struct' is the BaseDataFile with the pruning mapping, BUT spark 
initializes 'type' as the original (unpruned) list of fields).
   
   The calll getInt(0) expects an int as per the original schema at index 0, 
but due to the mapping we return value at index 1 which is actually a string 
and hence the error.


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