You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "iprithv (via GitHub)" <gi...@apache.org> on 2026/07/07 08:41:07 UTC

[PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

iprithv opened a new pull request, #4991:
URL: https://github.com/apache/polaris/pull/4991

   PyIceberg and other non-Spark clients fail to authenticate with Azure ADLS vended credentials because Polaris only emits suffixed keys (adls.sas-token.<host>). 
   PyIceberg's adlfs/fsspec integration expects bare keys: adls.sas-token, adls.account-name, and adls.account-host to construct the AzureBlobFileSystem.


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3538804695


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,26 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token, adls.account-name, adls.account-host
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;
+    String accountHost;
+    if (host.endsWith(AzureLocation.ADLS_ENDPOINT) || host.endsWith(AzureLocation.BLOB_ENDPOINT)) {
+      int dotIndex = host.indexOf('.');
+      if (dotIndex > 0) {
+        accountName = host.substring(0, dotIndex);
+        accountHost = host;
+      } else {
+        accountName = host;
+        accountHost = host;
+      }
+    } else {
+      accountName = host;
+      accountHost = host;
+    }
+    config.putCredential(StorageAccessProperty.AZURE_ACCOUNT_NAME.getPropertyName(), accountName);
+    config.putCredential(StorageAccessProperty.AZURE_ACCOUNT_HOST.getPropertyName(), accountHost);

Review Comment:
   makes sense, updated. thanks!



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3553633844


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -33,45 +33,63 @@ public class AzureCredentialsStorageIntegrationTest {
   @Test
   public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
+    AzureLocation adlsLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.ADLS_ENDPOINT + "/path");
+    AzureLocation blobLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.BLOB_ENDPOINT + "/path");

Review Comment:
   wow, actually good point...abfss + blob.core.windows.net was a bit mixed. you've got an eagle eye :)
   
   Polaris AzureLocation only accepts Hadoop-style schemes (abfs[s] / wasb[s] with container@account.host/path), not the REST https://account.blob.core.windows.net/container/path form. updated the blob fixture to wasbs://container@myaccount.blob.core.windows.net/path, which is the conventional Blob URI form we support...thanks!



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3551476245


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -261,8 +261,12 @@ static StorageAccessConfig toAccessConfig(
       String storageDnsName,
       Instant expiresAt,
       Optional<String> refreshCredentialsEndpoint) {
+    // For tests we build a fake location from the provided host part so we can pass the whole
+    // AzureLocation to handle (addresses review suggestion).
+    String fakeUri = "abfss://container@" + storageDnsName + "/path";

Review Comment:
   the fake URI was only there so tests could drive toAccessConfig with a DNS name string. updated to pass the real AzureLocation from compute() through, and tests now construct real locations. that drops the reconstruction entirely...



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3541045751


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -273,7 +276,11 @@ static StorageAccessConfig toAccessConfig(
   }
 
   private static void handleAzureCredential(
-      StorageAccessConfig.Builder config, String sasToken, String host, Instant expiresAt) {
+      StorageAccessConfig.Builder config,
+      String sasToken,
+      String host,
+      String accountName,

Review Comment:
   WDYT about passing the whole `AzureLocation` here?



##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -35,11 +35,17 @@ public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
 
     StorageAccessConfig noSuffixResult =
-        toAccessConfig("sasToken", "some_account", expiresAt, Optional.empty());
-    Assertions.assertThat(noSuffixResult.credentials()).hasSize(3);
+        toAccessConfig("sasToken", "some_account", "some_account", expiresAt, Optional.empty());
+    Assertions.assertThat(noSuffixResult.credentials()).hasSize(5);
     Assertions.assertThat(noSuffixResult.credentials()).containsKey("adls.sas-token.some_account");
     Assertions.assertThat(noSuffixResult.credentials())
         .containsKey("adls.sas-token-expires-at-ms.some_account");
+    Assertions.assertThat(noSuffixResult.credentials())
+        .containsKey(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName());
+    Assertions.assertThat(noSuffixResult.credentials())
+        .containsEntry(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), "sasToken");
+    Assertions.assertThat(noSuffixResult.credentials())
+        .containsEntry(StorageAccessProperty.AZURE_ACCOUNT_NAME.getPropertyName(), "some_account");

Review Comment:
   This test is not conclusive. We cannot know whether the value comes from the second or the third parameter on line 38 🤔 



##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########


Review Comment:
   `withSuffixStripped` is the same as `accountName` is it not?



##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########


Review Comment:
   `AzureLocation` should probably have methods like `.isBlob()` and `.isAdls()`.. WDYT?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3542069478


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -35,11 +35,17 @@ public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
 
     StorageAccessConfig noSuffixResult =
-        toAccessConfig("sasToken", "some_account", expiresAt, Optional.empty());
-    Assertions.assertThat(noSuffixResult.credentials()).hasSize(3);
+        toAccessConfig("sasToken", "some_account", "some_account", expiresAt, Optional.empty());
+    Assertions.assertThat(noSuffixResult.credentials()).hasSize(5);
     Assertions.assertThat(noSuffixResult.credentials()).containsKey("adls.sas-token.some_account");
     Assertions.assertThat(noSuffixResult.credentials())
         .containsKey("adls.sas-token-expires-at-ms.some_account");
+    Assertions.assertThat(noSuffixResult.credentials())
+        .containsKey(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName());
+    Assertions.assertThat(noSuffixResult.credentials())
+        .containsEntry(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), "sasToken");
+    Assertions.assertThat(noSuffixResult.credentials())
+        .containsEntry(StorageAccessProperty.AZURE_ACCOUNT_NAME.getPropertyName(), "some_account");

