geyanggang opened a new pull request, #13481:
URL: https://github.com/apache/gravitino/pull/13481

   
   ### What changes were proposed in this pull request?
   
   Adds an opt-in hook that maps a normalized table identifier back to the name 
the underlying source physically stores, applied on the load/alter/drop path:
   
   api TableCatalog: new default NameIdentifier 
resolveTableName(NameIdentifier) that returns the identifier unchanged. A 
catalog whose name normalization is not reversible may override it.
   catalog-jdbc-common: TableOperation gains a default String 
resolveTableName(String databaseName, String tableName) identity hook; 
JdbcCatalogOperations overrides resolveTableName to forward to it.
   core TableNormalizeDispatcher: loadTable / alterTable / dropTable / 
purgeTable / tableExists resolve the identifier through the hook after 
normalization and before dispatching. Because the resolved identifier drives 
both the catalog call and the entity store key, the two cannot diverge. Typed 
exceptions are preserved; only unexpected checked exceptions are wrapped.
   For every catalog that does not override the hook, resolution is a pure 
identity call — no I/O and no behavior change.
   
   ### Why are the changes needed?
   
   A name returned by listTables should be usable as-is by 
loadTable/alterTable/dropTable. When a catalog's normalization is not 
reversible, the normalized-name lookup can miss an object that listTables 
surfaces under a different stored case. This hook gives such catalogs a single, 
server-side place to resolve the stored name, so the round-trip works for the 
SDK, REST, and query engines at once. Resolving in the dispatcher (rather than 
only in the catalog lookup) keeps the entity store key and the catalog call 
consistent.
   
   Fix: #13480 
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. A new default method is added to the TableCatalog API, but its default 
implementation is identity, so existing catalogs and callers are unaffected.
   
   ### How was this patch tested?
   
   - New unit test in TestTableNormalizeDispatcher: when a 
TableCatalog.resolveTableName maps a normalized name to a different stored 
name, the dispatcher hands the resolved identifier to the downstream 
loadTable/dropTable.
   - Existing core catalog suite (296 tests) and catalog-jdbc-common suite pass 
unchanged (default identity hook).
   - spotlessJavaCheck passes for api, core, and catalog-jdbc-common.
   


-- 
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]

Reply via email to