Peter Rozsa has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/25140 )

Change subject: IMPALA-15496: Enable DELETE on Iceberg REST catalog tables
......................................................................

IMPALA-15496: Enable DELETE on Iceberg REST catalog tables

IMPALA-15495 enabled UPDATE on REST-backed Iceberg tables. DELETE uses
the same REST finalization path, and IcebergCatalogOpExecutor.deleteRows()
only uses the Iceberg API (txn.newRowDelta()), so it was blocked only by
the two policy gates. This patch opens them for DELETE while keeping
MERGE, OPTIMIZE and TRUNCATE blocked.

- Analysis-time gate: with both UPDATE and DELETE allowed, ModifyStmt
  passes true to Analyzer.ensureTableWriteSupported(), and the
  isRestDmlSupported() hook added by IMPALA-15495 is removed. The error
  message now names INSERT INTO, INSERT OVERWRITE, UPDATE and DELETE.
- Commit-time gate: IcebergDmlFinalizer adds DELETE to SUPPORTED_REST_OPS.

DELETE without a WHERE clause is still rejected in favor of TRUNCATE,
which REST tables do not support. The REST catalog documentation lists
DELETE among the supported writes.

This patch also fixes the snapshot id of empty REST tables.
IcebergMetaProvider left catalog_snapshot_id unset for a table without
snapshots, so it read as 0 instead of -1, the value catalogd uses and
IcebergUtil.planFiles() checks for. Partition-pruned scans of empty
partitioned tables then failed with "Cannot find snapshot with ID 0",
for example DELETE ... WHERE on an empty partitioned table.

Testing:
- IcebergRestDmlOperationTest accepts DELETE and rejects MERGE.
  AnalyzerCapabilityTest uses the new message.
- New iceberg-rest-delete.test, adapted from iceberg-v3-delete.test, and
  iceberg-rest-delete-partitioned.test, adapted from
  iceberg-v3-delete-partitioned.test. Tests needing DDL or HMS tables are
  omitted; tables filled from functional.alltypes generate the same rows.
- New test_rest_catalog_delete, which also checks commit-state-unknown
  and commit-failure handling for DELETE, and
  test_rest_catalog_delete_partitioned. Their tables are declared
  through the 'test_tables' key of RestServerProperties, with the
  definitions in tests/common/iceberg_rest_test_tables.py. DELETE is
  removed from the unsupported statements in
  test_rest_catalog_insert_into.
- Ran test_iceberg_rest_catalog.py (16 tests) and the frontend tests
  above.

Change-Id: I2df0601901e88447e9153267e42695765148ed31
Assisted-by: Claude Opus 5.5 (Claude Code)
Reviewed-on: http://gerrit.cloudera.org:8080/25140
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Peter Rozsa <[email protected]>
---
M docs/topics/impala_iceberg_rest_catalog.xml
M fe/src/main/java/org/apache/impala/analysis/Analyzer.java
M fe/src/main/java/org/apache/impala/analysis/DeleteStmt.java
M fe/src/main/java/org/apache/impala/analysis/ModifyStmt.java
M fe/src/main/java/org/apache/impala/analysis/UpdateStmt.java
M fe/src/main/java/org/apache/impala/catalog/FeIcebergTable.java
M fe/src/main/java/org/apache/impala/catalog/local/IcebergMetaProvider.java
M fe/src/main/java/org/apache/impala/service/IcebergDmlFinalizer.java
M fe/src/test/java/org/apache/impala/analysis/AnalyzerCapabilityTest.java
M fe/src/test/java/org/apache/impala/service/IcebergRestDmlOperationTest.java
A 
testdata/workloads/functional-query/queries/QueryTest/iceberg-rest-delete-partitioned.test
A testdata/workloads/functional-query/queries/QueryTest/iceberg-rest-delete.test
M tests/common/iceberg_rest_test_tables.py
M tests/custom_cluster/test_iceberg_rest_catalog.py
14 files changed, 940 insertions(+), 65 deletions(-)

Approvals:
  Impala Public Jenkins: Verified
  Peter Rozsa: Looks good to me, approved

--
To view, visit http://gerrit.cloudera.org:8080/25140
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2df0601901e88447e9153267e42695765148ed31
Gerrit-Change-Number: 25140
Gerrit-PatchSet: 5
Gerrit-Owner: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Daniel Vanko <[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