Daniel Vanko has uploaded this change for review. ( 
https://gerrit.cloudera.org/25466


Change subject: IMPALA-15505: Support TRUNCATE TABLE on Iceberg REST catalog 
tables
......................................................................

IMPALA-15505: Support TRUNCATE TABLE on Iceberg REST catalog tables

TRUNCATE TABLE on a table served by an Iceberg REST catalog was rejected
at analysis like every write other than the supported DML. CatalogD does
not know these tables, so the statement is now executed on the
coordinator through the DDL path added by IMPALA-15493, like DROP TABLE.

- TruncateStmt lets a REST table through when its catalog has a unique
  name, and the error for a catalog without one is the one of
  DROP TABLE.
- IcebergRestDdlRouter routes TRUNCATE like DROP TABLE. The catalog that
  serves the table is looked up afresh and has to agree with the table
  that analysis loaded; targets of CatalogD go there as before.
  IF EXISTS on a target that analysis did not find is a no-op with the
  summary of CatalogD, so a REST catalog never truncates a table, e.g. a
  blacklisted or mixed-case one, that only the INSERT privilege was
  checked on. A table that failed to load fails the statement, as in
  CatalogD. The lookup of the target is shared with DROP TABLE/VIEW.
- IcebergDdlExecutor loads the table through the REST catalog and
  commits one transaction that deletes all of its data files, as
  CatalogD does for Iceberg tables. The files stay for the older
  snapshots. Missing and blacklisted tables do not exist, as in
  CatalogD. REST catalog tables have no statistics, so
  DELETE_STATS_IN_TRUNCATE has nothing to do.

Testing:
- IcebergDdlExecutorTest truncates real local Iceberg tables
  (unpartitioned, partitioned, empty, of format versions 2 and 3) and
  covers upper-case names, missing and blacklisted tables, and a failed
  commit.
- Added new IcebergRestDdlRouterTest to cover the routing of TRUNCATE
  and DROP TABLE/VIEW as well.
  The DROP cases also pass on the previous router.
- AnalyzerCapabilityTest checks that TRUNCATE TABLE, like DROP TABLE,
  needs a REST catalog with a unique name.
- New iceberg-rest-truncate.test and custom cluster tests for TRUNCATE
  without catalogd on unpartitioned, partitioned and delete file tables,
  with catalogd next to a table of catalogd, across two REST catalogs
  and on a blacklisted table.

Change-Id: I0afe90fafecb3d587af9dfed777604205a059bdc
Assisted-by: Claude Sonnet 5.5 (Claude Code)
Assisted-by: Claude Opus 5.5 (Claude Code)
---
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/TruncateStmt.java
M fe/src/main/java/org/apache/impala/service/IcebergDdlExecutor.java
M fe/src/main/java/org/apache/impala/service/IcebergRestDdlRouter.java
M fe/src/test/java/org/apache/impala/analysis/AnalyzerCapabilityTest.java
M fe/src/test/java/org/apache/impala/service/IcebergDdlExecutorTest.java
A fe/src/test/java/org/apache/impala/service/IcebergRestDdlRouterTest.java
M testdata/workloads/functional-query/queries/QueryTest/iceberg-rest-merge.test
A 
testdata/workloads/functional-query/queries/QueryTest/iceberg-rest-truncate.test
M tests/common/iceberg_rest_test_tables.py
M tests/custom_cluster/test_iceberg_rest_catalog.py
12 files changed, 1,061 insertions(+), 65 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/66/25466/1
--
To view, visit https://gerrit.cloudera.org/25466
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0afe90fafecb3d587af9dfed777604205a059bdc
Gerrit-Change-Number: 25466
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Vanko <[email protected]>

Reply via email to