Class Group.CombineFieldsByFields<InputT>

java.lang.Object
org.apache.beam.sdk.transforms.PTransform<PCollection<InputT>,PCollection<Row>>
org.apache.beam.sdk.schemas.transforms.Group.AggregateCombiner<InputT>
org.apache.beam.sdk.schemas.transforms.Group.CombineFieldsByFields<InputT>
All Implemented Interfaces:
Serializable, HasDisplayData
Enclosing class:
Group

public abstract static class Group.CombineFieldsByFields<InputT> extends Group.AggregateCombiner<InputT>
a PTransform that does a per-key combine using an aggregation built up by calls to aggregateField and aggregateFields. The output of this transform will have a schema that is determined by the output types of all the composed combiners.
See Also:
  • Constructor Details

    • CombineFieldsByFields

      public CombineFieldsByFields()
  • Method Details

    • withKeyField

      public Group.CombineFieldsByFields<InputT> withKeyField(String keyField)
      Set the name of the key field in the resulting schema.
    • witValueField

      public Group.CombineFieldsByFields<InputT> witValueField(String valueField)
      Set the name of the value field in the resulting schema.
    • withPrecombining

      public Group.CombineFieldsByFields<InputT> withPrecombining(boolean value)
      Enable precombining.

      This is on by default. In certain cases (e.g. if there are many unique field values and the combiner's intermediate state is larger than the average row size) precombining makes things worse, in which case it can be turned off.

    • withHotKeyFanout

      public Group.CombineFieldsByFields<InputT> withHotKeyFanout(int n)
    • withHotKeyFanout

    • aggregateField

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateField(String inputFieldName, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, String outputFieldName)
      Build up an aggregation function over the input elements.

      This method specifies an aggregation over single field of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

      Field types in the output schema will be inferred from the provided combine function. Sometimes the field type cannot be inferred due to Java's type erasure. In that case, use the overload that allows setting the output field type explicitly.

    • aggregateFieldBaseValue

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFieldBaseValue(String inputFieldName, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, String outputFieldName)
    • aggregateField

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateField(int inputFieldId, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, String outputFieldName)
    • aggregateFieldBaseValue

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFieldBaseValue(int inputFieldId, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, String outputFieldName)
    • aggregateField

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateField(String inputFieldName, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, Schema.Field outputField)
      Build up an aggregation function over the input elements.

      This method specifies an aggregation over single field of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

      Specified by:
      aggregateField in class Group.AggregateCombiner<InputT>
    • aggregateFieldBaseValue

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFieldBaseValue(String inputFieldName, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, Schema.Field outputField)
    • aggregateField

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateField(int inputFieldId, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, Schema.Field outputField)
      Description copied from class: Group.AggregateCombiner
      Build up an aggregation function over the input elements.

      This method specifies an aggregation over single field of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

      Specified by:
      aggregateField in class Group.AggregateCombiner<InputT>
    • aggregateFieldBaseValue

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFieldBaseValue(int inputFieldId, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, Schema.Field outputField)
    • aggregateFields

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFields(List<String> inputFieldNames, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, String outputFieldName)
      Build up an aggregation function over the input elements.

      This method specifies an aggregation over multiple fields of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

      Field types in the output schema will be inferred from the provided combine function. Sometimes the field type cannot be inferred due to Java's type erasure. In that case, use the overload that allows setting the output field type explicitly.

    • aggregateFields

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFields(FieldAccessDescriptor fieldsToAggregate, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, String outputFieldName)
      Build up an aggregation function over the input elements.

      This method specifies an aggregation over multiple fields of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

      Field types in the output schema will be inferred from the provided combine function. Sometimes the field type cannot be inferred due to Java's type erasure. In that case, use the overload that allows setting the output field type explicitly.

    • aggregateFields

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFields(List<String> inputFieldNames, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, Schema.Field outputField)
      Build up an aggregation function over the input elements.

      This method specifies an aggregation over multiple fields of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

    • aggregateFieldsById

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFieldsById(List<Integer> inputFieldIds, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, Schema.Field outputField)
      Description copied from class: Group.AggregateCombiner
      Build up an aggregation function over the input elements by field id.

      This method specifies an aggregation over multiple fields of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

      Field types in the output schema will be inferred from the provided combine function. Sometimes the field type cannot be inferred due to Java's type erasure. In that case, use the overload that allows setting the output field type explicitly.

      Specified by:
      aggregateFieldsById in class Group.AggregateCombiner<InputT>
    • aggregateFields

      public <CombineInputT, AccumT, CombineOutputT> Group.CombineFieldsByFields<InputT> aggregateFields(FieldAccessDescriptor fieldsToAggregate, Combine.CombineFn<CombineInputT,AccumT,CombineOutputT> fn, Schema.Field outputField)
      Build up an aggregation function over the input elements.

      This method specifies an aggregation over multiple fields of the input. The union of all calls to aggregateField and aggregateFields will determine the output schema.

    • expand

      public PCollection<Row> expand(PCollection<InputT> input)
      Description copied from class: PTransform
      Override this method to specify how this PTransform should be expanded on the given InputT.

      NOTE: This method should not be called directly. Instead apply the PTransform should be applied to the InputT using the apply 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 class PTransform<PCollection<InputT>,PCollection<Row>>