Class HadoopFormatIO.Read<K,V>
java.lang.Object
org.apache.beam.sdk.transforms.PTransform<PBegin,PCollection<KV<K,V>>>
org.apache.beam.sdk.io.hadoop.format.HadoopFormatIO.Read<K,V>
- Type Parameters:
K
- Type of keys to be read.V
- Type of values to be read.
- All Implemented Interfaces:
Serializable
,HasDisplayData
- Enclosing class:
HadoopFormatIO
public abstract static class HadoopFormatIO.Read<K,V>
extends PTransform<PBegin,PCollection<KV<K,V>>>
A
PTransform
that reads from any data source which implements Hadoop InputFormat. For
e.g. Cassandra, Elasticsearch, HBase, Redis, Postgres, etc. See the class-level Javadoc on
HadoopFormatIO
for more information.- 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 TypeMethodDescriptionPCollection
<KV<K, V>> Override this method to specify how thisPTransform
should be expanded on the givenInputT
.abstract @Nullable SerializableConfiguration
<T> Coder
<T> getDefaultCoder
(TypeDescriptor<?> typeDesc, CoderRegistry coderRegistry) Returns the default coder for a given type descriptor.abstract @Nullable TypeDescriptor
<?> abstract @Nullable TypeDescriptor
<?> abstract @Nullable TypeDescriptor
<?> abstract @Nullable SimpleFunction
<?, K> abstract @Nullable TypeDescriptor
<K> abstract @Nullable SimpleFunction
<?, V> abstract @Nullable TypeDescriptor
<V> void
Validates construction of this transform.withConfiguration
(org.apache.hadoop.conf.Configuration configuration) Reads from the source using the options provided by the given configuration.withKeyTranslation
(SimpleFunction<?, K> function) Transforms the keys read from the source using the given key translation function.withKeyTranslation
(SimpleFunction<?, K> function, Coder<K> coder) Transforms the keys read from the source using the given key translation function.withSkipKeyClone
(boolean value) Determines if key clone should be skipped or not (default is 'false').withSkipValueClone
(boolean value) Determines if value clone should be skipped or not (default is 'false').withValueTranslation
(SimpleFunction<?, V> function) Transforms the values read from the source using the given value translation function.withValueTranslation
(SimpleFunction<?, V> function, Coder<V> coder) Transforms the values read from the source using the given value translation function.Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
-
Constructor Details
-
Read
public Read()
-
-
Method Details
-
getConfiguration
-
getKeyTranslationFunction
-
getValueTranslationFunction
-
getKeyTypeDescriptor
-
getKeyCoder
-
getValueTypeDescriptor
-
getValueCoder
-
getSkipKeyClone
-
getSkipValueClone
-
getinputFormatClass
-
getinputFormatKeyClass
-
getinputFormatValueClass
-
toBuilder
-
withConfiguration
public HadoopFormatIO.Read<K,V> withConfiguration(org.apache.hadoop.conf.Configuration configuration) Reads from the source using the options provided by the given configuration. -
withKeyTranslation
Transforms the keys read from the source using the given key translation function. -
withKeyTranslation
Transforms the keys read from the source using the given key translation function. -
withValueTranslation
Transforms the values read from the source using the given value translation function. -
withValueTranslation
Transforms the values read from the source using the given value translation function. -
withSkipKeyClone
Determines if key clone should be skipped or not (default is 'false'). -
withSkipValueClone
Determines if value clone should be skipped or not (default is 'false'). -
expand
Description copied from class:PTransform
Override this method to specify how thisPTransform
should be expanded on the givenInputT
.NOTE: This method should not be called directly. Instead apply the
PTransform
should be applied to theInputT
using theapply
method.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:
expand
in classPTransform<PBegin,
PCollection<KV<K, V>>>
-
validateTransform
public void validateTransform()Validates construction of this transform. -
getDefaultCoder
Returns the default coder for a given type descriptor. Coder Registry is queried for correct coder, if not found in Coder Registry, then check if the type descriptor provided is of type Writable, then WritableCoder is returned, else exception is thrown "Cannot find coder".
-