|Constructor and Description|
|Modifier and Type||Method and Description|
Override this method to specify how this
Sets a policy for naming deeply-nested fields.
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate
public Unnest.Inner<T> withFieldNameFunction(SerializableFunction<java.util.List<java.lang.String>,java.lang.String> fn)
This is needed to prevent name collisions when differently-nested fields have the same
name. The default is to use the
Unnest.CONCAT_FIELD_NAMES strategy that concatenates all
names in the path to generate the unnested name. For example, an unnested name might be
field1_field2_field3. In some cases the
Unnest.KEEP_NESTED_NAME strategy can be used to
keep only the most-deeply nested name. However if this results in conflicting names (e.g. if
a schema has two subrows that each have the same schema this will happen), the pipeline will
fail at construction time.
An example of using this function to customize the separator character:
pc.apply(Unnest.<Type>create().withFieldNameFunction(l -> Strings.join("+", l)));
public PCollection<Row> expand(PCollection<T> input)
PTransformshould be expanded on the given
NOTE: This method should not be called directly. Instead apply the
be applied to the
InputT using the
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).