Skip to content

Commit

Permalink
Replace deprecated path() with location() in ContentFile
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Dec 2, 2024
1 parent 261f254 commit a0e1ea3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ private void finishOptimize(ConnectorSession session, IcebergTableExecuteHandle
cleanExtraOutputFiles(
session,
newFiles.stream()
.map(dataFile -> dataFile.path().toString())
.map(ContentFile::location)
.collect(toImmutableSet()));
}

Expand Down Expand Up @@ -2004,7 +2004,7 @@ private void removeOrphanFiles(Table table, ConnectorSession session, SchemaTabl
validMetadataFileNames.add(fileName(manifest.path()));
try (ManifestReader<? extends ContentFile<?>> manifestReader = readerForManifest(table, manifest)) {
for (ContentFile<?> contentFile : manifestReader) {
validDataFileNames.add(fileName(contentFile.path().toString()));
validDataFileNames.add(fileName(contentFile.location()));
}
}
catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,11 @@ private synchronized boolean pruneFileScanTask(FileScanTaskWithDomain fileScanTa
return true;
}

if (!pathDomain.isAll() && !pathDomain.includesNullableValue(utf8Slice(fileScanTask.file().path().toString()))) {
if (!pathDomain.isAll() && !pathDomain.includesNullableValue(utf8Slice(fileScanTask.file().location()))) {
return true;
}
if (!fileModifiedTimeDomain.isAll()) {
long fileModifiedTime = getModificationTime(fileScanTask.file().path().toString(), fileSystemFactory.create(session.getIdentity(), fileIoProperties));
long fileModifiedTime = getModificationTime(fileScanTask.file().location(), fileSystemFactory.create(session.getIdentity(), fileIoProperties));
if (!fileModifiedTimeDomain.includesNullableValue(packDateTimeWithZone(fileModifiedTime, UTC_KEY))) {
return true;
}
Expand Down Expand Up @@ -662,7 +662,7 @@ private IcebergSplit toIcebergSplit(FileScanTaskWithDomain taskWithDomain)
{
FileScanTask task = taskWithDomain.fileScanTask();
return new IcebergSplit(
task.file().path().toString(),
task.file().location(),
task.start(),
task.length(),
task.file().fileSizeInBytes(),
Expand All @@ -676,7 +676,7 @@ private IcebergSplit toIcebergSplit(FileScanTaskWithDomain taskWithDomain)
SplitWeight.fromProportion(clamp(getSplitWeight(task), minimumAssignedSplitWeight, 1.0)),
taskWithDomain.fileStatisticsDomain(),
fileIoProperties,
cachingHostAddressProvider.getHosts(task.file().path().toString(), ImmutableList.of()),
cachingHostAddressProvider.getHosts(task.file().location(), ImmutableList.of()),
task.file().dataSequenceNumber());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ public static TableStatistics makeTableStatistics(
IcebergStatistics.Builder icebergStatisticsBuilder = new IcebergStatistics.Builder(columns, typeManager);
try (CloseableIterable<FileScanTask> fileScanTasks = tableScan.planFiles()) {
fileScanTasks.forEach(fileScanTask -> {
if (!pathDomain.isAll() && !pathDomain.includesNullableValue(utf8Slice(fileScanTask.file().path().toString()))) {
if (!pathDomain.isAll() && !pathDomain.includesNullableValue(utf8Slice(fileScanTask.file().location()))) {
return;
}
if (!fileModifiedTimeDomain.isAll()) {
long fileModifiedTime = getModificationTime(fileScanTask.file().path().toString(), fileSystem);
long fileModifiedTime = getModificationTime(fileScanTask.file().location(), fileSystem);
if (!fileModifiedTimeDomain.includesNullableValue(packDateTimeWithZone(fileModifiedTime, UTC_KEY))) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static DeleteFile fromIceberg(org.apache.iceberg.DeleteFile deleteFile)

return new DeleteFile(
deleteFile.content(),
deleteFile.path().toString(),
deleteFile.location(),
deleteFile.format(),
deleteFile.recordCount(),
deleteFile.fileSizeInBytes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private TableChangesSplit toSplit(AddedRowsScanTask task)
task.commitSnapshotId(),
DateTimeEncoding.packDateTimeWithZone(icebergTable.snapshot(task.commitSnapshotId()).timestampMillis(), UTC_KEY),
task.changeOrdinal(),
task.file().path().toString(),
task.file().location(),
task.start(),
task.length(),
task.file().fileSizeInBytes(),
Expand All @@ -164,7 +164,7 @@ private TableChangesSplit toSplit(DeletedDataFileScanTask task)
task.commitSnapshotId(),
DateTimeEncoding.packDateTimeWithZone(icebergTable.snapshot(task.commitSnapshotId()).timestampMillis(), UTC_KEY),
task.changeOrdinal(),
task.file().path().toString(),
task.file().location(),
task.start(),
task.length(),
task.file().fileSizeInBytes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public static void addFiles(ConnectorSession session, Table table, List<DataFile
try (CloseableIterable<FileScanTask> iterator = table.newScan().planFiles()) {
for (FileScanTask fileScanTask : iterator) {
DataFile dataFile = fileScanTask.file();
existingFilesBuilder.add(dataFile.path().toString());
existingFilesBuilder.add(dataFile.location());
}
}
catch (IOException e) {
Expand Down Expand Up @@ -312,8 +312,8 @@ public static void addFiles(ConnectorSession session, Table table, List<DataFile
log.debug("Append data %d data files", dataFiles.size());
AppendFiles appendFiles = isMergeManifestsOnWrite(session) ? transaction.newAppend() : transaction.newFastAppend();
for (DataFile dataFile : dataFiles) {
if (existingFiles.contains(dataFile.path().toString())) {
throw new TrinoException(ALREADY_EXISTS, "File already exists: " + dataFile.path());
if (existingFiles.contains(dataFile.location())) {
throw new TrinoException(ALREADY_EXISTS, "File already exists: " + dataFile.location());
}
appendFiles.appendFile(dataFile);
}
Expand Down

0 comments on commit a0e1ea3

Please sign in to comment.