diff --git a/core/src/main/java/org/apache/iceberg/LocationProviders.java b/core/src/main/java/org/apache/iceberg/LocationProviders.java index 33e411791125..19385e1f545c 100644 --- a/core/src/main/java/org/apache/iceberg/LocationProviders.java +++ b/core/src/main/java/org/apache/iceberg/LocationProviders.java @@ -69,7 +69,8 @@ public static LocationProvider locationsFor(String location, Map } private static String defaultDataLocation(String tableLocation, Map properties) { - return properties.getOrDefault(TableProperties.WRITE_NEW_DATA_LOCATION, String.format("%s/data", tableLocation)); + return properties.getOrDefault(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, + String.format("%s/data", tableLocation)); } static class DefaultLocationProvider implements LocationProvider { diff --git a/core/src/main/java/org/apache/iceberg/TableProperties.java b/core/src/main/java/org/apache/iceberg/TableProperties.java index fe19a2a850f0..dcbab13cd70d 100644 --- a/core/src/main/java/org/apache/iceberg/TableProperties.java +++ b/core/src/main/java/org/apache/iceberg/TableProperties.java @@ -142,6 +142,12 @@ private TableProperties() { // This only applies to files written after this property is set. Files previously written aren't // relocated to reflect this parameter. // If not set, defaults to a "data" folder underneath the root path of the table. + public static final String WRITE_FOLDER_STORAGE_LOCATION = "write.folder-storage.path"; + + /** + * @deprecated will be removed in 0.14.0, use {@link #WRITE_FOLDER_STORAGE_LOCATION} instead + */ + @Deprecated public static final String WRITE_NEW_DATA_LOCATION = "write.folder-storage.path"; // This only applies to files written after this property is set. Files previously written aren't diff --git a/core/src/test/java/org/apache/iceberg/TestLocationProvider.java b/core/src/test/java/org/apache/iceberg/TestLocationProvider.java index bbbb65b22ebc..e47b0e30f9ea 100644 --- a/core/src/test/java/org/apache/iceberg/TestLocationProvider.java +++ b/core/src/test/java/org/apache/iceberg/TestLocationProvider.java @@ -114,7 +114,7 @@ public void testDefaultLocationProvider() { @Test public void testDefaultLocationProviderWithCustomDataLocation() { this.table.updateProperties() - .set(TableProperties.WRITE_NEW_DATA_LOCATION, "new_location") + .set(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, "new_location") .commit(); this.table.locationProvider().newDataLocation("my_file"); @@ -224,7 +224,7 @@ public void testObjectStorageLocationProviderPathResolution() { String folderPath = "s3://random/folder/location"; table.updateProperties() - .set(TableProperties.WRITE_NEW_DATA_LOCATION, folderPath) + .set(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, folderPath) .commit(); Assert.assertTrue("folder storage path should be used when set", diff --git a/spark/src/jmh/java/org/apache/iceberg/spark/source/IcebergSourceBenchmark.java b/spark/src/jmh/java/org/apache/iceberg/spark/source/IcebergSourceBenchmark.java index 91568db0517c..cb25074b4d96 100644 --- a/spark/src/jmh/java/org/apache/iceberg/spark/source/IcebergSourceBenchmark.java +++ b/spark/src/jmh/java/org/apache/iceberg/spark/source/IcebergSourceBenchmark.java @@ -44,8 +44,6 @@ import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; -import static org.apache.iceberg.TableProperties.WRITE_NEW_DATA_LOCATION; - @Fork(1) @State(Scope.Benchmark) @Warmup(iterations = 3) @@ -81,7 +79,8 @@ protected String newTableLocation() { protected String dataLocation() { Map properties = table.properties(); - return properties.getOrDefault(WRITE_NEW_DATA_LOCATION, String.format("%s/data", table.location())); + return properties.getOrDefault(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, + String.format("%s/data", table.location())); } protected void cleanupFiles() throws IOException { diff --git a/spark/src/test/java/org/apache/iceberg/actions/TestRemoveOrphanFilesAction.java b/spark/src/test/java/org/apache/iceberg/actions/TestRemoveOrphanFilesAction.java index e32ca7b971bd..7c2a325eb783 100644 --- a/spark/src/test/java/org/apache/iceberg/actions/TestRemoveOrphanFilesAction.java +++ b/spark/src/test/java/org/apache/iceberg/actions/TestRemoveOrphanFilesAction.java @@ -285,7 +285,7 @@ public void testWapFilesAreKept() throws InterruptedException { public void testMetadataFolderIsIntact() throws InterruptedException { // write data directly to the table location Map props = Maps.newHashMap(); - props.put(TableProperties.WRITE_NEW_DATA_LOCATION, tableLocation); + props.put(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, tableLocation); Table table = TABLES.create(SCHEMA, SPEC, props, tableLocation); List records = Lists.newArrayList( @@ -357,7 +357,7 @@ public void testOlderThanTimestamp() throws InterruptedException { @Test public void testRemoveUnreachableMetadataVersionFiles() throws InterruptedException { Map props = Maps.newHashMap(); - props.put(TableProperties.WRITE_NEW_DATA_LOCATION, tableLocation); + props.put(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, tableLocation); props.put(TableProperties.METADATA_PREVIOUS_VERSIONS_MAX, "1"); Table table = TABLES.create(SCHEMA, SPEC, props, tableLocation); diff --git a/spark/src/test/java/org/apache/iceberg/spark/source/TestDataFrameWrites.java b/spark/src/test/java/org/apache/iceberg/spark/source/TestDataFrameWrites.java index f8f66ca66f28..8ad8e2e2b802 100644 --- a/spark/src/test/java/org/apache/iceberg/spark/source/TestDataFrameWrites.java +++ b/spark/src/test/java/org/apache/iceberg/spark/source/TestDataFrameWrites.java @@ -145,7 +145,7 @@ public void testWriteWithCustomDataLocation() throws IOException { File tablePropertyDataLocation = temp.newFolder("test-table-property-data-dir"); Table table = createTable(new Schema(SUPPORTED_PRIMITIVES.fields()), location); table.updateProperties().set( - TableProperties.WRITE_NEW_DATA_LOCATION, tablePropertyDataLocation.getAbsolutePath()).commit(); + TableProperties.WRITE_FOLDER_STORAGE_LOCATION, tablePropertyDataLocation.getAbsolutePath()).commit(); writeAndValidateWithLocations(table, location, tablePropertyDataLocation); } @@ -271,7 +271,7 @@ public void testNullableWithWriteOption() throws IOException { String sourcePath = String.format("%s/nullable_poc/sourceFolder/", location.toString()); String targetPath = String.format("%s/nullable_poc/targetFolder/", location.toString()); - tableProperties = ImmutableMap.of(TableProperties.WRITE_NEW_DATA_LOCATION, targetPath); + tableProperties = ImmutableMap.of(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, targetPath); // read this and append to iceberg dataset spark @@ -312,7 +312,7 @@ public void testNullableWithSparkSqlOption() throws IOException { String sourcePath = String.format("%s/nullable_poc/sourceFolder/", location.toString()); String targetPath = String.format("%s/nullable_poc/targetFolder/", location.toString()); - tableProperties = ImmutableMap.of(TableProperties.WRITE_NEW_DATA_LOCATION, targetPath); + tableProperties = ImmutableMap.of(TableProperties.WRITE_FOLDER_STORAGE_LOCATION, targetPath); // read this and append to iceberg dataset spark diff --git a/spark3/src/main/java/org/apache/iceberg/spark/actions/BaseSnapshotTableSparkAction.java b/spark3/src/main/java/org/apache/iceberg/spark/actions/BaseSnapshotTableSparkAction.java index 73cfa59feff6..fdc5bf09ce4d 100644 --- a/spark3/src/main/java/org/apache/iceberg/spark/actions/BaseSnapshotTableSparkAction.java +++ b/spark3/src/main/java/org/apache/iceberg/spark/actions/BaseSnapshotTableSparkAction.java @@ -167,7 +167,7 @@ protected Map destTableProps() { // remove any possible location properties from origin properties properties.remove(LOCATION); properties.remove(TableProperties.WRITE_METADATA_LOCATION); - properties.remove(TableProperties.WRITE_NEW_DATA_LOCATION); + properties.remove(TableProperties.WRITE_FOLDER_STORAGE_LOCATION); // set default and user-provided props properties.put(TableCatalog.PROP_PROVIDER, "iceberg");