Review Comment:
   ah right, updated `toAccessConfig` so it no longer takes a separate `accountName` parameter (it now derives everything from the `AzureLocation`). test calls were also changed to use clearly distinct values for the host vs. account name, and I added a comment explaining the intent.
   bare `AZURE_ACCOUNT_NAME` and stripped key values now come from the account name path.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on PR #4991:
URL: https://github.com/apache/polaris/pull/4991#issuecomment-4910638048

   > I wonder, is this documented somewhere?
   
   @dimas-b thanks for checking. yes,
   
   bare key names are client-driven (adlfs + fsspec used by PyIceberg when X-Iceberg-Access-Delegation=vended-credentials + py-io-impl=...FsspecFileIO).
   
   exact workaround + failure in the description in https://github.com/apache/polaris/issues/418 and https://github.com/apache/iceberg-python/issues/1146 (the custom CustomFsspecFileIO + _adls helper that was doing the remapping).
   
   not part of the Iceberg REST spec itself, but required for those clients to build AzureBlobFileSystem.


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3554744477


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -33,45 +33,63 @@ public class AzureCredentialsStorageIntegrationTest {
   @Test
   public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
+    AzureLocation adlsLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.ADLS_ENDPOINT + "/path");
+    AzureLocation blobLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.BLOB_ENDPOINT + "/path");

Review Comment:
   +1 WASBS 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3551477730


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -273,30 +277,38 @@ static StorageAccessConfig toAccessConfig(
   }
 
   private static void handleAzureCredential(
-      StorageAccessConfig.Builder config, String sasToken, String host, Instant expiresAt) {
-    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + host, sasToken);
+      StorageAccessConfig.Builder config,
+      String sasToken,
+      AzureLocation location,
+      Instant expiresAt) {
+    String storageDnsName = location.getStorageAccount() + "." + location.getEndpoint();

Review Comment:
   sure, added AzureLocation.getStorageDnsName() and switched the call sites that were concatenating getStorageAccount() + "." + getEndpoint() to use it. thanks!



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3552400106


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -33,45 +33,58 @@ public class AzureCredentialsStorageIntegrationTest {
   @Test
   public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
+    AzureLocation adlsLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.ADLS_ENDPOINT + "/path");
+    AzureLocation blobLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.BLOB_ENDPOINT + "/path");
 
     StorageAccessConfig noSuffixResult =

Review Comment:
   ah yeah, renamed the locals to adlsNoRefreshResult / adlsWithRefreshResult / blobResult...thanks!



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540693921


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;
+    if (host.endsWith(AzureLocation.ADLS_ENDPOINT) || host.endsWith(AzureLocation.BLOB_ENDPOINT)) {
+      int dotIndex = host.indexOf('.');
+      if (dotIndex > 0) {
+        accountName = host.substring(0, dotIndex);
+      } else {
+        accountName = host;

Review Comment:
   bare key names are client-driven (adlfs + fsspec used by PyIceberg when X-Iceberg-Access-Delegation=vended-credentials + py-io-impl=...FsspecFileIO). 
   
   exact workaround + failure in the description in #418 and https://github.com/apache/iceberg-python/issues/1146 (the custom CustomFsspecFileIO + _adls helper that was doing the remapping). 
   
   not part of the Iceberg REST spec itself, but required for those clients to build AzureBlobFileSystem.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3542080704


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -273,7 +276,11 @@ static StorageAccessConfig toAccessConfig(
   }
 
   private static void handleAzureCredential(
-      StorageAccessConfig.Builder config, String sasToken, String host, Instant expiresAt) {
+      StorageAccessConfig.Builder config,
+      String sasToken,
+      String host,
+      String accountName,

Review Comment:
   yeah, agree it's cleaner. refactored `handleAzureCredential` to take the whole `AzureLocation` instead of separate `storageDnsName` + `accountName` strings. for the `@VisibleForTesting toAccessConfig` helper (which is called with raw strings in tests), now it'll construct a fake location from the provided host so the same method is used. code in `compute(...)` already has the real location.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3542074858


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########


Review Comment:
   yes...removed the `withSuffixStripped` variable and the duplicate substring logic. now it'll consistently use the account name derived from `AzureLocation` for both the stripped sas-token keys (Iceberg 1.7.x compat) and the bare keys.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "vigneshio (via GitHub)" <gi...@apache.org>.
vigneshio commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3535315630


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,26 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token, adls.account-name, adls.account-host
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;
+    String accountHost;
+    if (host.endsWith(AzureLocation.ADLS_ENDPOINT) || host.endsWith(AzureLocation.BLOB_ENDPOINT)) {
+      int dotIndex = host.indexOf('.');
+      if (dotIndex > 0) {
+        accountName = host.substring(0, dotIndex);
+        accountHost = host;
+      } else {
+        accountName = host;
+        accountHost = host;
+      }
+    } else {
+      accountName = host;
+      accountHost = host;
+    }
+    config.putCredential(StorageAccessProperty.AZURE_ACCOUNT_NAME.getPropertyName(), accountName);
+    config.putCredential(StorageAccessProperty.AZURE_ACCOUNT_HOST.getPropertyName(), accountHost);

Review Comment:
   For normal ADLS tables, `host` will be something like `myaccount.dfs.core.windows.net`, so `adls.account-host` will get set to that full value. 
   
   `adlfs` passes `account_host` straight through when building the Blob endpoint URL. This could accidentally break existing fsspec clients (they might end up hitting the DFS endpoint instead of Blob).
   
   PyArrow - which seems to be the main gap you're trying to fix - actually ignores `adls.account-host` (it uses `adls.blob-storage-authority` / `adls.dfs-storage-authority` instead).
   
   Would it be okay to drop `adls.account-host` (or make it conditional)? I think the bare `adls.sas-token` + `adls.account-name` should already cover the main use case. WDYT?? 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "vigneshio (via GitHub)" <gi...@apache.org>.
vigneshio commented on PR #4991:
URL: https://github.com/apache/polaris/pull/4991#issuecomment-4907342093

   ty for the update @iprithv LGTM, just one thing - PR description still says adls.account-host. rest looks clean.. 
   cc: @dimas-b WDYT ? 


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540693921


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;
+    if (host.endsWith(AzureLocation.ADLS_ENDPOINT) || host.endsWith(AzureLocation.BLOB_ENDPOINT)) {
+      int dotIndex = host.indexOf('.');
+      if (dotIndex > 0) {
+        accountName = host.substring(0, dotIndex);
+      } else {
+        accountName = host;

Review Comment:
   bare key names are client-driven (adlfs + fsspec used by PyIceberg when X-Iceberg-Access-Delegation=vended-credentials + py-io-impl=...FsspecFileIO). 
   
   exact workaround + failure in the description in #418 and https://github.com/apache/iceberg-python/issues/1146 (the custom CustomFsspecFileIO + _adls helper that was doing the remapping). 
   
   not part of the Iceberg REST spec itself, but required for those clients to build AzureBlobFileSystem.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #4991:
URL: https://github.com/apache/polaris/pull/4991#issuecomment-4909548442

   Hi @iprithv : 
   
   > PyIceberg's adlfs/fsspec integration expects bare keys: adls.sas-token, adls.account-name, and adls.account-host to construct the AzureBlobFileSystem.
   
   I wonder, is this documented somewhere?


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540688228


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;

Review Comment:
   completely removed for the account name. now accountName = location.getStorageAccount() right after new AzureLocation(...) in compute(...) (where we already have the parsed object) and pass it down.. 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on PR #4991:
URL: https://github.com/apache/polaris/pull/4991#issuecomment-4912488445

   > Sorry for expanding the scope with further refactoring suggestion, but since we opened this can of worms, I think it would be nice to clarity the code that deals with Azure credential properties 😅
   
   No problem at all....Can't really complain about suggestions that make the code better :)
   And thanks for starting the discussion over email and sharing the link!
   


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540688228


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;

Review Comment:
   yes, makes sense..removed the parsing logic for the account name. now we'll get it directly via `location.getStorageAccount()` right after creating the `AzureLocation` in `compute(...)` and pass it down explicitly. thanks!



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540693141


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/StorageAccessProperty.java:
##########
@@ -71,6 +71,12 @@ public enum StorageAccessProperty {
   // it expects for SAS
   AZURE_ACCESS_TOKEN(String.class, "", "the azure scoped access token", true),
   AZURE_SAS_TOKEN(String.class, "adls.sas-token.", "an azure shared access signature token", true),
+  AZURE_SAS_TOKEN_BARE(
+      String.class,
+      "adls.sas-token",
+      "an azure shared access signature token without host suffix",

Review Comment:
   ah yes, fixed. thanks!



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #4991:
URL: https://github.com/apache/polaris/pull/4991#issuecomment-4911127084

   > [...] not part of the Iceberg REST spec itself, but required for those clients to build AzureBlobFileSystem.
   
   https://lists.apache.org/thread/kox8co2o30sl1wvvf2lzp64lz8lt3ogy


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3551839826


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -33,45 +33,58 @@ public class AzureCredentialsStorageIntegrationTest {
   @Test
   public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
+    AzureLocation adlsLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.ADLS_ENDPOINT + "/path");
+    AzureLocation blobLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.BLOB_ENDPOINT + "/path");
 
     StorageAccessConfig noSuffixResult =

Review Comment:
   this is not longer a "no suffix" result 🤔 Should we use `new AzureLocation("abfss://container@myaccount/path")` here?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540688228


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;

Review Comment:
   yes, makes sense..removed the parsing logic for the account name. now we'll get it directly via `location.getStorageAccount()` right after creating the `AzureLocation` in `compute(...)` and pass it down explicitly as mentioned above :) thanks!



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540743978


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;
+    if (host.endsWith(AzureLocation.ADLS_ENDPOINT) || host.endsWith(AzureLocation.BLOB_ENDPOINT)) {
+      int dotIndex = host.indexOf('.');
+      if (dotIndex > 0) {
+        accountName = host.substring(0, dotIndex);
+      } else {
+        accountName = host;

Review Comment:
   right, given the condition `host.endsWith(ADLS_ENDPOINT) || host.endsWith(BLOB_ENDPOINT)`, the `else` branch inside was unreachable (there will always be a `.` in the host at that point).
   
   I removed this parsing logic entirely. now we get the account name directly from the `AzureLocation`:
   
   ```java
   AzureLocation location = new AzureLocation(loc);
   ...
   String accountName = location.getStorageAccount();
   ...
   return toAccessConfig(sasToken, storageDnsName, accountName, ...);



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3541034684


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########


Review Comment:
   `withSuffixStripped` is the same as `accountName`, is it not?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3551839826


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -33,45 +33,58 @@ public class AzureCredentialsStorageIntegrationTest {
   @Test
   public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
+    AzureLocation adlsLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.ADLS_ENDPOINT + "/path");
+    AzureLocation blobLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.BLOB_ENDPOINT + "/path");
 
     StorageAccessConfig noSuffixResult =

Review Comment:
   this is no longer a "no suffix" result 🤔 Should we use `new AzureLocation("abfss://container@myaccount/path")` here?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b merged PR #4991:
URL: https://github.com/apache/polaris/pull/4991


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3542084684


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########


Review Comment:
   yeah agree, added both methods to `AzureLocation`:
   
   ```java
   public boolean isAdls() { ... }
   public boolean isBlob() { ... }



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3547363508


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -261,8 +261,12 @@ static StorageAccessConfig toAccessConfig(
       String storageDnsName,
       Instant expiresAt,
       Optional<String> refreshCredentialsEndpoint) {
+    // For tests we build a fake location from the provided host part so we can pass the whole
+    // AzureLocation to handle (addresses review suggestion).
+    String fakeUri = "abfss://container@" + storageDnsName + "/path";

Review Comment:
   Well, why not pass the `location` from line 162 here?



##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -273,30 +277,38 @@ static StorageAccessConfig toAccessConfig(
   }
 
   private static void handleAzureCredential(
-      StorageAccessConfig.Builder config, String sasToken, String host, Instant expiresAt) {
-    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + host, sasToken);
+      StorageAccessConfig.Builder config,
+      String sasToken,
+      AzureLocation location,
+      Instant expiresAt) {
+    String storageDnsName = location.getStorageAccount() + "." + location.getEndpoint();

Review Comment:
   How about adding `AzureLocation.getStorageDnsName()`?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3540040388


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;
+    if (host.endsWith(AzureLocation.ADLS_ENDPOINT) || host.endsWith(AzureLocation.BLOB_ENDPOINT)) {
+      int dotIndex = host.indexOf('.');
+      if (dotIndex > 0) {
+        accountName = host.substring(0, dotIndex);
+      } else {
+        accountName = host;

Review Comment:
   given the condition on line 304, this is not possible, is it?



##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -297,6 +297,21 @@ private static void handleAzureCredential(
             StorageAccessProperty.AZURE_SAS_TOKEN.getPropertyName() + withSuffixStripped, sasToken);
       }
     }
+
+    // PyIceberg and other clients need bare adls.sas-token and adls.account-name
+    config.putCredential(StorageAccessProperty.AZURE_SAS_TOKEN_BARE.getPropertyName(), sasToken);
+    String accountName;

Review Comment:
   Account name is available from `AzureLocation` higher up the call stack.
   
   Cf. https://github.com/apache/polaris/blob/16cf03dc8b3d9f7bdd8422ee7e47ed987bae85ea/polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java#L165



##########
polaris-core/src/main/java/org/apache/polaris/core/storage/StorageAccessProperty.java:
##########
@@ -71,6 +71,12 @@ public enum StorageAccessProperty {
   // it expects for SAS
   AZURE_ACCESS_TOKEN(String.class, "", "the azure scoped access token", true),
   AZURE_SAS_TOKEN(String.class, "adls.sas-token.", "an azure shared access signature token", true),
+  AZURE_SAS_TOKEN_BARE(
+      String.class,
+      "adls.sas-token",
+      "an azure shared access signature token without host suffix",

Review Comment:
   nit: this description is a bit misleading. It reads as though the "suffix" refers to the token, but it refers to the property name, if I'm not mistaken. 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3551839826


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -33,45 +33,58 @@ public class AzureCredentialsStorageIntegrationTest {
   @Test
   public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
+    AzureLocation adlsLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.ADLS_ENDPOINT + "/path");
+    AzureLocation blobLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.BLOB_ENDPOINT + "/path");
 
     StorageAccessConfig noSuffixResult =

Review Comment:
   this is not longer as "no suffix" result 🤔 Should we use `new AzureLocation("abfss://container@myaccount/path")` here?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add bare ADLS vended credential keys for PyIceberg compat [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4991:
URL: https://github.com/apache/polaris/pull/4991#discussion_r3552877108


##########
polaris-core/src/test/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegrationTest.java:
##########
@@ -33,45 +33,63 @@ public class AzureCredentialsStorageIntegrationTest {
   @Test
   public void testAzureCredentialFormatting() {
     Instant expiresAt = Instant.ofEpochMilli(Long.MAX_VALUE);
+    AzureLocation adlsLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.ADLS_ENDPOINT + "/path");
+    AzureLocation blobLocation =
+        new AzureLocation("abfss://container@myaccount." + AzureLocation.BLOB_ENDPOINT + "/path");

Review Comment:
   this does not look like a correct format for Blob URIs 🤔 
   
   It should be something like `https://myaccount.blob.core.windows.net/container/path`, I guess... Cf. https://learn.microsoft.com/en-us/rest/api/storageservices/Naming-and-Referencing-Containers--Blobs--and-Metadata
   
   Not a big deal for this change, but let's keep tests compliant with Azure specs :)



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org