Skip to content

[#12996] fix(catalog-glue): Derive table location from the Glue database LocationUri - #12997

Open
diqiu50 wants to merge 2 commits into
apache:mainfrom
diqiu50:fix/glue-table-location-ignores-locationuri
Open

[#12996] fix(catalog-glue): Derive table location from the Glue database LocationUri#12997
diqiu50 wants to merge 2 commits into
apache:mainfrom
diqiu50:fix/glue-table-location-ignores-locationuri

Conversation

@diqiu50

@diqiu50 diqiu50 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

GlueCatalogOperations.resolveTableLocation now uses the LocationUri declared by the Glue database as the base for a table that is created without an explicit location property, and falls back to the catalog warehouse property only when the database declares no location.

Why are the changes needed?

The table location was always derived as warehouse/database/table, so tables Gravitino created sat under a different prefix from tables other tools created in the same Glue database, and a catalog whose warehouse was set to the database's own location produced a doubled database segment in the path.

Fix: #12996

Does this PR introduce any user-facing change?

Yes, a table created in a Glue database that declares a LocationUri is now placed under that URI instead of under the catalog warehouse; no property is added or removed, and existing data is not moved.

How was this patch tested?

Added unit tests in TestGlueCatalogTableOperations covering the database location, a trailing slash on it, the warehouse fallback, an explicit location property and a failed database lookup, and ran ./gradlew :catalogs:catalog-glue:test -PskipITs together with ./gradlew spotlessApply.

… database LocationUri

Use the LocationUri declared by the Glue database as the base for a table
created without an explicit location property, falling back to the catalog
warehouse property only when the database declares no location.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019pkAzwoZNs6BaxE9JHfK8q
Copilot AI lite review requested due to automatic review settings September 8, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

This PR updates Glue table location derivation to prefer the Glue database LocationUri when a table is created without an explicit location, falling back to the catalog warehouse only when the database has no location.

Changes:

  • Update resolveTableLocation to derive database-location/table from Glue DB LocationUri and trim trailing slashes
  • Add/extend unit tests covering DB location precedence, warehouse fallback, explicit location override, and schema-not-found behavior
  • Update Glue catalog documentation and property descriptions to reflect the new precedence rules

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/aws-glue-catalog.md Updates user-facing docs for warehouse and location derivation behavior
catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueCatalogTableOperations.java Adds unit tests for new location resolution logic and ensures alterTable doesn’t trigger DB lookup when not needed
catalogs/catalog-glue/src/test/java/org/apache/gravitino/catalog/glue/TestGlueCatalogOperationsForIceberg.java Updates Iceberg test to stub DB lookup to reflect new resolution path
catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueCatalogPropertiesMetadata.java Updates warehouse property description to match new semantics
catalogs/catalog-glue/src/main/java/org/apache/gravitino/catalog/glue/GlueCatalogOperations.java Implements DB LocationUri precedence and shared trailing-slash trimming helper
catalogs/catalog-common/src/main/java/org/apache/gravitino/catalog/glue/GlueConstants.java Updates Javadoc for warehouse property semantics

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/aws-glue-catalog.md Outdated
Comment thread docs/aws-glue-catalog.md Outdated
@diqiu50 diqiu50 self-assigned this Sep 8, 2026
@diqiu50 diqiu50 added 1.3.0 Release v1.3.0 branch-1.3 Automatically cherry-pick commit to branch-1.3 and removed 1.3.0 Release v1.3.0 labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 69.67% +0.03% 🟢
Files changed 75.0% 🟢

Module Coverage
aliyun 19.74% 🔴
api 51.57% 🟢
authorization-common 85.96% 🟢
authorization-ranger 4.38% 🔴
aws 53.54% 🟢
azure 32.1% 🔴
catalog-common 25.76% 🔴
catalog-fileset 82.17% 🟢
catalog-glue 69.98% +2.86% 🟢
catalog-hive 82.96% 🟢
catalog-jdbc-common 45.09% 🟢
catalog-jdbc-doris 82.69% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-postgresql 83.83% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 76.99% 🟢
catalog-lakehouse-generic 60.88% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.9% 🟢
catalog-lakehouse-paimon 84.29% 🟢
catalog-model 77.99% 🟢
cli 44.51% 🟢
client-java 77.5% 🟢
common 57.75% 🟢
core 84.28% 🟢
filesystem-hadoop3 76.48% 🟢
flink 0.0% 🔴
flink-common 53.22% 🟢
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 17.84% 🔴
hive-metastore-common 53.5% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 66.89% 🟢
iceberg-rest-server 76.59% 🟢
idp-basic 86.75% 🟢
integration-test-common 0.0% 🔴
jobs 62.92% 🟢
lance-common 32.52% 🔴
lance-rest-server 68.12% 🟢
lineage 59.39% 🟢
optimizer 83.24% 🟢
optimizer-api 21.95% 🔴
server 89.62% 🟢
server-common 81.35% 🟢
spark 56.27% 🟢
tencent 81.78% 🟢
trino-connector 58.36% 🟢
Files
Module File Coverage
catalog-common GlueConstants.java 0.0% 🔴
catalog-glue GlueCatalogPropertiesMetadata.java 100.0% 🟢
GlueCatalogOperations.java 73.9% 🟢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch-1.3 Automatically cherry-pick commit to branch-1.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] Glue catalog ignores the database LocationUri when deriving a table location

2 participants