public final class ToString
extends java.lang.Object
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
SerializableFunction
using MapElements.via(SerializableFunction)
Modifier and Type | Method and 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 input
PCollection to a String
using the Object.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 input
PCollection to a String using
the Object.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 input
PCollection to a String by using the
Object.toString() on the key followed by a "," followed by the Object.toString()
of the value. |
static PTransform<PCollection<? extends KV<?,?>>,PCollection<java.lang.String>> |
kvs(java.lang.String delimiter)
Transforms each element of the input
PCollection to a String by using the
Object.toString() on the key followed by the specified delimiter followed by the Object.toString() of the value. |
public static PTransform<PCollection<?>,PCollection<java.lang.String>> elements()
public static PTransform<PCollection<? extends KV<?,?>>,PCollection<java.lang.String>> kvs()
PCollection
to a String
by using the
Object.toString()
on the key followed by a "," followed by the Object.toString()
of the value.public static PTransform<PCollection<? extends KV<?,?>>,PCollection<java.lang.String>> kvs(java.lang.String delimiter)
PCollection
to a String
by using the
Object.toString()
on the key followed by the specified delimiter followed by the Object.toString()
of the value.delimiter
- The delimiter to put between the key and valuepublic static PTransform<PCollection<? extends java.lang.Iterable<?>>,PCollection<java.lang.String>> iterables()
PCollection
to a String
using the Object.toString()
method followed by a "," until
the last element in the iterable. There is no trailing delimiter.public static PTransform<PCollection<? extends java.lang.Iterable<?>>,PCollection<java.lang.String>> iterables(java.lang.String delimiter)
PCollection
to a String
using
the Object.toString()
method followed by the specified delimiter until the last element
in the iterable. There is no trailing delimiter.delimiter
- The delimiter to put between the items in the iterable.