amogh-jahagirdar commented on code in PR #12928: URL: https://github.com/apache/iceberg/pull/12928#discussion_r2069572607
########## arrow/src/main/java/org/apache/iceberg/arrow/vectorized/VectorizedArrowReader.java: ########## @@ -461,6 +461,53 @@ public static VectorizedArrowReader positionsWithSetArrowValidityVector() { return new PositionVectorReader(true); } + public static VectorizedArrowReader rowIds(Long baseRowId, VectorizedArrowReader idReader) { + if (baseRowId != null) { + return new RowIdVectorReader(baseRowId, idReader); + } else { + return nulls(); + } + } + + public static VectorizedArrowReader lastUpdated( + Long baseRowId, Long fileLastUpdated, VectorizedArrowReader seqReader) { + if (fileLastUpdated != null && baseRowId != null) { + return new LastUpdatedSeqVectorReader(fileLastUpdated, seqReader); + } else { + return nulls(); + } + } + + public static VectorizedReader<?> replaceWithMetadataReader( + Types.NestedField icebergField, + VectorizedReader<?> reader, + Map<Integer, ?> idToConstant, + boolean setArrowValidityVector) { + int id = icebergField.fieldId(); + if (id == MetadataColumns.ROW_ID.fieldId()) { + Long baseRowId = (Long) idToConstant.get(id); + return rowIds(baseRowId, (VectorizedArrowReader) reader); + } else if (id == MetadataColumns.LAST_UPDATED_SEQUENCE_NUMBER.fieldId()) { + Long baseRowId = (Long) idToConstant.get(id); + Long fileSeqNumber = (Long) idToConstant.get(id); + return VectorizedArrowReader.lastUpdated( + baseRowId, fileSeqNumber, (VectorizedArrowReader) reader); + } else if (idToConstant.containsKey(id)) { + // containsKey is used because the constant may be null + return new ConstantVectorReader<>(icebergField, idToConstant.get(id)); + } else if (id == MetadataColumns.ROW_POSITION.fieldId()) { + if (setArrowValidityVector) { + return positionsWithSetArrowValidityVector(); + } else { + return VectorizedArrowReader.positions(); + } + } else if (id == MetadataColumns.IS_DELETED.fieldId()) { + return new DeletedVectorReader(); + } Review Comment: This is all pretty similar to what was done with the ParquetValueReader -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org