j1wonpark commented on code in PR #4085:
URL: https://github.com/apache/amoro/pull/4085#discussion_r2892983821
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/scan/TableEntriesScan.java:
##########
@@ -429,6 +432,20 @@ private int dataFileFieldIndex(String fieldName) {
return lazyIndexOfDataFileType.get(fieldName);
}
+ private StructLike projectPartition(PartitionSpec spec, StructLike
partition) {
Review Comment:
Thanks for the suggestion! At first glance they do look similar, but the
projection direction is actually reversed.
`coercePartition` projects **spec-specific → unified** (input:
`spec.partitionType()`, output: `partitionType`):
```java
StructProjection.createAllowMissing(spec.partitionType(), partitionType);
```
`projectPartition` here projects **unified → spec-specific** (input:
`unifiedPartitionType()`, output: `spec.partitionType()`):
```java
StructProjection.createAllowMissing(unifiedPartitionType(),
spec.partitionType());
```
In `TableEntriesScan`, the `partition` data is read from the entries
metadata table, which uses a unified partition schema
(`Partitioning.partitionType(table)`). But
`DataFiles.builder(spec).withPartition()` expects the spec-specific layout. So
we need the unified → spec direction, which is the opposite of what
`coercePartition` does.
--
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]