pvary commented on code in PR #15508:
URL: https://github.com/apache/iceberg/pull/15508#discussion_r2940711011
##########
core/src/main/java/org/apache/iceberg/avro/ValueReaders.java:
##########
@@ -254,6 +254,9 @@ private static Pair<Integer, ValueReader<?>>
fileFieldReader(
Integer projectionPos,
ValueReader<?> fieldReader,
Map<Integer, ?> idToConstant) {
+ if (projectionPos == null && !idToConstant.containsKey(fieldId)) {
+ return Pair.of(projectionPos, fieldReader);
+ }
if (Objects.equals(fieldId, MetadataColumns.ROW_ID.fieldId())) {
Review Comment:
```suggestion
if (projectionPos == null) {
// field is in the file but not projected; keep the reader only for
skipping
return Pair.of(null, fieldReader);
} else if (Objects.equals(fieldId, MetadataColumns.ROW_ID.fieldId())) {
```
We can also change this:
```
private static Pair<Integer, ValueReader<?>> fieldReader(
Integer fieldId,
Integer projectionPos,
ValueReader<?> fieldReader,
Map<Integer, ?> idToConstant) {
Object constant = idToConstant.get(fieldId);
if (constant != null) {
```
to
```
private static Pair<Integer, ValueReader<?>> fieldReader(
Integer fieldId,
Integer projectionPos,
ValueReader<?> fieldReader,
Map<Integer, ?> idToConstant) {
Object constant = idToConstant.get(fieldId);
if (projectionPos != null && constant != null) {
```
--
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]