Class TFRecordIO.Write
- All Implemented Interfaces:
Serializable,HasDisplayData
- Enclosing class:
TFRecordIO
TFRecordIO.write().- See Also:
-
Field Summary
Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexpand(PCollection<byte[]> input) Override this method to specify how thisPTransformshould be expanded on the givenInputT.voidpopulateDisplayData(DisplayData.Builder builder) Register display data for the given transform or component.Writes TFRecord file(s) with the given output prefix.to(ResourceId outputResource) Writes TFRecord file(s) with a prefix given by the specified resource.toResource(ValueProvider<ResourceId> outputResource) Liketo(ResourceId).withCompression(Compression compression) Writes to output files using the specified compression type.withCompressionType(TFRecordIO.CompressionType compressionType) Deprecated.withMaxNumWritersPerBundle(@Nullable Integer maxNumWritersPerBundle) See.invalid reference
WriteFiles#withMaxNumWritersPerBundle()withNumShards(int numShards) Writes to the provided number of shards.Forces a single file as output.withShardNameTemplate(String shardTemplate) Uses the given shard name template.withSuffix(String suffix) Writes to the file(s) with the given filename suffix.Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, toString, validate, validate
-
Constructor Details
-
Write
public Write()
-
-
Method Details
-
to
Writes TFRecord file(s) with the given output prefix. Theprefixwill be used as a to generate aResourceIdusing any supportedFileSystem.In addition to their prefix, created files will have a shard identifier (see
withNumShards(int)), and end in a common suffix, if given bywithSuffix(String).For more information on filenames, see
DefaultFilenamePolicy. -
to
Writes TFRecord file(s) with a prefix given by the specified resource.In addition to their prefix, created files will have a shard identifier (see
withNumShards(int)), and end in a common suffix, if given bywithSuffix(String).For more information on filenames, see
DefaultFilenamePolicy. -
toResource
Liketo(ResourceId). -
withSuffix
Writes to the file(s) with the given filename suffix.- See Also:
-
withNumShards
Writes to the provided number of shards.Constraining the number of shards is likely to reduce the performance of a pipeline. Setting this value is not recommended unless you require a specific number of output files.
- Parameters:
numShards- the number of shards to use, or 0 to let the system decide.- See Also:
-
withShardNameTemplate
Uses the given shard name template.- See Also:
-
withoutSharding
Forces a single file as output.Constraining the number of shards is likely to reduce the performance of a pipeline. Using this setting is not recommended unless you truly require a single output file.
This is a shortcut for
.withNumShards(1).withShardNameTemplate("") -
withCompressionType
Deprecated. -
withCompression
Writes to output files using the specified compression type.If no compression type is specified, the default is
Compression.UNCOMPRESSED. SeeTFRecordIO.Read.withCompression(org.apache.beam.sdk.io.Compression)for more details. -
withNoSpilling
-
withMaxNumWritersPerBundle
See.invalid reference
WriteFiles#withMaxNumWritersPerBundle() -
expand
Description copied from class:PTransformOverride this method to specify how thisPTransformshould be expanded on the givenInputT.NOTE: This method should not be called directly. Instead apply the
PTransformshould be applied to theInputTusing theapplymethod.Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
- Specified by:
expandin classPTransform<PCollection<byte[]>,PDone>
-
populateDisplayData
Description copied from class:PTransformRegister display data for the given transform or component.populateDisplayData(DisplayData.Builder)is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData). Implementations may callsuper.populateDisplayData(builder)in order to register display data in the current namespace, but should otherwise usesubcomponent.populateDisplayData(builder)to use the namespace of the subcomponent.By default, does not register any display data. Implementors may override this method to provide their own display data.
- Specified by:
populateDisplayDatain interfaceHasDisplayData- Overrides:
populateDisplayDatain classPTransform<PCollection<byte[]>,PDone> - Parameters:
builder- The builder to populate with display data.- See Also:
-
withCompression(org.apache.beam.sdk.io.Compression).