Class MatchResult.Metadata

java.lang.Object
org.apache.beam.sdk.io.fs.MatchResult.Metadata
All Implemented Interfaces:
Serializable
Enclosing class:
MatchResult

public abstract static class MatchResult.Metadata extends Object implements Serializable
MatchResult.Metadata of a matched file.
See Also:
  • Constructor Details

    • Metadata

      public Metadata()
  • Method Details

    • resourceId

      public abstract ResourceId resourceId()
    • sizeBytes

      public abstract long sizeBytes()
    • isReadSeekEfficient

      public abstract boolean isReadSeekEfficient()
    • checksum

      public abstract @Nullable String checksum()
      An optional checksum to identify the contents of a file.
    • lastModifiedMillis

      public abstract long lastModifiedMillis()
      Last modification timestamp in milliseconds since Unix epoch.

      Note that this field is not encoded with the default MetadataCoder due to a need for compatibility with previous versions of the Beam SDK. If you want to rely on lastModifiedMillis values, be sure to explicitly set the coder to MetadataCoderV2. Otherwise, all instances will have the default value of 0, consistent with the behavior of File.lastModified().

      The following example sets the coder explicitly and accesses lastModifiedMillis to set record timestamps:

      
       PCollection<Metadata> metadataWithTimestamp = p
           .apply(FileIO.match().filepattern("hdfs://path/to/*.gz"))
           .setCoder(MetadataCoderV2.of())
           .apply(WithTimestamps.of(metadata -> new Instant(metadata.lastModifiedMillis())));
       
    • builder

      public static MatchResult.Metadata.Builder builder()