jarredhj0214 commented on code in PR #15142:
URL: https://github.com/apache/gravitino/pull/15142#discussion_r4639206724
##########
core/src/main/java/org/apache/gravitino/catalog/TableOperationDispatcher.java:
##########
@@ -569,6 +584,43 @@ private Optional<TableEntity>
getTableEntityBeforeRename(NameIdentifier ident) {
}
}
+ @Nullable
+ private Boolean probeImportedTable(NameIdentifier ident) {
+ return doWithCatalog(
+ getCatalogIdentifier(ident),
+ catalog -> {
+ if (isManagedEntity(catalog, Capability.Scope.TABLE)) {
+ return null;
+ }
+ return catalog.doWithTableOps(
+ ops -> {
+ if (!(ops instanceof SupportsTableIdentifier)) {
+ return null;
+ }
+ TableEntity stored = getEntity(ident, TABLE,
TableEntity.class);
+ if (stored == null) {
+ return null;
+ }
+ String sourceId = ((SupportsTableIdentifier)
ops).loadTableIdentifier(ident);
+ if (sourceId == null) {
+ // Sources without a persistent identifier use the same
name-based identity as
+ // loadTable.
+ return true;
+ }
+ try {
+ return StringIdentifier.fromString(sourceId).id() ==
stored.id()
Review Comment:
Thanks for reproducing this. I prepared a local fix that keeps the
table-only probe unchanged and makes `checkMetadataObject(COLUMN)` load the
parent table to refresh stored columns. Batch validation now tracks table
checks and column refreshes separately, so an earlier table probe cannot
suppress the refresh; a completed refresh satisfies later table checks.
Regression tests cover external column additions and deletions for a single
column, `[table, column]`, and `[column, table]`, including repeated columns.
They verify stored column IDs/removal and one full parent load per batch. All
184 tests across the five focused classes passed, with no skips; Spotless and
`git diff --check` passed. Docker/live-Hive tests were not run.
The changes are still local and have not been pushed, so the current PR head
remains unfixed. The SPI placement and fallback-overhead comments are not
addressed by this local fix.
##########
core/src/main/java/org/apache/gravitino/catalog/TableOperationDispatcher.java:
##########
@@ -150,7 +151,21 @@ public boolean tableExists(NameIdentifier ident) {
getCatalogIdentifier(ident),
wrapper -> wrapper.doWithCatalog(catalog -> catalog.ops()
instanceof TableCatalog),
RuntimeException.class);
- return supportsTables && TableDispatcher.super.tableExists(ident);
+ if (!supportsTables) {
+ return false;
+ }
+ try {
+ Boolean exists =
+ TreeLockUtils.doWithTreeLock(ident, LockType.READ, () ->
probeImportedTable(ident));
+ if (exists != null) {
+ return exists;
Review Comment:
Thanks, I agree this blocks merging. A local fix now loads the parent for
COLUMN validation and separates batch table-check deduplication from
column-refresh deduplication. TABLE validation retains the fast probe.
Tests cover external column additions/deletions, single-column validation,
both mixed-batch orders, and repeated columns, verifying that each batch
refreshes a parent only once. All 184 focused tests passed, with no skips.
These changes have not been pushed yet, so the issue remains present at the
current PR head. The SPI-placement and fallback-overhead suggestions remain
outside this fix.
--
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]