Hello Peter Rozsa, Noemi Pap-Takacs, Impala Public Jenkins,

I'd like you to reexamine a change. Please visit

    https://gerrit.cloudera.org/25276

to look at the new patch set (#2).

Change subject: IMPALA-15730: Fix DROP PARTITION dropping other Iceberg 
partitions
......................................................................

IMPALA-15730: Fix DROP PARTITION dropping other Iceberg partitions

ALTER TABLE DROP PARTITION on an Iceberg table sent the paths of the
selected data and delete files to catalogd, or truncated the table if
their number matched the total number of data and delete files in the
snapshot summary. The truncate could drop files that the statement did
not select, in two ways:
 - The paths were collected into a list from the scan tasks of the
   selected data files. A delete file that applies to several of them,
   e.g. a position delete file of format version 2 or an equality
   delete file, is in the deletes of each of their scan tasks, so it
   was counted several times. If the inflated count matched the total,
   a partial drop truncated the table.
 - The truncate was decided on the snapshot of the analysis, but
   catalogd committed DeleteFiles.deleteFromRowFilter(alwaysTrue()),
   which is evaluated on the table at commit time. Files committed in
   between, by Impala or by another engine, were dropped too, also in
   partitions that the statement did not select. Nothing validated that
   the table did not change: DeleteFiles has no validateFromSnapshot(),
   and on a commit conflict Iceberg refreshes the table and applies
   alwaysTrue() again to the new state.

The truncate shortcut is removed. The analysis sends the paths of the
selected data files only, as a set, and catalogd deletes them with
DeleteFiles.deleteFile(), also if every partition is selected:
 - Files committed after the analysis are kept, in every partition,
   also on the commit retries of Iceberg, as with DELETE.
 - validateFilesExist() makes the commit fail if a selected data file
   was removed since the analysis, e.g. by a concurrent OPTIMIZE.
   Before, the missing path was ignored and the rewritten data of the
   dropped partitions stayed in the table.
 - The paths of delete files are not sent: DeleteFiles.deleteFile()
   matches data files only, so they were ignored before, and
   validateFilesExist() would fail on them.

TIcebergDropPartitionRequest loses is_truncate, and
FeIcebergTable.Utils.getTotalNumberOfFiles() is removed, as nothing
uses them anymore.

The delete files of the dropped partitions are dropped as before:
Iceberg drops the deletion vectors of the deleted data files, and the
delete files that are older than every remaining data file. A position
delete file of format version 2 stays in the table while it is not
older than every remaining data file. It applies to no data file, so
it does not change the results, and compaction removes it. Dropping it
with the partition is tracked in IMPALA-15483.

Testing:
 - Added EE tests that drop a partition with a position delete file
   that applies to two data files, in a table of format version 2 and
   in a table upgraded to format version 3, and then the last
   partition.
 - test_drop_partition, test_rollback_after_drop_partition and
   AnalyzeDDLTest#TestAlterTableAddDropPartition pass.

Change-Id: I47dd166a468f1ae038c36e052cfe24fbb9932a3c
Assisted-by: Claude Opus 5.5 (Claude Code)
---
M common/thrift/CatalogObjects.thrift
M fe/src/main/java/org/apache/impala/analysis/AlterTableDropPartitionStmt.java
M fe/src/main/java/org/apache/impala/catalog/FeIcebergTable.java
M fe/src/main/java/org/apache/impala/service/IcebergCatalogOpExecutor.java
M 
testdata/workloads/functional-query/queries/QueryTest/iceberg-drop-partition.test
5 files changed, 69 insertions(+), 67 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/76/25276/2
--
To view, visit https://gerrit.cloudera.org/25276
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I47dd166a468f1ae038c36e052cfe24fbb9932a3c
Gerrit-Change-Number: 25276
Gerrit-PatchSet: 2
Gerrit-Owner: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>

Reply via email to