Skip to content

Add location properties from TableMetadata into Table entity internalProps#3226

Merged
singhpk234 merged 1 commit intoapache:mainfrom
singhpk234:feature/optimize-cred-endpount
Feb 9, 2026
Merged

Add location properties from TableMetadata into Table entity internalProps#3226
singhpk234 merged 1 commit intoapache:mainfrom
singhpk234:feature/optimize-cred-endpount

Conversation

@singhpk234
Copy link
Contributor

@singhpk234 singhpk234 commented Dec 6, 2025

About the change

Presently since not all the location properties are stored in the entity one has to do complete loadTable table even for existing use cases such as credential endpoint which in present scenario since polaris doesn't store the complete metadata copy inside the persistence is kind of expensive.

With this we will have a way to do cred vending, in future (to remote sign) without going to object store.
Note if we take dependency on this we would have to think of backfill but for step 1 it seems reasonable step, would love to know what other folks think

catalog.loadTableWithAccessDelegation(
tableIdentifier,
"all",
Optional.of(new PolarisResourcePaths(prefix).credentialsPath(tableIdentifier)));
return Response.ok(
ImmutableLoadCredentialsResponse.builder()
.credentials(loadTableResponse.credentials())
.build())
.build();
});

co-author : @adutra

Checklist

  • 🛡️ Don't disclose security issues! (contact [email protected])
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

Copy link
Contributor

@adnanhemani adnanhemani left a comment

Choose a reason for hiding this comment

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

Looks like a reasonable change to me - I don't see any reason why storing these storage locations is a hefty and/or unreasonable addition to the entities. Happy to switch my opinion if anyone has valid concerns regarding the addition of these locations.

Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

This change raises a question:
Does Polaris actively support setting these properties at all?
Polaris performs a lot of effort to ensure that table/view/namespace locations do not overlap and conflict with each other.
Seeing this change, I realize that neither of these two properties is subject to the same location-overlap or location-validity checks.

I think this change deserves a broader dev mailing list discussion about these two properties in general, mentioning that these properties (and their deprecated, but still evaluated older properties) can break both location validity and overlap checks and assumptions.

Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

The diff in this PR LGTM in isolation.

However, making use of the new entity properties can be tricky as Polaris code will have to deal with old entities (on upgrade), which may not have the new properties.

So all in all, having a dev discussion could be useful, indeed.

@adutra
Copy link
Contributor

adutra commented Dec 8, 2025

I might be wrong but it seems the locations are taken into account for overlap in BasePolarisTableOperations#doCommit:

