From a0e1ea3ba7050e9e713a04da9e8167b3475d657d Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Mon, 2 Dec 2024 08:00:20 +0900 Subject: [PATCH] Replace deprecated path() with location() in ContentFile --- .../java/io/trino/plugin/iceberg/IcebergMetadata.java | 4 ++-- .../java/io/trino/plugin/iceberg/IcebergSplitSource.java | 8 ++++---- .../io/trino/plugin/iceberg/TableStatisticsReader.java | 4 ++-- .../java/io/trino/plugin/iceberg/delete/DeleteFile.java | 2 +- .../functions/tablechanges/TableChangesSplitSource.java | 4 ++-- .../io/trino/plugin/iceberg/procedure/MigrationUtils.java | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java index 426864b853f2..323e916e6116 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java @@ -1774,7 +1774,7 @@ private void finishOptimize(ConnectorSession session, IcebergTableExecuteHandle cleanExtraOutputFiles( session, newFiles.stream() - .map(dataFile -> dataFile.path().toString()) + .map(ContentFile::location) .collect(toImmutableSet())); } @@ -2004,7 +2004,7 @@ private void removeOrphanFiles(Table table, ConnectorSession session, SchemaTabl validMetadataFileNames.add(fileName(manifest.path())); try (ManifestReader> manifestReader = readerForManifest(table, manifest)) { for (ContentFile contentFile : manifestReader) { - validDataFileNames.add(fileName(contentFile.path().toString())); + validDataFileNames.add(fileName(contentFile.location())); } } catch (IOException e) { diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java index dbba7b735902..2dfd52c446a4 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java @@ -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; } @@ -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(), @@ -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()); } diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/TableStatisticsReader.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/TableStatisticsReader.java index 560689a1024e..feb8dbb50b8b 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/TableStatisticsReader.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/TableStatisticsReader.java @@ -157,11 +157,11 @@ public static TableStatistics makeTableStatistics( IcebergStatistics.Builder icebergStatisticsBuilder = new IcebergStatistics.Builder(columns, typeManager); try (CloseableIterable 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; } diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/delete/DeleteFile.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/delete/DeleteFile.java index 274aa1073b50..94e60363d4bb 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/delete/DeleteFile.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/delete/DeleteFile.java @@ -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(), diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/functions/tablechanges/TableChangesSplitSource.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/functions/tablechanges/TableChangesSplitSource.java index eff137667061..097c0d04919d 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/functions/tablechanges/TableChangesSplitSource.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/functions/tablechanges/TableChangesSplitSource.java @@ -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(), @@ -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(), diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/procedure/MigrationUtils.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/procedure/MigrationUtils.java index 16e170327b7d..4f325fab54e1 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/procedure/MigrationUtils.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/procedure/MigrationUtils.java @@ -280,7 +280,7 @@ public static void addFiles(ConnectorSession session, Table table, List iterator = table.newScan().planFiles()) { for (FileScanTask fileScanTask : iterator) { DataFile dataFile = fileScanTask.file(); - existingFilesBuilder.add(dataFile.path().toString()); + existingFilesBuilder.add(dataFile.location()); } } catch (IOException e) { @@ -312,8 +312,8 @@ public static void addFiles(ConnectorSession session, Table table, List