From b7d7ba8eb9018b308994a55448be8e71915c371f Mon Sep 17 00:00:00 2001 From: Jonas Irgens Kylling Date: Sun, 15 Oct 2023 14:16:49 +0200 Subject: [PATCH] Track INPUT_FILE_LAST_MODIFIED operations in TrackingFileSystemFactory --- .../java/io/trino/filesystem/TrackingFileSystemFactory.java | 3 +++ .../plugin/iceberg/TestIcebergMetadataFileOperations.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/trino-filesystem/src/test/java/io/trino/filesystem/TrackingFileSystemFactory.java b/lib/trino-filesystem/src/test/java/io/trino/filesystem/TrackingFileSystemFactory.java index 965982ac53af..9bbb650414f6 100644 --- a/lib/trino-filesystem/src/test/java/io/trino/filesystem/TrackingFileSystemFactory.java +++ b/lib/trino-filesystem/src/test/java/io/trino/filesystem/TrackingFileSystemFactory.java @@ -32,6 +32,7 @@ import static com.google.common.base.Verify.verify; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.INPUT_FILE_EXISTS; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.INPUT_FILE_GET_LENGTH; +import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.INPUT_FILE_LAST_MODIFIED; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.INPUT_FILE_NEW_STREAM; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.OUTPUT_FILE_CREATE; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.OUTPUT_FILE_CREATE_EXCLUSIVE; @@ -50,6 +51,7 @@ public enum OperationType OUTPUT_FILE_CREATE_OR_OVERWRITE, OUTPUT_FILE_CREATE_EXCLUSIVE, OUTPUT_FILE_TO_INPUT_FILE, + INPUT_FILE_LAST_MODIFIED, } private final AtomicInteger fileId = new AtomicInteger(); @@ -251,6 +253,7 @@ public boolean exists() public Instant lastModified() throws IOException { + tracker.accept(INPUT_FILE_LAST_MODIFIED); return delegate.lastModified(); } diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMetadataFileOperations.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMetadataFileOperations.java index d60e5e906bb2..6f34f6eb0eb9 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMetadataFileOperations.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMetadataFileOperations.java @@ -40,6 +40,7 @@ import static com.google.inject.multibindings.OptionalBinder.newOptionalBinder; import static io.trino.SystemSessionProperties.MIN_INPUT_SIZE_PER_TASK; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.INPUT_FILE_GET_LENGTH; +import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.INPUT_FILE_LAST_MODIFIED; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.INPUT_FILE_NEW_STREAM; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.OUTPUT_FILE_CREATE; import static io.trino.filesystem.TrackingFileSystemFactory.OperationType.OUTPUT_FILE_CREATE_OR_OVERWRITE; @@ -276,6 +277,7 @@ public void testReadWholePartition() .add(new FileOperation(SNAPSHOT, INPUT_FILE_NEW_STREAM)) // TODO return synthetic columns without opening the data files .addCopies(new FileOperation(DATA, INPUT_FILE_NEW_STREAM), 4) + .addCopies(new FileOperation(DATA, INPUT_FILE_LAST_MODIFIED), 4) .build()); // Read only row count