roryqi opened a new pull request, #11319:
URL: https://github.com/apache/gravitino/pull/11319
### What changes were proposed in this pull request?
When listing schemas with a `parentSchema` query parameter against a catalog
that
does not support hierarchical (nested) schemas (e.g. Hive), Gravitino
incorrectly
returned the catalog's flat schemas as if they were children of the parent
schema.
This PR adds a catalog capability for hierarchical schemas and rejects the
unsupported request:
- **`Capability.supportsHierarchicalSchema()`**: new capability method,
defaulting
to *unsupported* in `DefaultCapability`. Flat-schema catalogs (Hive, JDBC,
Kafka,
Paimon, ...) inherit the default with no per-catalog change.
- **`IcebergCatalogCapability`**: overrides it to *supported*, since Iceberg
namespaces can be multi-level.
- **`SchemaNormalizeDispatcher.listSchemas`**: when a `parentSchema` is
supplied
(namespace deeper than `[metalake, catalog]`) and the catalog does not
support
hierarchical schemas, throw `UnsupportedOperationException`. This is
mapped to an
unsupported-operation REST error and surfaced as
`UnsupportedOperationException`
on the Java client.
### Why are the changes needed?
`GET .../catalogs/{hive}/schemas?parentSchema=default` returned:
```json
{ "code": 0, "identifiers": [ { "namespace":
["test","catalog_hive_edited","default"], "name": "default" } ] }
```
i.e. the schema `default` was returned as a child of itself. Non-hierarchical
catalogs have no sub-schemas, so this is misleading data.
Fix: #11317
### Does this PR introduce _any_ user-facing change?
Listing schemas with a `parentSchema` against a non-hierarchical catalog now
returns
an unsupported-operation error (`UnsupportedOperationException` on the Java
client)
instead of misleading results.
### How was this patch tested?
-
`TestSchemaNormalizeDispatcher.testListSchemasUnderParentSchemaUnsupported`
(core)
- `TestIcebergCatalogCapability.testSupportsHierarchicalSchema` (iceberg)
- `CatalogHive2IT.testListSchemasWithParentSchemaUnsupported` (Hive
integration test)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]