Skip to content
Draft
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 @@ -17,6 +17,8 @@

import static io.delta.kernel.spark.utils.ExpressionUtils.dsv2PredicateToCatalystExpression;

import org.apache.hadoop.fs.Path;

import io.delta.kernel.data.MapValue;
import io.delta.kernel.data.Row;
import io.delta.kernel.defaults.engine.DefaultEngine;
Expand Down Expand Up @@ -79,8 +81,7 @@ public SparkScan(
CaseInsensitiveStringMap options) {

final String normalizedTablePath = Objects.requireNonNull(tablePath, "tablePath is null");
this.tablePath =
normalizedTablePath.endsWith("/") ? normalizedTablePath : normalizedTablePath + "/";
this.tablePath = new Path(normalizedTablePath).toUri().toString() + "/"; // ensure trailing slash
this.dataSchema = Objects.requireNonNull(dataSchema, "dataSchema is null");
this.partitionSchema = Objects.requireNonNull(partitionSchema, "partitionSchema is null");
this.readDataSchema = Objects.requireNonNull(readDataSchema, "readDataSchema is null");
Expand Down Expand Up @@ -216,11 +217,13 @@ private void planScanFiles() {
while (addFileRowIter.hasNext()) {
final Row row = addFileRowIter.next();
final AddFile addFile = new AddFile(row.getStruct(0));
final String filePath = addFile.getPath();
final String fullPath = new Path(filePath).isAbsolute() ? filePath : tablePath + filePath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's create a utility method for handling the path url and add test cases


final PartitionedFile partitionedFile =
new PartitionedFile(
getPartitionRow(addFile.getPartitionValues()),
SparkPath.fromUrlString(tablePath + addFile.getPath()),
SparkPath.fromUrlString(fullPath),
0L,
addFile.getSize(),
locations,
Expand Down
Loading