congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Combine$CombineFn.addInput
Code IndexAdd Tabnine to your IDE (free)

How to use
addInput
method
in
org.apache.beam.sdk.transforms.Combine$CombineFn

Best Java code snippets using org.apache.beam.sdk.transforms.Combine$CombineFn.addInput (Showing top 13 results out of 315)

origin: org.apache.beam/beam-sdks-java-core

@Override
public Object[] addInput(Object[] accumulator, DataT value) {
 for (int i = 0; i < combineFnCount; ++i) {
  Object input = extractInputFns.get(i).apply(value);
  accumulator[i] = combineFns.get(i).addInput(accumulator[i], input);
 }
 return accumulator;
}
origin: org.apache.beam/beam-sdks-java-core

private static <InputT, AccumT, OutputT> List<AccumT> combineInputs(
  CombineFn<InputT, AccumT, OutputT> fn, Iterable<? extends Iterable<InputT>> shards) {
 List<AccumT> accumulators = new ArrayList<>();
 int maybeCompact = 0;
 for (Iterable<InputT> shard : shards) {
  AccumT accumulator = fn.createAccumulator();
  for (InputT elem : shard) {
   accumulator = fn.addInput(accumulator, elem);
  }
  if (maybeCompact++ % 2 == 0) {
   accumulator = fn.compact(accumulator);
  }
  accumulators.add(accumulator);
 }
 return accumulators;
}
origin: org.apache.beam/beam-runners-direct-java

@ProcessElement
public void processElement(ProcessContext context, BoundedWindow window) {
 WindowedStructuralKey<K> key =
   WindowedStructuralKey.create(keyCoder, context.element().getKey(), window);
 AccumT accumulator = accumulators.get(key);
 Instant assignedTs = timestampCombiner.assign(window, context.timestamp());
 if (accumulator == null) {
  accumulator = combineFn.createAccumulator();
  accumulators.put(key, accumulator);
  timestamps.put(key, assignedTs);
 }
 accumulators.put(key, combineFn.addInput(accumulator, context.element().getValue()));
 timestamps.put(key, timestampCombiner.combine(assignedTs, timestamps.get(key)));
}
origin: org.apache.beam/beam-runners-flink_2.10

@Override
public void add(InputT value) {
 try {
  org.apache.flink.api.common.state.ValueState<AccumT> state =
    flinkStateBackend.getPartitionedState(
      namespace.stringKey(),
      StringSerializer.INSTANCE,
      flinkStateDescriptor);
  AccumT current = state.value();
  if (current == null) {
   current = combineFn.createAccumulator();
  }
  current = combineFn.addInput(current, value);
  state.update(current);
 } catch (Exception e) {
  throw new RuntimeException("Error adding to state." , e);
 }
}
origin: org.apache.beam/beam-runners-flink

@Override
public void add(InputT value) {
 try {
  org.apache.flink.api.common.state.ValueState<AccumT> state =
    flinkStateBackend.getPartitionedState(
      namespace.stringKey(), StringSerializer.INSTANCE, flinkStateDescriptor);
  AccumT current = state.value();
  if (current == null) {
   current = combineFn.createAccumulator();
  }
  current = combineFn.addInput(current, value);
  state.update(current);
 } catch (Exception e) {
  throw new RuntimeException("Error adding to state.", e);
 }
}
origin: org.apache.beam/beam-runners-flink_2.11

@Override
public void add(InputT value) {
 try {
  org.apache.flink.api.common.state.ValueState<AccumT> state =
    flinkStateBackend.getPartitionedState(
      namespace.stringKey(), StringSerializer.INSTANCE, flinkStateDescriptor);
  AccumT current = state.value();
  if (current == null) {
   current = combineFn.createAccumulator();
  }
  current = combineFn.addInput(current, value);
  state.update(current);
 } catch (Exception e) {
  throw new RuntimeException("Error adding to state.", e);
 }
}
origin: org.apache.beam/beam-sdks-java-core

/**
 * Applies this {@code CombineFn} to a collection of input values to produce a combined output
 * value.
 *
 * <p>Useful when using a {@code CombineFn} separately from a {@code Combine} transform. Does
 * not invoke the {@link #mergeAccumulators} operation.
 */
public OutputT apply(Iterable<? extends InputT> inputs) {
 AccumT accum = createAccumulator();
 for (InputT input : inputs) {
  accum = addInput(accum, input);
 }
 return extractOutput(accum);
}
origin: org.apache.beam/beam-sdks-java-core

@Override
public AccumT addInput(AccumT accumulator, InputT value) {
 return fn.addInput(accumulator, value);
}
origin: org.apache.beam/beam-runners-core-java

@Override
public AccumT addInput(
  AccumT accumulator,
  InputT input,
  PipelineOptions options,
  SideInputReader sideInputReader,
  Collection<? extends BoundedWindow> windows) {
 return combineFn.addInput(accumulator, input);
}
origin: org.apache.beam/beam-sdks-java-core

@Override
public AccumT addInput(AccumT accumulator, InputT input, Context c) {
 return combineFn.addInput(accumulator, input);
}
origin: org.apache.beam/beam-runners-core-java

@Override
public void add(InputT input) {
 isCleared = false;
 accum = combineFn.addInput(accum, input);
}
origin: org.apache.beam/beam-sdks-java-extensions-sql

@Override
public Object addInput(Object accumulator, T input) {
 T processedInput = getInput(input);
 return (processedInput == null)
   ? accumulator
   : combineFn.addInput(accumulator, getInput(input));
}
origin: org.apache.beam/beam-sdks-java-core

@Override
public AccumT addInput(AccumT accumulator, InputOrAccum<InputT, AccumT> value) {
 if (value.accum == null) {
  return fn.addInput(accumulator, value.input);
 } else {
  return fn.mergeAccumulators(ImmutableList.of(accumulator, value.accum));
 }
}
org.apache.beam.sdk.transformsCombine$CombineFnaddInput

Javadoc

Adds the given input value to the given accumulator, returning the new accumulator value.

For efficiency, the input accumulator may be modified and returned.

Popular methods of Combine$CombineFn

  • getAccumulatorCoder
  • createAccumulator
    Returns a new, mutable accumulator value, representing the accumulation of zero input values.
  • extractOutput
    Returns the output value that is the result of combining all the input values represented by the giv
  • mergeAccumulators
    Returns an accumulator representing the accumulation of all the input values accumulated in the merg
  • compact
    Returns an accumulator that represents the same logical value as the input accumulator, but may have
  • getOutputType
    Returns a TypeDescriptor capturing what is known statically about the output type of this CombineFn
  • apply
    Applies this CombineFn to a collection of input values to produce a combined output value.Useful whe
  • defaultValue
    By default returns the extract output of an empty accumulator.
  • getDefaultOutputCoder
  • getIncompatibleGlobalWindowErrorMessage
  • populateDisplayData
  • populateDisplayData

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now