Skip to content

feat(storage): inline polaris.storage.name overrides for namespace/table - #4023

Open
sririshindra wants to merge 13 commits into
apache:mainfrom
sririshindra:phase1-inline-storage-name-overrides
Open

sririshindra wants to merge 13 commits into
apache:mainfrom
sririshindra:phase1-inline-storage-name-overrides

Conversation

@sririshindra

Copy link
Copy Markdown
Contributor

Summary

This PR adds inline storage-name overrides for namespaces and tables using the polaris.storage.name property, so credential vending can select named credentials per entity without introducing new management APIs.

It also refactors hierarchy lookup logic to remove duplication and adds focused test coverage for override behavior and credential vending.

Why this change is needed

Today, catalog-level storage credentials are often too coarse for multi-tenant or team-isolated workloads. This change enables namespace/table-scoped credential selection by storing an inline override and resolving it through the existing hierarchy at runtime.

What changed

  1. Added storage-name validation and normalization utilities.
  2. Added a helper to clone storage configuration while replacing only storageName.
  3. Allowed polaris.storage.name through reserved-property filtering.
  4. Implemented override handling for:
    1. namespace create
    2. namespace setProperties
    3. namespace removeProperties
    4. table metadata/property flows
  5. Refactored hierarchy traversal into shared utility logic to avoid duplicate implementations.
  6. Updated and expanded tests, including an end-to-end credential-vending assertion where leaf override credentials are vended.

Behavioral notes

  1. polaris.storage.name accepts alphanumeric, hyphen, underscore, up to 128 chars.
  2. Blank values normalize to null.
  3. Override resolution uses nearest ancestor storage config and replaces only storageName.
  4. Credential vending uses the resolved inline storage configuration for the target entity.

Testing

  1. Added/updated unit and integration tests for validation, inheritance, persistence, and vending behavior.
  2. Verified targeted runtime-service tests for override + vending paths passed.

Reviewer notes

  1. This PR intentionally keeps storage type inheritance unchanged: override changes storageName, not storage type.
  2. A follow-up PR is planned for cross-type override scenarios (for example AWS catalog overridden by Azure/GCS at leaf scope).

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)

@tokoko

tokoko commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

This should definitely go behind a feature flag since there's currently no way to limit what a user can put in polaris.storage.name property.

I hate to be adding to the feature flag proliferation in polaris, but maybe there should be a way to configure at what level override is allowed to happen. I can see an admin wanting to allow override on namespace level, but not on table level since create table permissions are generally more liberally granted than create namespace ones. A more proper fix is to integrate polaris.storage.name property in the authorization step, but I'm not sure that's practical for internal rbac.

@sririshindra

Copy link
Copy Markdown
Contributor Author

This should definitely go behind a feature flag since there's currently no way to limit what a user can put in polaris.storage.name property.

I hate to be adding to the feature flag proliferation in polaris, but maybe there should be a way to configure at what level override is allowed to happen. I can see an admin wanting to allow override on namespace level, but not on table level since create table permissions are generally more liberally granted than create namespace ones. A more proper fix is to integrate polaris.storage.name property in the authorization step, but I'm not sure that's practical for internal rbac.

Thanks for the review, @tokoko! I'll go ahead and put this behind a feature flag. I intentionally kept authorization out of scope for this phase, but we can definitely address integrating polaris.storage.name into the authz step (and adding level-based configuration) in a follow-up PR.

@sririshindra
sririshindra force-pushed the phase1-inline-storage-name-overrides branch from 8cdf152 to 7e84dce Compare March 19, 2026 13:49

@adnanhemani adnanhemani 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.

Would recommend @dimas-b and @flyrain also take a look at this :)

}

