diqiu50 commented on code in PR #10738:
URL: https://github.com/apache/gravitino/pull/10738#discussion_r3122771314
##########
core/src/main/java/org/apache/gravitino/catalog/SchemaOperationDispatcher.java:
##########
@@ -148,6 +152,9 @@ public Schema createSchema(NameIdentifier ident, String
comment, Map<String, Str
.withId(uid)
.withName(ident.name())
.withNamespace(ident.namespace())
+ .withProperties(
+ ImmutableMap.of(
+ SCHEMA_CREATED_BY_GRAVITINO,
SCHEMA_CREATED_BY_GRAVITINO_VALUE))
Review Comment:
Good question. The `StringIdentifier` is indeed retrievable from
`loadSchema` for most catalogs, but through different mechanisms:
- **Hive**: stored directly in HMS database properties at `createSchema`
time, returned as-is by `loadSchema`.
- **Iceberg / Paimon**: stored in namespace properties, returned as-is.
- **JDBC (PostgreSQL, Doris — `supportSchemaComment=true`)**: embedded into
the schema comment via `StringIdentifier.addToComment` at create time.
`JdbcCatalogOperations.loadSchema` extracts it from the comment and
reconstructs it into properties via `newPropertiesWithId`, so
`fromProperties()` works correctly.
- **JDBC (MySQL, StarRocks — `supportSchemaComment=false`)**: cannot store
the identifier at all. `loadSchema` returns null/empty properties — the `props
== null || props.isEmpty()` guard on line 901 catches this and conservatively
returns `true` (treat as user-created) to avoid accidental data loss.
So for any catalog that *can* persist a `StringIdentifier`, `loadSchema`
will return it. For those that cannot, we fall back to the safe/conservative
path.
--
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]