Skip to content

Commit

Permalink
Track INPUT_FILE_LAST_MODIFIED operations in TrackingFileSystemFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
jkylling authored and findepi committed Oct 16, 2023
1 parent 4f3efb7 commit b7d7ba8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -251,6 +253,7 @@ public boolean exists()
public Instant lastModified()
throws IOException
{
tracker.accept(INPUT_FILE_LAST_MODIFIED);
return delegate.lastModified();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b7d7ba8

Please sign in to comment.