Mihaly Szjatinya has uploaded a new patch set (#6). ( 
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 getCatalogRef(db), 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 multiple 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 multiple 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 so are
the database properties 'owner' and 'ownerType', which IMPALA-15508
will read, and 'location', which would bypass the authorization of
LOCATION, all case-insensitively. IcebergUtil.findReservedProperty()
does the check, so that CREATE TABLE and ALTER TABLE can reuse it.

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 getCatalogRef(db).
- IcebergDdlExecutorTest: CREATE/DROP DATABASE, including existing,
  missing, non-empty and blacklisted databases, CASCADE and reserved
  database properties.
- test_iceberg_rest_catalog.py: test_rest_catalog_drop_database with
  and without CatalogD, including RESTRICT,
  test_rest_catalog_create_database, including IF NOT EXISTS with
  properties and CREATE/DROP SCHEMA, rejection of CREATE DATABASE with
  multiple catalogs and of reserved database properties, DROP DATABASE
  without a unique catalog name. Tests with multiple 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/main/java/org/apache/impala/util/IcebergUtil.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
17 files changed, 785 insertions(+), 66 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/74/25374/6
--
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: newpatchset
Gerrit-Change-Id: I738850dd6103f1bd4417379e0ebea56b00543e90
Gerrit-Change-Number: 25374
Gerrit-PatchSet: 6
Gerrit-Owner: Mihaly Szjatinya <[email protected]>
Gerrit-Reviewer: Aleksandr Efimov <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Mihaly Szjatinya <[email protected]>
Gerrit-Reviewer: Nandor Kollar <[email protected]>
Gerrit-Reviewer: Peter Rozsa <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to