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

   ### What changes were proposed in this pull request?
   
   This change enforces the stored table format at the Lance namespace 
boundary. Lance REST direct table operations validate that the existing entity 
is a Lance table, treat known non-Lance entities as absent for `tableExists`, 
and reject non-Lance metadata before describe, drop, deregister, or alter 
behavior is delegated to a format-specific operation. The Generic Catalog Lance 
delegator applies the same check to `EXIST_OK`, create `OVERWRITE`, register 
`OVERWRITE`, `purgeTable`, and `dropTable` paths before metadata or dataset 
deletion. The catalog-side guard uses `IllegalArgumentException`, and the REST 
adapter uses Lance `InvalidInputException` so the intended HTTP `400` response 
is preserved. Generic Catalog `ListTables` behavior is unchanged.
   
   ### Why are the changes needed?
   
   Lance requests select the Lance delegator from request properties, while 
existing table operations select a delegator from the stored entity format. 
With a mixed-format Generic Catalog, this mismatch allowed a Lance request to 
handle an existing Delta entity as if it were a Lance table. In particular, 
create `OVERWRITE` could purge non-Lance metadata and pass its stored location 
to Lance dataset deletion; register `OVERWRITE` could remove the existing 
metadata. Lance REST describe, existence, deregister, and alter calls also 
returned misleading results or format-dependent errors. These paths must fail 
closed at the Lance boundary.
   
   Fix: #13186
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. For a known non-Lance entity, Lance REST direct table operations now 
return HTTP `400 INVALID_INPUT`, and `tableExists` presents the entity as 
absent with the normal table-not-found response. Lance create `EXIST_OK`, 
create `OVERWRITE`, and register `OVERWRITE` now return HTTP `400 
INVALID_INPUT` without changing the existing entity. Plain `CREATE` retains the 
normal existing-name conflict response. Valid Lance operations and the Generic 
Catalog's format-agnostic `ListTables` behavior remain unchanged.
   
   ### How was this patch tested?
   
   - Added unit coverage for the shared format predicate, REST adapter guards, 
Generic Catalog `EXIST_OK` and overwrite guards, metadata deletion prevention, 
and `IllegalArgumentException` propagation.
   - Added a mixed-format integration test that creates external Delta metadata 
with a sentinel file, exercises Lance REST and direct `TableCatalog` paths, and 
verifies metadata, location, and physical data preservation.
   - Added authorization coverage proving that an unauthorized caller receives 
`403` before non-Lance format validation.
   - Ran `./gradlew :lance:lance-rest-server:test 
:catalogs:catalog-lakehouse-generic:test -PtestMode=embedded 
-PlanceSparkBundleVersions=0.4.0 -PskipWeb=true`.
   - Ran `./gradlew :lance:lance-rest-server:test -PtestMode=embedded 
-PlanceSparkBundleVersions=0.4.0 -PskipWeb=true --tests 
'*LanceFormatBoundaryIT'`.
   - The final embedded regression completed 161 Lance REST server tests and 74 
Generic Catalog tests with no failures or errors.
   - Deploy-mode validation was not run because the changed paths are covered 
by the embedded auxiliary-server and direct `TableCatalog` paths, and no 
deploy-only implementation was introduced.
   


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