Google Cloud Dataflow SDK for Java, version 1.9.1
Class TextIO.Read.Bound<T>
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.transforms.PTransform<PInput,PCollection<T>>
-
- com.google.cloud.dataflow.sdk.io.TextIO.Read.Bound<T>
-
- Type Parameters:
T
- the type of each of the elements of the resultingPCollection
. By default, each line is returned as aString
, however you may usewithCoder(Coder)
to supply aCoder<T>
to produce aPCollection<T>
instead.
- All Implemented Interfaces:
- HasDisplayData, Serializable
- Enclosing class:
- TextIO.Read
public static class TextIO.Read.Bound<T> extends PTransform<PInput,PCollection<T>>
APTransform
that reads from one or more text files and returns a boundedPCollection
containing one element for each line of the input files.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
name
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PCollection<T>
apply(PInput input)
Applies thisPTransform
on the givenInputT
, and returns itsOutput
.TextIO.Read.Bound<T>
from(String filepattern)
Returns a new transform for reading from text files that's like this one but that reads from the file(s) with the given name or pattern.TextIO.Read.Bound<T>
from(ValueProvider<String> filepattern)
Same asfrom(filepattern)
, but accepting aValueProvider
.TextIO.CompressionType
getCompressionType()
protected Coder<T>
getDefaultOutputCoder()
Returns the defaultCoder
to use for the output of this single-outputPTransform
.String
getFilepattern()
protected FileBasedSource<T>
getSource()
TextIO.Read.Bound<T>
named(String name)
Returns a new transform for reading from text files that's like this one but with the given step name.boolean
needsValidation()
void
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.<X> TextIO.Read.Bound<X>
withCoder(Coder<X> coder)
Returns a new transform for reading from text files that's like this one but that uses the givenCoder
to decode each of the lines of the file into a value of typeX
.TextIO.Read.Bound<T>
withCompressionType(TextIO.CompressionType compressionType)
Returns a new transform for reading from text files that's like this one but reads from input sources using the specified compression type.TextIO.Read.Bound<T>
withoutValidation()
Returns a new transform for reading from text files that's like this one but that has GCS path validation on pipeline creation disabled.-
Methods inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, toString, validate
-
-
-
-
Method Detail
-
named
public TextIO.Read.Bound<T> named(String name)
Returns a new transform for reading from text files that's like this one but with the given step name.Does not modify this object.
-
from
public TextIO.Read.Bound<T> from(String filepattern)
Returns a new transform for reading from text files that's like this one but that reads from the file(s) with the given name or pattern. SeeTextIO.Read.from(java.lang.String)
for a description of filepatterns.Does not modify this object.
-
from
public TextIO.Read.Bound<T> from(ValueProvider<String> filepattern)
Same asfrom(filepattern)
, but accepting aValueProvider
.
-
withCoder
public <X> TextIO.Read.Bound<X> withCoder(Coder<X> coder)
Returns a new transform for reading from text files that's like this one but that uses the givenCoder
to decode each of the lines of the file into a value of typeX
.Does not modify this object.
- Type Parameters:
X
- the type of the decoded elements, and the elements of the resulting PCollection
-
withoutValidation
public TextIO.Read.Bound<T> withoutValidation()
Returns a new transform for reading from text files that's like this one but that has GCS path validation on pipeline creation disabled.This can be useful in the case where the GCS input does not exist at the pipeline creation time, but is expected to be available at execution time.
Does not modify this object.
-
withCompressionType
public TextIO.Read.Bound<T> withCompressionType(TextIO.CompressionType compressionType)
Returns a new transform for reading from text files that's like this one but reads from input sources using the specified compression type.If no compression type is specified, the default is
TextIO.CompressionType.AUTO
. SeeTextIO.Read.withCompressionType(com.google.cloud.dataflow.sdk.io.TextIO.CompressionType)
for more details.Does not modify this object.
-
apply
public PCollection<T> apply(PInput input)
Description copied from class:PTransform
Applies thisPTransform
on the givenInputT
, and returns itsOutput
.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).
The default implementation throws an exception. A derived class must either implement apply, or else each runner must supply a custom implementation via
PipelineRunner.apply(com.google.cloud.dataflow.sdk.transforms.PTransform<InputT, OutputT>, InputT)
.- Overrides:
apply
in classPTransform<PInput,PCollection<T>>
-
getSource
protected FileBasedSource<T> getSource()
-
populateDisplayData
public void populateDisplayData(DisplayData.Builder builder)
Description copied from class:PTransform
Register 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:
populateDisplayData
in interfaceHasDisplayData
- Overrides:
populateDisplayData
in classPTransform<PInput,PCollection<T>>
- Parameters:
builder
- The builder to populate with display data.- See Also:
HasDisplayData
-
getDefaultOutputCoder
protected Coder<T> getDefaultOutputCoder()
Description copied from class:PTransform
Returns the defaultCoder
to use for the output of this single-outputPTransform
.By default, always throws
- Overrides:
getDefaultOutputCoder
in classPTransform<PInput,PCollection<T>>
-
getFilepattern
public String getFilepattern()
-
needsValidation
public boolean needsValidation()
-
getCompressionType
public TextIO.CompressionType getCompressionType()
-
-