Set<String> dataLocations =
StorageUtil.getLocationsUsedByTable(metadata.location(), metadata.properties());
CatalogUtils.validateLocationsForTableLike(
realmConfig, tableIdentifier, dataLocations, resolvedStorageEntity);
// also validate that the table location doesn't overlap an existing table
dataLocations.forEach(
location ->
validateNoLocationOverlap(

The problem is that later on in that same method, the internal properties map is computed:

Map<String, String> storedProperties = buildTableMetadataPropertiesMap(metadata);

But the map currently doesn't include write.data.path or write.metadata.path:

private static Map<String, String> buildTableMetadataPropertiesMap(TableMetadata metadata) {
Map<String, String> storedProperties = new HashMap<>();
// Location specific properties
storedProperties.put(IcebergTableLikeEntity.LOCATION, metadata.location());
if (metadata.properties().containsKey(TableProperties.WRITE_DATA_LOCATION)) {
storedProperties.put(
IcebergTableLikeEntity.USER_SPECIFIED_WRITE_DATA_LOCATION_KEY,
metadata.properties().get(TableProperties.WRITE_DATA_LOCATION));
}
if (metadata.properties().containsKey(TableProperties.WRITE_METADATA_LOCATION)) {
storedProperties.put(
IcebergTableLikeEntity.USER_SPECIFIED_WRITE_METADATA_LOCATION_KEY,
metadata.properties().get(TableProperties.WRITE_METADATA_LOCATION));
}
storedProperties.put(
IcebergTableLikeEntity.FORMAT_VERSION, String.valueOf(metadata.formatVersion()));
storedProperties.put(IcebergTableLikeEntity.TABLE_UUID, metadata.uuid());
storedProperties.put(
IcebergTableLikeEntity.CURRENT_SCHEMA_ID, String.valueOf(metadata.currentSchemaId()));
if (metadata.currentSnapshot() != null) {
storedProperties.put(
IcebergTableLikeEntity.CURRENT_SNAPSHOT_ID,
String.valueOf(metadata.currentSnapshot().snapshotId()));
}
storedProperties.put(
IcebergTableLikeEntity.LAST_COLUMN_ID, String.valueOf(metadata.lastColumnId()));
storedProperties.put(IcebergTableLikeEntity.NEXT_ROW_ID, String.valueOf(metadata.nextRowId()));
storedProperties.put(
IcebergTableLikeEntity.LAST_SEQUENCE_NUMBER, String.valueOf(metadata.lastSequenceNumber()));
storedProperties.put(
IcebergTableLikeEntity.LAST_UPDATED_MILLIS, String.valueOf(metadata.lastUpdatedMillis()));
if (metadata.sortOrder() != null) {
storedProperties.put(
IcebergTableLikeEntity.DEFAULT_SORT_ORDER_ID,
String.valueOf(metadata.defaultSortOrderId()));
}
if (metadata.spec() != null) {
storedProperties.put(
IcebergTableLikeEntity.DEFAULT_SPEC_ID, String.valueOf(metadata.defaultSpecId()));
storedProperties.put(
IcebergTableLikeEntity.LAST_PARTITION_ID,
String.valueOf(metadata.lastAssignedPartitionId()));
}
return storedProperties;
}

So, the only way to check those locations is to load the table from the object store.

@adutra
Copy link
Contributor

adutra commented Dec 8, 2025

However, making use of the new entity properties can be tricky as Polaris code will have to deal with old entities (on upgrade), which may not have the new properties.

Correct – code would have to be lenient to the properties being absent. For request signing at least, the idea would be to load the table if the properties are absent, then update the entity, so that next time the properties are there.

@singhpk234
Copy link
Contributor Author

singhpk234 commented Dec 9, 2025

So, the only way to check those locations is to load the table from the object store.

precisely, the idea is to have location props in sync with what is present in the object store, to avoid redundant call as presently the loadCreds is doing unneccessary call to load from objectstore.
I see this PR atleast (which is first step to what i wanna achieve) as an extension to Mike's recent PR my POV

when we plan to use it we need to handle backfill, Here is the discuss in Alex on the same

Re: opening mail list thread, sure happy to facilitate the discussion over MT on how to handle back fill, me and Alex had some idea which Alex mentioned, on this context but defintely more inputs are certainly welcomed.

@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Jan 10, 2026
@github-actions github-actions bot closed this Jan 17, 2026
@github-project-automation github-project-automation bot moved this from PRs In Progress to Done in Basic Kanban Board Jan 17, 2026
@singhpk234 singhpk234 reopened this Jan 27, 2026
@github-project-automation github-project-automation bot moved this from Done to PRs In Progress in Basic Kanban Board Jan 27, 2026
@github-actions github-actions bot removed the stale label Jan 27, 2026
Copy link
Contributor

@adutra adutra left a comment

Choose a reason for hiding this comment

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

I think this change can be useful, even if there is no call site today in Polaris that could benefit from the new entity properties.

@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jan 27, 2026
Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

This change LGTM purely from the java code perspective and I do not mind merging it.

TBH, I lost context with any related dev discussions. @singhpk234 : Could you update on the status?

From my POV, I do not require a dev discussion, but it might be worth opening for the sake of awareness of other Polaris developers.

@dimas-b
Copy link
Contributor

dimas-b commented Feb 3, 2026

@singhpk234 singhpk234 closed this Feb 7, 2026
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Feb 7, 2026
@singhpk234 singhpk234 reopened this Feb 7, 2026
@github-project-automation github-project-automation bot moved this from Done to PRs In Progress in Basic Kanban Board Feb 7, 2026
@singhpk234 singhpk234 merged commit de8cadf into apache:main Feb 9, 2026
45 checks passed
@github-project-automation github-project-automation bot moved this from PRs In Progress to Done in Basic Kanban Board Feb 9, 2026
@singhpk234
Copy link
Contributor Author

Thanks for the review everyone, i merged this since there were no objection, i will followup with the credential endpoint optimisation !

snazy added a commit to snazy/polaris that referenced this pull request Feb 11, 2026
* "Stale" job: don't close stale issues (apache#3683)

This PR also fixes the configuration and upgrades the action to the latest version.

* Fix integration-tests after apache#3704 (apache#3711)

Short story: This change fixes the int-tests in `:polaris-runtime-service`.

Long story is this:
In `:polaris-runtime-service` we intentionally declare "just" a `platform(libs.quarkus.bom)` dependency, because of the `:polaris-spark-integration-*` module.
It is however generally recommended by Quarkus to _only_ use `enforcedPlatform(libs.quarkus.bom)` to effectively prevent breaking changes coming from transitive dependencies. Which is exactly what happend after apache#3704.

Why did CI not catch this issue?
The answer is pretty simple: The effective Gradle task inputs, including the `intTestRuntimeClasspath` did not change. So the previously cached test outcomes could be reused, and the int-tests did not run.
Just adding the `runtimeClasspath` as another task-input of the `intTest` may _not_ work as intended.

Why does _removing_ `implementation(platform(libs.opentelemetry.bom))` help?
Simply because that lets the dependencies fall back to to the declared transitive dependencies. We do not have direct dependencies to OTel.

The correct fix here _would_ be to use `implementation(enforcedPlatform(libs.quarkus.bom))`, but that breaks the Spark plugin integration tests.

There is a better alternative: Let the Spark plugin tests leverage polaris-apprunner, which is meant for exactly the use case of effectively decoupling some module from the build requirements of a Quarkus application.

* CI: fix missing Gradle build scans (apache#3709)

Publishing the Gradle build scans requires the `DEVELOCITY_ACCESS_KEY` secret. For workflow-calls, each secret to be propagated to a called workflow must be explicitly defined.

This change propagates the secrets from `ci-main.yml` to the called `ci.yml`.

* Add Polaris Community Meetings for 2026-01-22 and 2026-02-05 (apache#3715)

* Add location propertiesfrom TableMetadata into Table entity internalProperties (apache#3226)

* Compile client modules with Java 17 compatibility (apache#3712)

* Last merged commit ba048c8

---------

Co-authored-by: Alexandre Dutra <[email protected]>
Co-authored-by: JB Onofré <[email protected]>
Co-authored-by: Prashant Singh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants