-
Notifications
You must be signed in to change notification settings - Fork 381
Support hierarchical namespace in Azure #3347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,6 +58,10 @@ public StorageType getStorageType() { | |||||||||||||||
| @Nullable | ||||||||||||||||
| public abstract String getConsentUrl(); | ||||||||||||||||
|
|
||||||||||||||||
| /** The flag indicating whether the storage account supports hierarchical namespaces. */ | ||||||||||||||||
| @Nullable | ||||||||||||||||
| public abstract Boolean isHierarchical(); | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Could actually also be (primitive):
Suggested change
Both help with serialization size and backwards compatiblity.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a blocker tho
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An object I'd rather not change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 95 in 992a428
|
||||||||||||||||
|
|
||||||||||||||||
| @Override | ||||||||||||||||
| public void validatePrefixForStorageType(String loc) { | ||||||||||||||||
| AzureLocation location = new AzureLocation(loc); | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.polaris.service.it; | ||
|
|
||
| import com.google.common.collect.ImmutableMap; | ||
| import io.quarkus.test.junit.QuarkusTestProfile; | ||
| import java.util.Map; | ||
|
|
||
| public class CredentialVendingProfile implements QuarkusTestProfile { | ||
|
|
||
| @Override | ||
| public Map<String, String> getConfigOverrides() { | ||
| return ImmutableMap.<String, String>builder() | ||
| .put("polaris.features.\"SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION\"", "false") | ||
| .build(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.service.it; | ||
|
|
||
| import io.quarkus.test.junit.QuarkusIntegrationTest; | ||
| import io.quarkus.test.junit.TestProfile; | ||
| import org.apache.polaris.service.it.test.PolarisRestCatalogAdlsIntegrationTestBase; | ||
| import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; | ||
|
|
||
| @QuarkusIntegrationTest | ||
| @TestProfile(CredentialVendingProfile.class) | ||
| @EnabledIfEnvironmentVariable(named = "INTEGRATION_TEST_AZURE_PATH", matches = ".+") | ||
| public class RestCatalogAdlsCredentialVendingIT extends PolarisRestCatalogAdlsIntegrationTestBase {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.service.it; | ||
|
|
||
| import io.quarkus.test.junit.QuarkusIntegrationTest; | ||
| import io.quarkus.test.junit.TestProfile; | ||
| import org.apache.polaris.service.it.test.PolarisRestCatalogViewAdlsIntegrationTestBase; | ||
| import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; | ||
|
|
||
| @QuarkusIntegrationTest | ||
| @TestProfile(CredentialVendingProfile.class) | ||
| @EnabledIfEnvironmentVariable(named = "INTEGRATION_TEST_AZURE_PATH", matches = ".+") | ||
| public class RestCatalogViewAdlsCredentialVendingIT | ||
| extends PolarisRestCatalogViewAdlsIntegrationTestBase {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -405,11 +405,11 @@ public void testAwsConfigJsonPropertiesPresence() throws JsonProcessingException | |
|
|
||
| @ParameterizedTest | ||
| @MethodSource | ||
| public void testAwsConfigRoundTrip(AwsStorageConfigInfo config) throws JsonProcessingException { | ||
| public void testStorageConfigRoundTrip(StorageConfigInfo config) throws JsonProcessingException { | ||
| String configStr = MAPPER.writeValueAsString(config); | ||
| CatalogEntity catalogEntity = | ||
| new CatalogEntity.Builder() | ||
| .setName("testAwsConfigRoundTrip") | ||
| .setName("testStorageConfigRoundTrip") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 for removing AWS specific here. |
||
| .setDefaultBaseLocation(config.getAllowedLocations().getFirst()) | ||
| .setCatalogType(Catalog.TypeEnum.INTERNAL.name()) | ||
| .setStorageConfigurationInfo( | ||
|
|
@@ -482,18 +482,36 @@ icebergRestConnectionConfigInfoModel, null, new AwsIamServiceIdentityInfoDpo(nul | |
| .isEqualTo("arn:aws:iam::123456789012:user/test-user"); | ||
| } | ||
|
|
||
| public static Stream<Arguments> testAwsConfigRoundTrip() { | ||
| public static Stream<Arguments> testStorageConfigRoundTrip() { | ||
| AwsStorageConfigInfo.Builder b = | ||
| AwsStorageConfigInfo.builder() | ||
| .setStorageType(StorageConfigInfo.StorageTypeEnum.S3) | ||
| .setAllowedLocations(List.of("s3://example.com")) | ||
| .setRoleArn("arn:aws:iam::012345678901:role/test-role"); | ||
| AzureStorageConfigInfo.Builder a = | ||
| AzureStorageConfigInfo.builder() | ||
| .setStorageType(StorageConfigInfo.StorageTypeEnum.AZURE) | ||
| .setTenantId("test-tenant") | ||
| .setAllowedLocations(List.of("abfss://test@example.dfs.core.windows.net/")); | ||
| return Stream.of( | ||
| Arguments.of(b.build()), | ||
| Arguments.of(b.setExternalId("ex1").build()), | ||
| Arguments.of(b.setRegion("us-west-2").build()), | ||
| Arguments.of(b.setEndpoint("http://s3.example.com:1234").build()), | ||
| Arguments.of(b.setStsEndpoint("http://sts.example.com:1234").build()), | ||
| Arguments.of(b.setPathStyleAccess(true).build())); | ||
| Arguments.of(b.setPathStyleAccess(true).build()), | ||
| Arguments.of(a.build()), | ||
| Arguments.of(a.setHierarchical(true).build())); | ||
| } | ||
|
|
||
| @Test | ||
| public void testAzureConfigJsonPropertiesPresence() throws JsonProcessingException { | ||
| AzureStorageConfigInfo.Builder b = | ||
| AzureStorageConfigInfo.builder().setStorageType(StorageConfigInfo.StorageTypeEnum.AZURE); | ||
| assertThat(MAPPER.writeValueAsString(b.build())).contains("storageType"); | ||
| assertThat(MAPPER.writeValueAsString(b.build())).doesNotContain("hierarchical"); | ||
|
|
||
| b.setHierarchical(true); | ||
| assertThat(MAPPER.writeValueAsString(b.build())).contains("hierarchical"); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N00b question for my own understanding, what is the use case for several allowedReadLocations and allowedWriteLocations?
Also why does this apply only to hierarchical use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I do not really know 😅 Currently, only one location is passed in.
Azure can restrict SAS to only location (base directory or specific file).