Tabnine Logo
Combine$CombineFn.extractOutput
Code IndexAdd Tabnine to your IDE (free)

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

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

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

@Override
public CoCombineResult extractOutput(Object[] accumulator) {
 Map<TupleTag<?>, Object> valuesMap = Maps.newHashMap();
 for (int i = 0; i < combineFnCount; ++i) {
  valuesMap.put(outputTags.get(i), combineFns.get(i).extractOutput(accumulator[i]));
 }
 return new CoCombineResult(valuesMap);
}
origin: org.apache.beam/beam-sdks-java-core

private static <InputT, AccumT, OutputT> void checkCombineFnShardsWithEmptyAccumulators(
  CombineFn<InputT, AccumT, OutputT> fn,
  Iterable<? extends Iterable<InputT>> shards,
  Matcher<? super OutputT> matcher) {
 List<AccumT> accumulators = combineInputs(fn, shards);
 accumulators.add(0, fn.createAccumulator());
 accumulators.add(fn.createAccumulator());
 AccumT merged = fn.mergeAccumulators(accumulators);
 assertThat(fn.extractOutput(merged), matcher);
}
origin: org.apache.beam/beam-runners-core-java

@Override
public OutputT read() {
 return combineFn.extractOutput(
   combineFn.mergeAccumulators(Arrays.asList(combineFn.createAccumulator(), accum)));
}
origin: org.apache.beam/beam-runners-direct-java

@Override
public void processElement(WindowedValue<KV<K, Iterable<AccumT>>> element) throws Exception {
 checkState(
   element.getWindows().size() == 1,
   "Expected inputs to %s to be in exactly one window. Got %s",
   MergeAccumulatorsAndExtractOutputEvaluator.class.getSimpleName(),
   element.getWindows().size());
 Iterable<AccumT> inputAccumulators = element.getValue().getValue();
 try {
  AccumT first = combineFn.createAccumulator();
  AccumT merged =
    combineFn.mergeAccumulators(
      Iterables.concat(
        Collections.singleton(first),
        inputAccumulators,
        Collections.singleton(combineFn.createAccumulator())));
  OutputT extracted = combineFn.extractOutput(merged);
  output.add(element.withValue(KV.of(element.getValue().getKey(), extracted)));
 } catch (Exception e) {
  throw UserCodeException.wrap(e);
 }
}
origin: org.apache.beam/beam-runners-flink_2.10

@Override
public OutputT read() {
 try {
  org.apache.flink.api.common.state.ValueState<AccumT> state =
    flinkStateBackend.getPartitionedState(
      namespace.stringKey(),
      StringSerializer.INSTANCE,
      flinkStateDescriptor);
  AccumT accum = state.value();
  if (accum != null) {
   return combineFn.extractOutput(accum);
  } else {
   return combineFn.extractOutput(combineFn.createAccumulator());
  }
 } catch (Exception e) {
  throw new RuntimeException("Error reading state.", e);
 }
}
origin: org.apache.beam/beam-sdks-java-core

private static <InputT, AccumT, OutputT> void checkCombineFnShardsIncrementalMerging(
  CombineFn<InputT, AccumT, OutputT> fn,
  List<? extends Iterable<InputT>> shards,
  Matcher<? super OutputT> matcher) {
 AccumT accumulator = shards.isEmpty() ? fn.createAccumulator() : null;
 for (AccumT inputAccum : combineInputs(fn, shards)) {
  if (accumulator == null) {
   accumulator = inputAccum;
  } else {
   accumulator = fn.mergeAccumulators(Arrays.asList(accumulator, inputAccum));
  }
  fn.extractOutput(accumulator); // Extract output to simulate multiple firings
 }
 assertThat(fn.extractOutput(accumulator), matcher);
}
origin: org.apache.beam/beam-runners-flink

@Override
public OutputT read() {
 try {
  org.apache.flink.api.common.state.ValueState<AccumT> state =
    flinkStateBackend.getPartitionedState(
      namespace.stringKey(), StringSerializer.INSTANCE, flinkStateDescriptor);
  AccumT accum = state.value();
  if (accum != null) {
   return combineFn.extractOutput(accum);
  } else {
   return combineFn.extractOutput(combineFn.createAccumulator());
  }
 } catch (Exception e) {
  throw new RuntimeException("Error reading state.", e);
 }
}
origin: org.apache.beam/beam-runners-flink_2.11

@Override
public OutputT read() {
 try {
  org.apache.flink.api.common.state.ValueState<AccumT> state =
    flinkStateBackend.getPartitionedState(
      namespace.stringKey(), StringSerializer.INSTANCE, flinkStateDescriptor);
  AccumT accum = state.value();
  if (accum != null) {
   return combineFn.extractOutput(accum);
  } else {
   return combineFn.extractOutput(combineFn.createAccumulator());
  }
 } catch (Exception e) {
  throw new RuntimeException("Error reading 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 OutputT extractOutput(AccumT accumulator) {
 return fn.extractOutput(accumulator);
}
origin: org.apache.beam/beam-sdks-java-core

@Override
public OutputT extractOutput(AccumT accumulator, Context c) {
 return combineFn.extractOutput(accumulator);
}
origin: org.apache.beam/beam-sdks-java-extensions-sql

@Override
public Object extractOutput(Object accumulator) {
 return combineFn.extractOutput(accumulator);
}
origin: org.apache.beam/beam-sdks-java-core

/**
 * {@inheritDoc}
 *
 * <p>By default returns the extract output of an empty accumulator.
 */
@Override
public OutputT defaultValue() {
 return extractOutput(createAccumulator());
}
origin: org.apache.beam/beam-sdks-java-core

private static <InputT, AccumT, OutputT> void checkCombineFnShardsSingleMerge(
  CombineFn<InputT, AccumT, OutputT> fn,
  Iterable<? extends Iterable<InputT>> shards,
  Matcher<? super OutputT> matcher) {
 List<AccumT> accumulators = combineInputs(fn, shards);
 AccumT merged = fn.mergeAccumulators(accumulators);
 assertThat(fn.extractOutput(merged), matcher);
}
origin: org.apache.beam/beam-runners-core-java

@Override
public OutputT extractOutput(
  AccumT accumulator,
  PipelineOptions options,
  SideInputReader sideInputReader,
  Collection<? extends BoundedWindow> windows) {
 return combineFn.extractOutput(accumulator);
}
org.apache.beam.sdk.transformsCombine$CombineFnextractOutput

Javadoc

Returns the output value that is the result of combining all the input values represented by the given accumulator.

Popular methods of Combine$CombineFn

  • getAccumulatorCoder
  • addInput
    Adds the given input value to the given accumulator, returning the new accumulator value.For efficie
  • createAccumulator
    Returns a new, mutable accumulator value, representing the accumulation of zero input values.
  • 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

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top Vim 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