Nandor Kollar has uploaded a new patch set (#2). ( https://gerrit.cloudera.org/25454 )
Change subject: IMPALA-15793: Fix DML on Iceberg partitions with a dropped source column ...................................................................... IMPALA-15793: Fix DML on Iceberg partitions with a dropped source column After the partition spec of an Iceberg table changed and the source column of a partition field of an old spec was dropped, DELETE, UPDATE and MERGE on rows in data files of the old spec didn't take effect in release builds: the statements reported success, but the deleted rows stayed in the table, in Impala and in other engines. In debug builds impalad crashed on a DCHECK in the delete sink. Since IMPALA-13591, Impala describes a partition field whose source column was dropped as VOID, but the scan still serialized its value from the partition data of the data files, so the delete sink got a partition value for a VOID field. Release builds committed the delete file with a null partition value. Iceberg types such a field as unknown, and doesn't match partition-scoped position deletes of the spec to its data files, whatever their partition value. Only deletes that reference a single data file are matched, by path. Impala writes the position deletes of a partition into one delete file, so a statement that deleted rows from several data files of such a partition had no effect with format version 2. Deletion vectors always reference a single data file. The fix: - The scan serializes the partition fields with a dropped source column as VOID, consistently with the partition specs of Impala. - catalogd reloads the file metadata when the partition fields with a dropped source column change, also without a new snapshot, and serializes the partition values of the reused file descriptors of their specs again. - The delete sink writes one position delete file per data file in the specs with such a field, and in the current spec if the delete has no partition key exprs, as then every delete file gets the current spec id. The specs are sent in the new TIcebergDeleteSink.file_scoped_spec_ids. - The commit builds the partition data of such specs with null for the VOID fields, instead of no partition data. - A position delete file whose deletes reference a single data file gets referenced_data_file, so readers don't need its bounds to match it. lookupDeletionVectors() only collects deletion vectors. - The delete sink returns an error instead of a DCHECK when the partition values don't match the partition spec. Also removes the unused Table parameter of IcebergUtil.createIcebergMetadata() and redundant ByteBuffer casts. Delete files committed before this fix stay ineffective; the affected statements have to be run again. Testing: - Added EE tests to iceberg-alter-v2.test for DELETE, UPDATE and MERGE on data files of a spec with a dropped source column, with format version 2 and 3, with and without a predicate on a partition column: an unpartitioned current spec, a spec with two fields of which one is dropped, a deletion vector replaced by a second DELETE, a column added again with the same name, BUCKET and DAY transforms with the columns dropped one by one, and the referenced_data_file of position delete files. They failed before the fix. - Added IcebergDroppedPartitionSourceTest for the partition fields with a dropped source column, their serialized partition values and the partition data of delete files. - test_iceberg.py tests about DELETE, UPDATE, MERGE, OPTIMIZE, partitions, ALTER and format version 3 pass, except test_v3_variant* (missing test data) and test_metadata_tables, which fail without this change too. Change-Id: I03ae34cb19197e9d711fc462c4bcf6f050291648 Assisted-by: Claude Opus 5.5 (Claude Code) --- M be/src/exec/iceberg-buffered-delete-sink.cc M be/src/exec/iceberg-buffered-delete-sink.h M be/src/exec/iceberg-delete-sink-base.cc M be/src/exec/iceberg-delete-sink-base.h M be/src/exec/iceberg-delete-sink-config.cc M be/src/exec/iceberg-delete-sink-config.h M common/thrift/DataSinks.thrift M fe/src/main/java/org/apache/impala/catalog/IcebergFileMetadataLoader.java M fe/src/main/java/org/apache/impala/catalog/IcebergTable.java M fe/src/main/java/org/apache/impala/planner/IcebergBufferedDeleteSink.java M fe/src/main/java/org/apache/impala/planner/IcebergScanPlanner.java M fe/src/main/java/org/apache/impala/service/IcebergCatalogOpExecutor.java M fe/src/main/java/org/apache/impala/util/IcebergUtil.java A fe/src/test/java/org/apache/impala/util/IcebergDroppedPartitionSourceTest.java M testdata/workloads/functional-query/queries/QueryTest/iceberg-alter-v2.test 15 files changed, 733 insertions(+), 34 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/54/25454/2 -- To view, visit https://gerrit.cloudera.org/25454 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I03ae34cb19197e9d711fc462c4bcf6f050291648 Gerrit-Change-Number: 25454 Gerrit-PatchSet: 2 Gerrit-Owner: Nandor Kollar <[email protected]>
