Use Case: I have to filter files based on the lastModifiedTime using Apache beam (Java)
My Code:
PCollection<String> readfile = pipeline
.apply(FileIO.match().filepattern(path)
.continuously(Duration.standardSeconds(30), Watch.Growth.never()))
.setCoder(MetadataCoderV2.of())
.apply(Filter.by(metadata -> {
System.out.println("metadata: " + metadata.toString());
return (metadata.lastModifiedMillis()) > current;}))
.apply(FileIO.readMatches())
.apply(TextIO.readFiles());
Problem: Even though I am using the MetadataCoderV2 coder, getting default value (0) for metadata.lastModifiedMillis() as below
Metadata{resourceId="fileName", sizeBytes=108, isReadSeekEfficient=true, lastModifiedMillis=0}
can anyone please suggest how to resolve this issue.