Impala Public Jenkins has submitted this change and it was merged. ( 
https://gerrit.cloudera.org/25039 )

Change subject: IMPALA-15493: Coordinator-local DDL execution for Iceberg REST 
catalogs
......................................................................

IMPALA-15493: Coordinator-local DDL execution for Iceberg REST catalogs

DDL on a table loaded from an Iceberg REST catalog has always been built
as a TDdlExecRequest and sent to CatalogD, which does not know the table
in hybrid mode and does not exist in standalone mode. This adds the DDL
counterpart of the coordinator-side DML finalization introduced in
IMPALA-15310.

TCatalogOpRequest carries an optional rest_catalog_name. When it is set,
CatalogOpExecutor hands the DDL to the coordinator frontend through the
new TIcebergDdlExecRequest JNI call instead of CatalogD, and
ClientRequestState skips the catalog update wait, since nothing is
cached on the coordinator for REST tables, and records the REST catalog
in the query profile. The new IcebergDdlExecutor
executes the operation through the named catalog without loading the
table first, so tables with unreadable metadata can still be dropped.
It lower-cases the database and table names, as CatalogD does, and like
CatalogD it never drops a blacklisted table.

The new CatalogRef names the catalog that serves a table: CatalogD, or a
REST catalog, addressed by its name when the name is unique.
MetaProvider.getCatalogRef(db, table) answers without loading the
table, and FeCatalog exposes it. A single provider serves all of its
tables. MultiMetaProvider keeps merging databases across providers as
introduced in IMPALA-14016, and answers from a fresh listing of the
database in every provider, without remembering anything between
statements. The table is served by the provider that lists it. A table
that no provider lists is served by the first provider that has its
database, and a missing database by the primary provider: CatalogD when
it is deployed, otherwise the first REST catalog. When several providers
list the table, or a provider fails to list the database for another
reason than not having it, the catalog cannot be decided and the table
is ambiguous, so DDL on it is rejected. In hybrid mode this also rejects
DROP TABLE on CatalogD tables of a database while a REST catalog that
may hold them cannot be reached.

The new IcebergRestDdlRouter decides, after analysis, how a DDL is
executed, so routing stays out of the DDL statement classes. The
catalog that serves the target has to agree with the table that
analysis loaded, otherwise the statement is rejected, e.g. when the
table was recreated in another catalog in between. Targets served by
CatalogD go to CatalogD as before. On a REST target:
- a table that was loaded or failed to load is dropped through its REST
  catalog, which needs a unique name; otherwise the DDL is rejected with
  the same error as for a loaded table.
- DROP TABLE/VIEW IF EXISTS on a target that analysis did not find is a
  no-op on the coordinator with the summary CatalogD gives, so a REST
  catalog never drops a table, e.g. a blacklisted or mixed-case one,
  that only the ANY privilege was checked for.
- DROP VIEW IF EXISTS on a table is a no-op, as REST catalogs serve no
  views.

IcebergMetaProvider now reports a failure to load a table, including the
unchecked exceptions of the REST client, such as a table or namespace
that disappeared after it was listed, as TException. LocalDb then
turns the table into a failed table that DROP TABLE can still analyze,
as it already did for tables served through MultiMetaProvider.

DROP TABLE [IF EXISTS] [PURGE] is the first operation carried by the new
path: IcebergRESTCatalog.dropTable() is implemented and the analyzer
lets DROP TABLE through for REST tables whose catalog has a unique name.
PURGE asks the REST catalog to delete the data files as well. Other DDL
is still rejected at analysis.

Since the catalog name now routes DDL as well, the DML-specific names
are generalized: getIcebergDmlCatalogName() becomes getCatalogName(),
and FeCatalogManager.getCatalogForIcebergDml() becomes getCatalog() (for
loading the tables of a catalog), next to the new getIcebergCatalog()
(for DROP TABLE).

Testing:
- New IcebergDdlExecutorTest covers execution, blacklisted tables,
  upper-case names and the error paths without a live catalog.
- New MultiMetaProviderTest covers which provider serves a table of a
  merged database, a table moving between providers, missing tables
  and databases, and ambiguous tables: listed by several providers, or
  in a database that a provider fails to list.
- New IcebergMetaProviderTest covers reporting REST failures to load a
  table, including a missing table or namespace, as TException.
- New AnalyzerCapabilityTest case; MetaProviderDecoratorTest covers the
  new MetaProvider method.
- New custom cluster tests drop REST tables with and without CatalogD,
  across two REST catalogs, with upper-case names, tables that fail to
  load with one and with two REST catalogs sharing a database name,
  blacklisted tables, a mixed-case table that IF EXISTS leaves alone,
  and IF EXISTS on missing tables, views and databases.
- Updated the REST catalog documentation.

Change-Id: I932a211b25ea4e24a607d047c35da186d8922d02
Assisted-by: Claude Fable 5.1 (Claude Code)
Assisted-by: Claude Opus 5.5 (Claude Code)
Reviewed-on: https://gerrit.cloudera.org/25039
Reviewed-by: Noemi Pap-Takacs <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M be/src/exec/catalog-op-executor.cc
M be/src/exec/catalog-op-executor.h
M be/src/service/client-request-state.cc
M be/src/service/frontend.cc
M be/src/service/frontend.h
M common/thrift/Frontend.thrift
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/DropTableOrViewStmt.java
A fe/src/main/java/org/apache/impala/catalog/CatalogRef.java
M fe/src/main/java/org/apache/impala/catalog/FeCatalog.java
M fe/src/main/java/org/apache/impala/catalog/FeIcebergTable.java
M fe/src/main/java/org/apache/impala/catalog/iceberg/IcebergRESTCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/IcebergMetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalIcebergTable.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProvider.java
M fe/src/main/java/org/apache/impala/catalog/local/MetaProviderDecorator.java
M fe/src/main/java/org/apache/impala/catalog/local/MultiMetaProvider.java
M fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java
M fe/src/main/java/org/apache/impala/service/Frontend.java
A fe/src/main/java/org/apache/impala/service/IcebergDdlExecutor.java
M fe/src/main/java/org/apache/impala/service/IcebergDmlFinalizer.java
A fe/src/main/java/org/apache/impala/service/IcebergRestDdlRouter.java
M fe/src/main/java/org/apache/impala/service/JniFrontend.java
M 
fe/src/main/java/org/apache/impala/service/catalogmanager/FeCatalogManager.java
M fe/src/main/java/org/apache/impala/service/catalogmanager/LocalImpl.java
M fe/src/main/java/org/apache/impala/service/catalogmanager/TestImpl.java
M fe/src/test/java/org/apache/impala/analysis/AnalyzerCapabilityTest.java
A fe/src/test/java/org/apache/impala/catalog/local/IcebergMetaProviderTest.java
M 
fe/src/test/java/org/apache/impala/catalog/local/MetaProviderDecoratorTest.java
A fe/src/test/java/org/apache/impala/catalog/local/MultiMetaProviderTest.java
A fe/src/test/java/org/apache/impala/service/IcebergDdlExecutorTest.java
M fe/src/test/java/org/apache/impala/service/IcebergRestDmlOperationTest.java
M fe/src/test/java/org/apache/impala/service/catalogmanager/LocalImplTest.java
M tests/custom_cluster/test_iceberg_rest_catalog.py
36 files changed, 1,557 insertions(+), 80 deletions(-)

Approvals:
  Noemi Pap-Takacs: Looks good to me, approved
  Impala Public Jenkins: Verified

--
To view, visit https://gerrit.cloudera.org/25039
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I932a211b25ea4e24a607d047c35da186d8922d02
Gerrit-Change-Number: 25039
Gerrit-PatchSet: 15
Gerrit-Owner: Peter Rozsa <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Daniel Vanko <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Mihaly Szjatinya <[email protected]>
Gerrit-Reviewer: Noemi Pap-Takacs <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to