Package org.apache.beam.sdk.transforms
Class ToString
java.lang.Object
org.apache.beam.sdk.transforms.ToString
PTransforms for converting a PCollection<?>, PCollection<KV<?,?>>, or PCollection<Iterable<?>> to a PCollection<String>.
Note: For any custom string conversion and formatting, we recommend applying your own
ProcessFunction using MapElements.via(ProcessFunction)
-
Method Summary
Modifier and TypeMethodDescriptionstatic PTransform<PCollection<?>, PCollection<String>> elements()static PTransform<PCollection<? extends Iterable<?>>, PCollection<String>> Transforms each item in the iterable of the inputPCollectionto aStringusing theObject.toString()method followed by a "," until the last element in the iterable.static PTransform<PCollection<? extends Iterable<?>>, PCollection<String>> Transforms each item in the iterable of the inputPCollectionto aStringusing theObject.toString()method followed by the specified delimiter until the last element in the iterable.static PTransform<PCollection<? extends KV<?, ?>>, PCollection<String>> kvs()Transforms each element of the inputPCollectionto aStringby using theObject.toString()on the key followed by a "," followed by theObject.toString()of the value.static PTransform<PCollection<? extends KV<?, ?>>, PCollection<String>> Transforms each element of the inputPCollectionto aStringby using theObject.toString()on the key followed by the specified delimiter followed by theObject.toString()of the value.
-
Method Details
-
elements
-
kvs
Transforms each element of the inputPCollectionto aStringby using theObject.toString()on the key followed by a "," followed by theObject.toString()of the value. -
kvs
Transforms each element of the inputPCollectionto aStringby using theObject.toString()on the key followed by the specified delimiter followed by theObject.toString()of the value.- Parameters:
delimiter- The delimiter to put between the key and value
-
iterables
Transforms each item in the iterable of the inputPCollectionto aStringusing theObject.toString()method followed by a "," until the last element in the iterable. There is no trailing delimiter. -
iterables
public static PTransform<PCollection<? extends Iterable<?>>,PCollection<String>> iterables(String delimiter) Transforms each item in the iterable of the inputPCollectionto aStringusing theObject.toString()method followed by the specified delimiter until the last element in the iterable. There is no trailing delimiter.- Parameters:
delimiter- The delimiter to put between the items in the iterable.
-