@Test
void serializationRoundTrip() {

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.

what is this test trying to test? That an overriden PolarisStorageConfigurationInfo can be serialized/deserialized? Is there any custom logic that puts this into doubt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right. The intent was to verify that a config produced by withStorageName() survives serialize() → deserialize() since these objects use Jackson's @JsonTypeInfo/@JsonSubTypes for polymorphic deserialization. But in practice, builder().from() produces the same concrete type, so Jackson will always serialize/deserialize it correctly. Looks like awsFieldsPreserved test already covers field preservation. Happy to remove the round-trip test if you think it's redundant.

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.

Yes, I think we should remove the test IMO. I'm all for adding tests but this one looks like we're basically just testing the Jackson library.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, agreed. I removed the serializationRoundTrip test.

* @param value the input value
* @return {@code null} if the input is null, empty, or blank; otherwise the trimmed value
*/
public static @Nullable String normalizeBlankToNull(@Nullable String value) {

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.

Is there a reason this shouldn't be called from within validate?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They serve different purposes: validate() is a pure check, while normalizeBlankToNull() is a transformation. Combining them would make validate() impure — callers wouldn't expect a validation method to also mutate/transform the input. That said, I could rename normalizeBlankToNull to something clearer like toNullIfBlank or inline it at the call sites if you'd prefer. Open to suggestions.

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.

I understand your point but given that this function is always only called right before validate, maybe there's a way to combine both the functions to reduce the total amount of functions and reduce caller code as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I combined normalization and validation into a single helper, normalizeAndValidate, and updated all call sites to use it.

@dimas-b dimas-b 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.

Hi @sririshindra , thanks for the PR, but I'm a bit confused by the new code... specific comments below. Sorry, if I missed something obvious 😅

Comment on lines +557 to +561
new NamespaceEntity(
new PolarisEntity.Builder(nsBuilder.build())
.addInternalProperty(
PolarisEntityConstants.getStorageConfigInfoPropertyName(),
namespaceStorageConfig.serialize())

@dimas-b dimas-b Mar 24, 2026 •

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.

Why embed a copy of the config into the entity here?

Based on previous dev discussion (link below) my impression is that we'd want to keep (named) storage configs at the catalog level for ease of management.

https://lists.apache.org/thread/nwcc8krhvm35olgc22676mm12cjkpgn5

I'd expect entities to only reference storage config by name, and the config resolution to happen when requested 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed — this is fixed in the latest revision. Entities now store only a lightweight storage_name_override string reference, not a full config copy. The full config resolution happens on-demand at access time.

StorageNameValidator.validate(storageName);
}

PolarisStorageConfigurationInfo baseConfig = deserializeStorageConfigFromEntityPath(parentPath);

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.

This config is loaded regardless on the "name", so I'm not sure what the purpose of adding POLARIS_STORAGE_NAME_PROPERTY to the entity properties might be 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the updated implementation, polaris.storage.name is the user-facing API property that gets translated into an internal storage_name_override reference. At resolution time, StorageConfigResolver finds the nearest override in the hierarchy and applies it to the catalog's base config via withStorageName(). The purpose is to allow different namespaces/tables to use different named storage configurations while the actual configs remain managed centrally at the catalog level. The property is no longer redundant — it's the mechanism by which users select which storage configuration to use.

long currentParentId = entity.getParentId();
while (currentParentId != PolarisEntityConstants.getNullId() && currentParentId != catalogId) {
EntityResult parentResult =
loadEntity(callCtx, catalogId, currentParentId, PolarisEntityType.NAMESPACE);

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.

I'm not sure about this loop, TBH... So far the usual workflow for requests was to use the Resolver to find all relevant entities based on API parameters upfront, then proceed with request execution.

So, normally, all the parents up to the catalog should already be loaded by the time StorageAccessConfig is required. Could we reuse existing data from the resolution manifest.

Note: this may overlap with #3699 CC: @tokoko

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.

I think this PR would no longer have to solve this dual resolution issue after #3699 since everything happens in StorageAccessConfigProvider there. honestly this feels like we're putting bandaids on bandaids 😄 ideally we should have a single place (StorageAccessConfigProvider most likely) that would resolve storageInfo, resolve storage name, get additional properties from config per storage name and return effective storage configuration. I don't think that's possible to do now w/o first getting rid of all these unnecessary layers.

@dimas-b dimas-b Mar 30, 2026 •

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.

From my POV, I'd prefer to merge #3699 first, then rebase this PR.

@sririshindra : WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good @dimas-b . I will wait for #3699 to be merged and rebase this PR. I will review it as well.

@flyingImer flyingImer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, the newer override-resolution tests are useful.

I still think there is one high-priority correctness issue worth fixing before this moves forward.

IIUC doCommit() still resolves commit-time storage access from the pre-override hierarchy, and only later materializes polaris.storage.name into the table state. If so, the post-commit state may look correct while the first metadata write already used the previous credentials.

That feels like the key invariant here: the effective storage for the write path should be resolved before the commit-time metadata write happens, not only after the override has been persisted.

I’d be much more comfortable if we either move that resolution earlier in the flow, or add explicit coverage proving the first create/update write already uses the overridden credentials.

@flyrain WDYT?

@adnanhemani adnanhemani 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.

@flyingImer's pointing out of the "cold start" issue is a known issue with approaching this feature unfortunately (we discussed it at the last Polaris Community Sprint).

I think we are ok with saying that the credential can only be used once the table is pre-created. But @sririshindra - can you explicitly list (within this PR) the set of operations in which users can do this to avail this feature?

}

@Test
void serializationRoundTrip() {

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.

Yes, I think we should remove the test IMO. I'm all for adding tests but this one looks like we're basically just testing the Jackson library.

* @param value the input value
* @return {@code null} if the input is null, empty, or blank; otherwise the trimmed value
*/
public static @Nullable String normalizeBlankToNull(@Nullable String value) {

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.

I understand your point but given that this function is always only called right before validate, maybe there's a way to combine both the functions to reduce the total amount of functions and reduce caller code as well.

@sririshindra
sririshindra force-pushed the phase1-inline-storage-name-overrides branch from 095e0ac to c015b8c Compare April 6, 2026 23:21
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

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 May 7, 2026
@dimas-b dimas-b removed the stale label May 7, 2026
@sririshindra
sririshindra force-pushed the phase1-inline-storage-name-overrides branch from c015b8c to eae0266 Compare June 5, 2026 18:06
Trim, blank-to-null normalization, length cap (128), and a
[a-zA-Z0-9_-]+ character allowlist for the user-facing
polaris.storage.name property. Pure utility; no callers wired yet.
Static helper on PolarisStorageConfigurationInfo that returns a copy of
the given config with only its storageName replaced. Dispatches across
all four subtypes (Aws/Azure/Gcp/File) via their Immutables builders so
the override flows transparently into the per-backend cache key
(AwsStorageCredentialCacheKey etc. include storageConfig in equality).
Internal-properties key for the persisted name reference set by entity
writes that include polaris.storage.name. Resolution happens at access
time leaf-to-root, so namespaces and tables hold only this string, not
a copy of the full storage config.
Gates write-path acceptance of polaris.storage.name on namespaces and
tables. Default false. The flag does not gate read-path resolution: any
override already persisted is honored regardless, so disabling the flag
later does not silently change vended credentials. End-to-end named-
credential routing still requires RESOLVE_CREDENTIALS_BY_STORAGE_NAME.
The polaris. prefix is reserved, so polaris.storage.name would otherwise
be filtered out of namespace and table property updates before
IcebergCatalog gets a chance to validate, gate, and persist it as the
storage_name_override internal property.
Pure data resolver that walks an entity hierarchy leaf-to-root, captures
the nearest storage_name_override, finds the catalog's base
storage_configuration_info, and applies withStorageName when an override
is present. Returns empty if no base config exists, regardless of any
overrides higher in the chain. Used by the credential-vending and FileIO
paths to share one resolution algorithm.
Replace the findStorageInfoFromHierarchy + extractStorageConfiguration
chain in getStorageIntegration() with StorageConfigOverrideResolver,
which performs the same base-config lookup and additionally applies any
nearest storage_name_override via withStorageName before the integration
is constructed. The bound storageConfig on the resulting
CachingStorageIntegration carries the effective storageName, so the
existing AWS factory's RESOLVE_CREDENTIALS_BY_STORAGE_NAME-gated lookup
and the per-backend cache keys (which include storageConfig in equality)
both pick it up automatically.
…okup

FileIOUtil.findStorageInfoFromHierarchy now returns a synthetic copy of
the catalog entity whose storage_configuration_info reflects any nearest
storage_name_override on the path, so callers (e.g., dropTable purge
tasks) that read internal_properties off the returned entity see the
effective config — matching the override semantics that flow through
StorageAccessConfigProvider/PolarisStorageIntegrationProvider for live
credential vending.
…ergCatalog

Validate, gate via ALLOW_STORAGE_NAME_OVERRIDE, and translate the user-
facing polaris.storage.name property into the internal storage_name_override
key on entity internalProperties. Wired at four sites:

  * createNamespace
  * setProperties (namespace)
  * removeProperties (namespace)
  * doCommit + overwriteRegisteredTable (table commit / cold start)

The flag is enforced only when the requested value would change the
persisted override; idempotent re-sets pass through with the flag off so
operators can safely disable the flag after entities already have
overrides set. A blank or whitespace value clears the override.

For cold-start createTable, the FileIO that writes the FIRST metadata file
is built from the parent namespace/catalog (the table entity does not
exist yet), so a table-level override only takes effect from the second
commit forward. A namespace-level override on the parent works for the
cold-start write because resolvedStorageEntity is the namespace.
Prove that two override paths with different polaris.storage.name values
through PolarisStorageIntegrationProvider produce non-equal bound
storage configs, which (via AwsStorageCredentialCacheKey's storageConfig
value field) guarantees distinct cache entries.
…Namespace

The previous createNamespaceInternal hunk built a fresh internalProperties
map with only the storage-name override and passed it to setInternalProperties,
which wholesale-replaced the map and wiped the parent-namespace key that
NamespaceEntity.Builder(Namespace) sets in its constructor. This broke
loadNamespaceMetadata for any namespace at depth >= 2 (35 test failures
across IcebergCatalogHandlerAuthzTest, IcebergCatalogHandlerNoSqlAuthzTest,
RestCatalogFileIntegrationTest).

Use addInternalProperty per entry instead, so the override key is added
incrementally and the parent-namespace internal key is preserved. Tables
were unaffected because IcebergTableLikeEntity.Builder.setInternalProperties
defensively carries forward the parent-namespace, metadata-location, and
last-admitted-notification-timestamp keys; NamespaceEntity.Builder has no
such guard.
@sririshindra
sririshindra force-pushed the phase1-inline-storage-name-overrides branch from eae0266 to e908263 Compare June 5, 2026 18:08

@dimas-b dimas-b 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.

Thanks for resuming this PR, @sririshindra !

PolarisConfiguration.<Boolean>builder()
.key("ALLOW_STORAGE_NAME_OVERRIDE")
.description(
"If set to true, allows namespaces and tables to set the polaris.storage.name "

@dimas-b dimas-b Jun 8, 2026 •

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.

What is the value of this flag? If a user points to a non-existent storage name, the adverse effect is localized to that user's change.

Adding storage names is a Catalog Management action and should probably be covered by AuthZ checks.

I'd think setting/changing polaris.storage.name probably needs an new AuthZ operation rather than a global feature flag.

WDYT?

if (!userProperties.containsKey(POLARIS_STORAGE_NAME_PROPERTY)) {
return;
}
String rawValue = userProperties.remove(POLARIS_STORAGE_NAME_PROPERTY);

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.

Modifying parameters is not intuitive... Can we avoid this?

try {
requested = StorageNameValidator.normalizeAndValidate(rawValue);
} catch (IllegalArgumentException e) {
throw new BadRequestException(

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.

IllegalArgumentException should automatically result in a 400 response at the REST API layer... Why do we need BadRequestException here?

void processStorageNameOverrideOnWrite(
Map<String, String> userProperties,
Map<String, String> internalProperties,
@Nullable String priorOverride) {

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.

Is priorOverride actually an "override"? What does it override? 🤔

if (requested == null) {
internalProperties.remove(storageOverrideKey);
} else {
internalProperties.put(storageOverrideKey, requested);

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.

This logic effectively make the table metadata control the storage name value on the server side. I'm not sure it is ideal.

Ultimately, the catalog owns storage configuration. Why should table metadata have precedence over catalog-side settings?

I'd imagine Polaris CLI being the tool for setting storage name 🤔

Perhaps we need to dive deeper into this on the dev ML 🤔

@NonNull List<? extends PolarisEntity> entityPath) {
String override = null;
for (int i = entityPath.size() - 1; i >= 0; i--) {
Map<String, String> internalProps = entityPath.get(i).getInternalPropertiesAsMap();

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.

nit: we assume indexed access is efficient here... WDYT about List.reversed()?

PolarisStorageConfigurationInfo base =
PolarisStorageConfigurationInfo.deserialize(serializedBase);
if (override != null) {
return Optional.of(PolarisStorageConfigurationInfo.withStorageName(base, override));

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.

I'm not sure I understand the purpose of reusing the same config with a different name in different sub-trees 🤔 How do you envision this to be used?

My impression from the ML discussion is that the idea was to define multiple distinct Storage Configurations at the Catalog level and let entities choose one of them by name 🤔

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.

I think you might be misreading this (or maybe I am). storage names are set effectively from server configuration similar to how they are handled after #3409. changing storage name of a config from table/namespace metadata simply changes the pointer to the predefined storages that are part of server config.

P.S. I also agree the entire approach isn't exactly ideal, but my understanding of the devlist consensus was also how it's implemented in the PR.

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.

I'd expect different storage names to be associated with different PolarisStorageConfigurationInfo objects (semantically). The storage name would act as a user-level identifier for a specific PolarisStorageConfigurationInfo piece of data.

Simply updating the name in a PolarisStorageConfigurationInfo in runtime looks odd to me 🤔

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.

I remember that introducing a separate crud resource for storages was rejected, but iiuc what you're talking about is allowing multiple PolarisStorageConfigurationInfo to be defined on catalog level and then tables/namespaces would be able to choose between them, is that right? I suppose that's a reasonably clean approach.

One thing to note... storagaName field from #3409 is more of a pointer atm rather than a unique name designation for a specific PolarisStorageConfigurationInfo. I suppose it can be both, but it might be a little awkward: for example what if two catalogs define a storage config with same names, but want to resolve different credentials from the server config. I guess it shouldn't be a problem as long as it's well-documented.

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.

I guess the whole idea for multiple storage configs/names is applicable only to self-managed deployments. So the admin should be able to sort out name overlaps there.

I'm not sure how this idea can fit in SaaS deployments, TBH 🤔

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.

Exactly, I don't think it's a good idea to let users define the storage profile name on a namespace or table in a managed environment.

I remember that introducing a separate crud resource for storages was rejected

You mean for storage profile names or for PolarisStorageConfigurationInfo? I think we need to settle on this topic; I am leaning more towards the idea of leveraging the management API. That's the direction suggested in this design doc by @sririshindra.

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.

Heads up: this PR is on the agenda for the Community Sync call today 😉

import org.apache.polaris.core.storage.gcp.GcpStorageConfigurationInfo;
import org.junit.jupiter.api.Test;

class WithStorageNameTest {

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.

This test class name is a bit confusing IMHO 🤔 Why not add the new test cases to PolarisStorageConfigurationInfoTest?

.containsKey(PolarisEntityConstants.getStorageConfigInfoPropertyName()))
.findFirst();
return storageInfoEntity;
if (baseEntity.isEmpty()) {

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.

Why repeat the search already performed by StorageConfigOverrideResolver.resolveEffectiveConfig()? Can we be sure the outcome is / will be the same?

Why not have StorageConfigOverrideResolver return a tuple of all the data we need here?

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.

+1, there is some overlap between this class and StorageConfigOverrideResolver.

Comment on lines +46 to +47
* @return an {@link Optional} containing the (possibly synthetic) entity with the effective
* storage config, or empty if no entity in the chain has a base storage config

@dimas-b dimas-b Jun 8, 2026 •

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.

Callers of this method only need to know the presence of this entity and if present, its properties... Why bother with synthetic entities? I'd propose to refactor this code to return an Optional<some properties class>... WDYT?

@adutra adutra 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.

Thanks @sririshindra for this PR.

I must say, I have some reservations regarding the mechanism this PR introduces for passing properties back and forth between user and internal spaces. I am concerned that this approach might set a problematic precedent for future implementations.

Was this topic already discussed? My apologies if it was; I am currently catching up on a significant backlog of PR reviews. 😓

While the PR description suggests this method is better than creating new management API endpoints, I am questioning if dedicated endpoints wouldn't actually be a superior solution for configuring items like storage profile names.

As I mentioned in a separate comment, allowing users to specify which storage profile to use leads to a "split-brain" scenario where Polaris admins define the profiles, but the profile selection responsibility falls to the users.

Furthermore, although this PR addresses storage profile selection, I am unclear on how we intend to handle the application of a full PolarisStorageConfigurationInfo at the table or namespace level. Relying on additional user properties for such use cases does not seem like a scalable strategy.

Apologies if I'm off track here.

*
* @throws IllegalArgumentException if {@code base} is not one of the four supported subtypes
*/
public static PolarisStorageConfigurationInfo withStorageName(

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.

Conceptually, this should be an abstract instance method:

public abstract PolarisStorageConfigurationInfo withStorageName(@Nullable String storageName);

Each subclass would implement accordingly.

Then callers would do:

PolarisStorageConfigurationInfo base = ...
return base.withStorageName("some-storage");

* Trim, validate, and normalize a candidate storage name.
*
* @param value raw user input
* @return the trimmed name if valid, or {@code null} if the input is blank

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.

What do we mean by "normalize"? I think it could be counter-intuitive if Polaris changed a user-supplied identifier without notifying the user about the change, even if it's just trimming spaces.

* storage profile to use for credential vending. Validated and translated into the internal
* property {@link PolarisEntityConstants#getStorageNameOverridePropertyName()}.
*/
static final String POLARIS_STORAGE_NAME_PROPERTY = "polaris.storage.name";

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.

Just thinking out loud: if I get this correctly, we would be tying a namespace or table property to a storage profile that must be declared in the server configuration. IOW, the namespace or table in question becomes unusable if the catalog configuration changes and does not contain the profile anymore. Probably OK, but this requires some coordination between two personas: the user that created the table, and the admin that manages the server configuration.

.containsKey(PolarisEntityConstants.getStorageConfigInfoPropertyName()))
.findFirst();
return storageInfoEntity;
if (baseEntity.isEmpty()) {

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.

+1, there is some overlap between this class and StorageConfigOverrideResolver.

@flyingImer flyingImer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @sririshindra, catching up on this one: IIUC the direction after the dev-list discussion was to keep #4023 on hold until the catalog-level multiple-storage-config work lands, then rebase this on top of that.

Is that still the plan for this PR, or are you planning to continue moving the current approach forward independently?

If the former, I'm happy to hold off on further review here and take another pass once it's rebased.

@sririshindra

Copy link
Copy Markdown
Contributor Author

Hi @sririshindra, catching up on this one: IIUC the direction after the dev-list discussion was to keep #4023 on hold until the catalog-level multiple-storage-config work lands, then rebase this on top of that.

Is that still the plan for this PR, or are you planning to continue moving the current approach forward independently?

If the former, I'm happy to hold off on further review here and take another pass once it's rebased.

HI @flyingImer , Sorry I didn't see your message earlier.
I wrote https://docs.google.com/document/d/1TSaZ0G2oEoWq6lDMSPIIfHLwXxW9VZmhUNE3s_jfxgI/edit?usp=sharing . Could you please review that instead

This branch has not been deployed

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