This is an automated email from the ASF dual-hosted git repository.

Gabriel39 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 61fad32df20 [fix](iceberg) Use object store path for data location 
(#64028)
61fad32df20 is described below

commit 61fad32df207bc753113c2fb8bc4c368fc6eb6aa
Author: Gabriel <[email protected]>
AuthorDate: Wed Jun 3 09:34:13 2026 +0800

    [fix](iceberg) Use object store path for data location (#64028)
    
    Problem Summary: Iceberg data location resolution skipped the legacy
    object-store.path property and fell back directly to
    write.folder-storage.path or table location when write.data.path was not
    set. This could choose the wrong data location for tables that still
    rely on object-store.path. This change keeps write.data.path as the
    highest priority, then checks object-store.path before
    write.folder-storage.path and the default table data directory.
---
 .../doris/datasource/iceberg/IcebergUtils.java     |  8 +++-
 .../doris/datasource/iceberg/IcebergUtilsTest.java | 43 ++++++++++++++++++++++
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergUtils.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergUtils.java
index dd600b13725..b451980cd5a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergUtils.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergUtils.java
@@ -1128,9 +1128,13 @@ public class IcebergUtils {
         }
         String dataLocation = 
properties.get(TableProperties.WRITE_DATA_LOCATION);
         if (dataLocation == null) {
-            dataLocation = 
properties.get(TableProperties.WRITE_FOLDER_STORAGE_LOCATION);
+            dataLocation = 
Boolean.parseBoolean(properties.get(TableProperties.OBJECT_STORE_ENABLED))
+                    ? properties.get(TableProperties.OBJECT_STORE_PATH) : null;
             if (dataLocation == null) {
-                dataLocation = String.format("%s/data", 
LocationUtil.stripTrailingSlash(table.location()));
+                dataLocation = 
properties.get(TableProperties.WRITE_FOLDER_STORAGE_LOCATION);
+                if (dataLocation == null) {
+                    dataLocation = String.format("%s/data", 
LocationUtil.stripTrailingSlash(table.location()));
+                }
             }
         }
         return dataLocation;
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergUtilsTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergUtilsTest.java
index 1fcde27aa95..49b05f3c1bb 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergUtilsTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergUtilsTest.java
@@ -37,6 +37,7 @@ import org.apache.iceberg.Schema;
 import org.apache.iceberg.Snapshot;
 import org.apache.iceberg.SnapshotRef;
 import org.apache.iceberg.Table;
+import org.apache.iceberg.TableProperties;
 import org.apache.iceberg.expressions.Expression;
 import org.apache.iceberg.expressions.Expressions;
 import org.apache.iceberg.expressions.UnboundPredicate;
@@ -106,6 +107,48 @@ public class IcebergUtilsTest {
         return declaredField.getBoolean(hiveCatalog);
     }
 
+    @Test
+    public void testDataLocationUsesLegacyObjectStorePath() {
+        Table table = Mockito.mock(Table.class);
+        Mockito.when(table.properties()).thenReturn(ImmutableMap.of(
+                TableProperties.OBJECT_STORE_ENABLED, "true",
+                TableProperties.OBJECT_STORE_PATH, 
"s3://bucket/legacy-object-store",
+                TableProperties.WRITE_FOLDER_STORAGE_LOCATION, 
"s3://bucket/folder-storage"));
+
+        Assert.assertEquals("s3://bucket/legacy-object-store", 
IcebergUtils.dataLocation(table));
+    }
+
+    @Test
+    public void 
testDataLocationPrefersWriteDataPathOverLegacyObjectStorePath() {
+        Table table = Mockito.mock(Table.class);
+        Mockito.when(table.properties()).thenReturn(ImmutableMap.of(
+                TableProperties.WRITE_DATA_LOCATION, "s3://bucket/data-path",
+                TableProperties.OBJECT_STORE_PATH, 
"s3://bucket/legacy-object-store"));
+
+        Assert.assertEquals("s3://bucket/data-path", 
IcebergUtils.dataLocation(table));
+    }
+
+    @Test
+    public void 
testDataLocationIgnoresObjectStorePathWhenObjectStoreDisabled() {
+        Table table = Mockito.mock(Table.class);
+        Mockito.when(table.properties()).thenReturn(ImmutableMap.of(
+                TableProperties.OBJECT_STORE_ENABLED, "false",
+                TableProperties.OBJECT_STORE_PATH, 
"s3://bucket/legacy-object-store",
+                TableProperties.WRITE_FOLDER_STORAGE_LOCATION, 
"s3://bucket/folder-storage"));
+
+        Assert.assertEquals("s3://bucket/folder-storage", 
IcebergUtils.dataLocation(table));
+    }
+
+    @Test
+    public void testDataLocationIgnoresObjectStorePathWhenObjectStoreUnset() {
+        Table table = Mockito.mock(Table.class);
+        Mockito.when(table.properties()).thenReturn(ImmutableMap.of(
+                TableProperties.OBJECT_STORE_PATH, 
"s3://bucket/legacy-object-store",
+                TableProperties.WRITE_FOLDER_STORAGE_LOCATION, 
"s3://bucket/folder-storage"));
+
+        Assert.assertEquals("s3://bucket/folder-storage", 
IcebergUtils.dataLocation(table));
+    }
+
     @Test
     public void testIsIcebergRowLineageColumn() {
         Column rowIdColumn = new Column(IcebergUtils.ICEBERG_ROW_ID_COL, 
Type.BIGINT, true);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to