Mihaly Szjatinya has uploaded this change for review. ( 
https://gerrit.cloudera.org/25374


Change subject: IMPALA-15503: Support CREATE/DROP DATABASE on Iceberg REST 
catalogs
......................................................................

IMPALA-15503: Support CREATE/DROP DATABASE on Iceberg REST catalogs

Impala had no way to create or drop an Iceberg REST namespace: CREATE
DATABASE and DROP DATABASE always went to CatalogD, which does not know
REST catalogs, and failed without CatalogD. Both now run on the
coordinator through the REST catalog that serves the database, like
DROP TABLE since IMPALA-15493.

DROP DATABASE is routed by the new getDbCatalogRef(), which lists the
databases of every catalog afresh. A database that one catalog lists
belongs to it, and a missing one to the primary catalog. A database
that several catalogs list is rejected as ambiguous, also when one of
them is the Hive Metastore, as is a database whose catalog cannot be
decided because a catalog fails to list its databases. On a REST
catalog:
- the namespace is dropped through the REST catalog, which needs a
  unique name;
- CASCADE is rejected, as the REST protocol drops empty namespaces
  only, and a namespace that still holds tables is rejected by the
  server;
- IF EXISTS on a missing database is a no-op on the coordinator.

CREATE DATABASE is rejected whenever several catalogs are configured,
also for databases in the Hive Metastore, as any of them could create
the database. With a single REST catalog, the namespace is created
through it. The comment, the location and the database properties
become namespace properties; MANAGEDLOCATION is rejected, and no owner
is set (IMPALA-15508).

IcebergMetaProvider now reports no functions instead of throwing, so
that DROP DATABASE can analyze a REST namespace.

Testing:
- MultiMetaProviderTest: database routing by fresh listing, ambiguous
  databases, failing catalogs, LocalCatalog.isMultiCatalog().
- MetaProviderDecoratorTest: delegation of getDbCatalogRef().
- IcebergDdlExecutorTest: CREATE/DROP DATABASE, including existing,
  missing, non-empty and blacklisted databases, and CASCADE.
- test_iceberg_rest_catalog.py: test_rest_catalog_drop_database with
  and without CatalogD, test_rest_catalog_create_database, rejection of
  CREATE DATABASE with several catalogs, DROP DATABASE without a unique
  catalog name. Tests with several catalogs create their Hive Metastore
  databases through Hive, as Impala no longer can.

Regression:
- test_iceberg_rest_catalog.py: DROP TABLE routing and REST DML share
  the router, the executor and the catalog providers.
- IcebergMetaProviderTest, LocalImplTest: REST provider and catalog
  manager wiring.
- AnalyzerCapabilityTest: DDL capability checks on REST tables.
- AnalyzeDDLTest: CREATE/DROP DATABASE analysis with a single catalog.
- test_ranger.py::TestRangerIcebergRestCatalog: authorization with a
  single REST catalog.

Change-Id: I738850dd6103f1bd4417379e0ebea56b00543e90
Assisted-by: Claude Opus 5.5 (GitHub Copilot)
---
M docs/topics/impala_iceberg_rest_catalog.xml
M fe/src/main/java/org/apache/impala/analysis/CreateDbStmt.java
M fe/src/main/java/org/apache/impala/analysis/StmtMetadataLoader.java
M fe/src/main/java/org/apache/impala/catalog/FeCatalog.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/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/IcebergDdlExecutor.java
M fe/src/main/java/org/apache/impala/service/IcebergRestDdlRouter.java
M 
fe/src/test/java/org/apache/impala/catalog/local/MetaProviderDecoratorTest.java
M fe/src/test/java/org/apache/impala/catalog/local/MultiMetaProviderTest.java
M fe/src/test/java/org/apache/impala/service/IcebergDdlExecutorTest.java
M tests/custom_cluster/test_iceberg_rest_catalog.py
16 files changed, 681 insertions(+), 26 deletions(-)



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I738850dd6103f1bd4417379e0ebea56b00543e90
Gerrit-Change-Number: 25374
Gerrit-PatchSet: 1
Gerrit-Owner: Mihaly Szjatinya <[email protected]>

Reply via email to