huan233usc commented on code in PR #18317:
URL: https://github.com/apache/iceberg/pull/18317#discussion_r4267410356
##########
spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkChangelogTable.java:
##########
@@ -86,12 +86,6 @@ private SparkSession spark() {
@Override
public MetadataColumn[] metadataColumns() {
- return new MetadataColumn[] {
- SparkMetadataColumns.SPEC_ID,
- SparkMetadataColumns.partition(table),
- SparkMetadataColumns.FILE_PATH,
- SparkMetadataColumns.ROW_POSITION,
- SparkMetadataColumns.IS_DELETED,
- };
+ return SparkMetadataColumns.metadataColumns(table);
Review Comment:
It seems that the newly exposed lineage columns reveal an existing Avro
reader issue for files written before a V2-to-V3 upgrade.
```sql
CREATE TABLE t (id INT, data STRING) USING iceberg
TBLPROPERTIES ('format-version'='2', 'write.format.default'='avro');
INSERT INTO t VALUES (1, 'a'), (2, 'b');
ALTER TABLE t SET TBLPROPERTIES ('format-version'='3');
SELECT id, _change_type, _row_id, _last_updated_sequence_number
FROM t.changes ORDER BY id;
```
The historical INSERT rows have `_row_id = null` but
`_last_updated_sequence_number = 1`. The [V3 upgrade
rules](https://github.com/apache/iceberg/blob/6302920606c71b83bca51c3b0b9aaa211961087e/format/spec.md#L1975)
require both lineage fields to be null when the data file's `first_row_id` is
null.
I think we may need to have special handling in
https://github.com/apache/iceberg/blob/c131e75958ff7bef67e22d241b02e5f8338b3955/core/src/main/java/org/apache/iceberg/avro/ValueReaders.java#L302?
--
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]