Skip to content

Commit 887e001

Browse files
committed
Document the behavior of customMetadataLocation
1 parent b8a9994 commit 887e001

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogViewIntegrationBase.java

+19-13
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import org.junit.jupiter.api.Assumptions;
5353
import org.junit.jupiter.api.BeforeAll;
5454
import org.junit.jupiter.api.BeforeEach;
55-
import org.junit.jupiter.api.Disabled;
5655
import org.junit.jupiter.api.Test;
5756
import org.junit.jupiter.api.TestInfo;
5857
import org.junit.jupiter.api.extension.ExtendWith;
@@ -179,10 +178,8 @@ protected boolean overridesRequestedLocation() {
179178
return true;
180179
}
181180

182-
/** TODO: Unblock this test, see: https://github.com/apache/polaris/issues/1273 */
183181
@Override
184182
@Test
185-
@Disabled
186183
public void createViewWithCustomMetadataLocation() {
187184
Assertions.assertThatThrownBy(super::createViewWithCustomMetadataLocation)
188185
.isInstanceOf(ForbiddenException.class)
@@ -209,6 +206,8 @@ public void createViewWithCustomMetadataLocationUsingPolaris(@TempDir Path tempD
209206

210207
assertThat(catalog().viewExists(identifier)).as("View should not exist").isFalse();
211208

209+
// CAN create a view with a custom metadata location `baseLocation/customLocation`,
210+
// as long as the location is within the parent namespace's `write.metadata.path=baseLocation`
212211
View view =
213212
catalog()
214213
.buildView(identifier)
@@ -228,6 +227,9 @@ public void createViewWithCustomMetadataLocationUsingPolaris(@TempDir Path tempD
228227
.isNotNull()
229228
.startsWith(customLocation);
230229

230+
// CANNOT update the view with a new metadata location `baseLocation/customLocation2`,
231+
// even though the new location is still under the parent namespace's
232+
// `write.metadata.path=baseLocation`.
231233
Assertions.assertThatThrownBy(
232234
() ->
233235
catalog()
@@ -240,15 +242,19 @@ public void createViewWithCustomMetadataLocationUsingPolaris(@TempDir Path tempD
240242
.isInstanceOf(ForbiddenException.class)
241243
.hasMessageContaining("Forbidden: Invalid locations");
242244

243-
catalog()
244-
.loadView(identifier)
245-
.updateProperties()
246-
.set(IcebergTableLikeEntity.USER_SPECIFIED_WRITE_METADATA_LOCATION_KEY, customLocationChild)
247-
.commit();
248-
View childView = catalog().loadView(identifier);
249-
assertThat(childView.properties()).containsEntry("write.metadata.path", customLocationChild);
250-
assertThat(((BaseView) childView).operations().current().metadataFileLocation())
251-
.isNotNull()
252-
.startsWith(customLocationChild);
245+
// CANNOT update the view with a child metadata location `baseLocation/customLocation/child`,
246+
// even though it is a subpath of the original view's
247+
// `write.metadata.path=baseLocation/customLocation`.
248+
Assertions.assertThatThrownBy(
249+
() ->
250+
catalog()
251+
.loadView(identifier)
252+
.updateProperties()
253+
.set(
254+
IcebergTableLikeEntity.USER_SPECIFIED_WRITE_METADATA_LOCATION_KEY,
255+
customLocationChild)
256+
.commit())
257+
.isInstanceOf(ForbiddenException.class)
258+
.hasMessageContaining("Forbidden: Invalid locations");
253259
}
254260
}

polaris-core/src/main/java/org/apache/polaris/core/storage/PolarisStorageConfigurationInfo.java

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ public static Optional<PolarisStorageConfigurationInfo> forEntityPath(
181181
"Allowing unstructured table location for entity: {}",
182182
entityPathReversed.get(0).getName());
183183

184+
// TODO: figure out the purpose of adding `userSpecifiedWriteLocations`
184185
List<String> locs =
185186
userSpecifiedWriteLocations(entityPathReversed.get(0).getPropertiesAsMap());
186187
return new StorageConfigurationOverride(

0 commit comments

Comments
 (0)