Package org.apache.beam.sdk.transforms
Class ToString
- java.lang.Object
-
- org.apache.beam.sdk.transforms.ToString
-
public final class ToString extends java.lang.Object
PTransforms
for converting aPCollection<?>
,PCollection<KV<?,?>>
, orPCollection<Iterable<?>>
to aPCollection<String>
.Note: For any custom string conversion and formatting, we recommend applying your own
ProcessFunction
usingMapElements.via(ProcessFunction)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PTransform<PCollection<?>,PCollection<java.lang.String>>
elements()
static PTransform<PCollection<? extends java.lang.Iterable<?>>,PCollection<java.lang.String>>
iterables()
Transforms each item in the iterable of the inputPCollection
to aString
using theObject.toString()
method followed by a "," until the last element in the iterable.static PTransform<PCollection<? extends java.lang.Iterable<?>>,PCollection<java.lang.String>>
iterables(java.lang.String delimiter)
Transforms each item in the iterable of the inputPCollection
to aString
using theObject.toString()
method followed by the specified delimiter until the last element in the iterable.static PTransform<PCollection<? extends KV<?,?>>,PCollection<java.lang.String>>
kvs()
Transforms each element of the inputPCollection
to aString
by using theObject.toString()
on the key followed by a "," followed by theObject.toString()
of the value.static PTransform<PCollection<? extends KV<?,?>>,PCollection<java.lang.String>>
kvs(java.lang.String delimiter)
Transforms each element of the inputPCollection
to aString
by using theObject.toString()
on the key followed by the specified delimiter followed by theObject.toString()
of the value.
-
-
-
Method Detail
-
elements
public static PTransform<PCollection<?>,PCollection<java.lang.String>> elements()
-
kvs
public static PTransform<PCollection<? extends KV<?,?>>,PCollection<java.lang.String>> kvs()
Transforms each element of the inputPCollection
to aString
by using theObject.toString()
on the key followed by a "," followed by theObject.toString()
of the value.
-
kvs
public static PTransform<PCollection<? extends KV<?,?>>,PCollection<java.lang.String>> kvs(java.lang.String delimiter)
Transforms each element of the inputPCollection
to aString
by 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
public static PTransform<PCollection<? extends java.lang.Iterable<?>>,PCollection<java.lang.String>> iterables()
Transforms each item in the iterable of the inputPCollection
to aString
using theObject.toString()
method followed by a "," until the last element in the iterable. There is no trailing delimiter.
-
iterables
public static PTransform<PCollection<? extends java.lang.Iterable<?>>,PCollection<java.lang.String>> iterables(java.lang.String delimiter)
Transforms each item in the iterable of the inputPCollection
to aString
using 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.
-
-