From 6f3c61199448883e4e1c99c21ee899bf868295af Mon Sep 17 00:00:00 2001 From: charliechen Date: Fri, 28 Aug 2026 16:39:09 -0700 Subject: [PATCH] Delta: Use POSIX separator for data file paths Build migrated Delta data file locations with the URI separator so paths remain valid when the migration runs on Windows. Generated-by: Codex --- .../iceberg/delta/BaseSnapshotDeltaLakeTableAction.java | 5 ++--- .../delta/TestBaseSnapshotDeltaLakeTableAction.java | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/delta-lake/src/main/java/org/apache/iceberg/delta/BaseSnapshotDeltaLakeTableAction.java b/delta-lake/src/main/java/org/apache/iceberg/delta/BaseSnapshotDeltaLakeTableAction.java index 69bbaed71997..b9970b95ffe0 100644 --- a/delta-lake/src/main/java/org/apache/iceberg/delta/BaseSnapshotDeltaLakeTableAction.java +++ b/delta-lake/src/main/java/org/apache/iceberg/delta/BaseSnapshotDeltaLakeTableAction.java @@ -24,7 +24,6 @@ import io.delta.standalone.actions.AddFile; import io.delta.standalone.actions.RemoveFile; import io.delta.standalone.exceptions.DeltaStandaloneException; -import java.io.File; import java.net.URI; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; @@ -448,13 +447,13 @@ private void tagCurrentSnapshot(long deltaVersion, Transaction transaction) { * (either absolute or relative) * @param tableRoot the root path of the delta table */ - private static String getFullFilePath(String path, String tableRoot) { + static String getFullFilePath(String path, String tableRoot) { URI dataFileUri = URI.create(path); String decodedPath = URLDecoder.decode(path, StandardCharsets.UTF_8); if (dataFileUri.isAbsolute()) { return decodedPath; } else { - return tableRoot + File.separator + decodedPath; + return tableRoot + "/" + decodedPath; } } } diff --git a/delta-lake/src/test/java/org/apache/iceberg/delta/TestBaseSnapshotDeltaLakeTableAction.java b/delta-lake/src/test/java/org/apache/iceberg/delta/TestBaseSnapshotDeltaLakeTableAction.java index f77ce441067e..c37c99e17a4e 100644 --- a/delta-lake/src/test/java/org/apache/iceberg/delta/TestBaseSnapshotDeltaLakeTableAction.java +++ b/delta-lake/src/test/java/org/apache/iceberg/delta/TestBaseSnapshotDeltaLakeTableAction.java @@ -18,6 +18,7 @@ */ package org.apache.iceberg.delta; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.io.File; @@ -99,6 +100,14 @@ public void testDeltaTableNotExist() { "Delta Lake table does not exist at the given location: %s", sourceTableLocation); } + @Test + public void fullFilePathUsesUriSeparator() { + assertThat( + BaseSnapshotDeltaLakeTableAction.getFullFilePath( + "data/file.parquet", "s3://bucket/table")) + .isEqualTo("s3://bucket/table/data/file.parquet"); + } + private static class TestCatalog extends BaseMetastoreCatalog { TestCatalog() {}