Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -342,12 +341,12 @@
Long nullableFileSize;
Map<String, String> partitionValues;

if (action instanceof AddFile) {

Check warning on line 344 in delta-lake/src/main/java/org/apache/iceberg/delta/BaseSnapshotDeltaLakeTableAction.java

View workflow job for this annotation

GitHub Actions / build-checks (17, pull_request)

[PatternMatchingInstanceof] This code can be simplified to use a pattern-matching instanceof.
AddFile addFile = (AddFile) action;
path = addFile.getPath();
nullableFileSize = addFile.getSize();
partitionValues = addFile.getPartitionValues();
} else if (action instanceof RemoveFile) {

Check warning on line 349 in delta-lake/src/main/java/org/apache/iceberg/delta/BaseSnapshotDeltaLakeTableAction.java

View workflow job for this annotation

GitHub Actions / build-checks (17, pull_request)

[PatternMatchingInstanceof] This code can be simplified to use a pattern-matching instanceof.
RemoveFile removeFile = (RemoveFile) action;
path = removeFile.getPath();
nullableFileSize = removeFile.getSize().orElse(null);
Expand Down Expand Up @@ -448,13 +447,13 @@
* (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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {}

Expand Down
Loading