public abstract static class MatchResult.Metadata
extends java.lang.Object
implements java.io.Serializable
MatchResult.Metadata
of a matched file.Modifier and Type | Class and Description |
---|---|
static class |
MatchResult.Metadata.Builder
Builder class for
MatchResult.Metadata . |
Constructor and Description |
---|
Metadata() |
Modifier and Type | Method and Description |
---|---|
static MatchResult.Metadata.Builder |
builder() |
abstract boolean |
isReadSeekEfficient() |
abstract long |
lastModifiedMillis()
Last modification timestamp in milliseconds since Unix epoch.
|
abstract ResourceId |
resourceId() |
abstract long |
sizeBytes() |
public abstract ResourceId resourceId()
public abstract long sizeBytes()
public abstract boolean isReadSeekEfficient()
@Experimental(value=FILESYSTEM) public abstract long lastModifiedMillis()
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())));
public static MatchResult.Metadata.Builder builder()