Class MatchResult.Metadata

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    MatchResult

    public abstract static class MatchResult.Metadata
    extends java.lang.Object
    implements java.io.Serializable
    MatchResult.Metadata of a matched file.
    See Also:
    Serialized Form
    • Constructor Detail

      • Metadata

        public Metadata()
    • Method Detail

      • resourceId

        public abstract ResourceId resourceId()
      • sizeBytes

        public abstract long sizeBytes()
      • isReadSeekEfficient

        public abstract boolean isReadSeekEfficient()
      • checksum

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

        @Experimental(FILESYSTEM)
        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())));