Java Code Examples for org.apache.beam.sdk.transforms.display.DisplayData#ItemSpec

The following examples show how to use org.apache.beam.sdk.transforms.display.DisplayData#ItemSpec . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParDo.java    From beam with Apache License 2.0 6 votes vote down vote up
private static void populateDisplayData(
    DisplayData.Builder builder,
    DoFn<?, ?> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) {
  builder.include("fn", fn).add(fnDisplayData);
  for (DoFnSignature.StateDeclaration stateDeclaration :
      DoFnSignatures.signatureForDoFn(fn).stateDeclarations().values()) {
    try {
      StateSpec<?> stateSpec = (StateSpec<?>) stateDeclaration.field().get(fn);
      builder.add(
          DisplayData.item("state_" + stateDeclaration.id(), stateDescription(stateSpec))
              .withLabel("State \"" + stateDeclaration.id() + "\""));
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  }
}
 
Example 2
Source File: Combine.java    From beam with Apache License 2.0 5 votes vote down vote up
private Globally(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData,
    boolean insertDefault,
    int fanout,
    List<PCollectionView<?>> sideInputs) {
  this.fn = fn;
  this.fnDisplayData = fnDisplayData;
  this.insertDefault = insertDefault;
  this.fanout = fanout;
  this.sideInputs = sideInputs;
}
 
Example 3
Source File: Combine.java    From beam with Apache License 2.0 5 votes vote down vote up
private GloballyAsSingletonView(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData,
    boolean insertDefault,
    int fanout) {
  this.fn = fn;
  this.fnDisplayData = fnDisplayData;
  this.insertDefault = insertDefault;
  this.fanout = fanout;
}
 
Example 4
Source File: Combine.java    From beam with Apache License 2.0 5 votes vote down vote up
private PerKey(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData,
    boolean fewKeys) {
  this.fn = fn;
  this.fnDisplayData = fnDisplayData;
  this.fewKeys = fewKeys;
  this.sideInputs = ImmutableList.of();
}
 
Example 5
Source File: Combine.java    From beam with Apache License 2.0 5 votes vote down vote up
private PerKey(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData,
    boolean fewKeys,
    List<PCollectionView<?>> sideInputs) {
  this.fn = fn;
  this.fnDisplayData = fnDisplayData;
  this.fewKeys = fewKeys;
  this.sideInputs = sideInputs;
}
 
Example 6
Source File: Combine.java    From beam with Apache License 2.0 5 votes vote down vote up
private PerKeyWithHotKeyFanout(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData,
    SerializableFunction<? super K, Integer> hotKeyFanout) {
  this.fn = fn;
  this.fnDisplayData = fnDisplayData;
  this.hotKeyFanout = hotKeyFanout;
}
 
Example 7
Source File: Combine.java    From beam with Apache License 2.0 5 votes vote down vote up
private GroupedValues(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) {
  this.fn = SerializableUtils.clone(fn);
  this.fnDisplayData = fnDisplayData;
  this.sideInputs = ImmutableList.of();
}
 
Example 8
Source File: Combine.java    From beam with Apache License 2.0 5 votes vote down vote up
private GroupedValues(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData,
    List<PCollectionView<?>> sideInputs) {
  this.fn = SerializableUtils.clone(fn);
  this.fnDisplayData = fnDisplayData;
  this.sideInputs = sideInputs;
}
 
Example 9
Source File: ParDo.java    From beam with Apache License 2.0 5 votes vote down vote up
SingleOutput(
    DoFn<InputT, OutputT> fn,
    Map<String, PCollectionView<?>> sideInputs,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) {
  this.fn = fn;
  this.fnDisplayData = fnDisplayData;
  this.sideInputs = sideInputs;
}
 
Example 10
Source File: Combine.java    From beam with Apache License 2.0 4 votes vote down vote up
private static <T> DisplayData.ItemSpec<? extends Class<?>> displayDataForFn(T fn) {
  return DisplayData.item("combineFn", fn.getClass()).withLabel("Combiner");
}
 
Example 11
Source File: Combine.java    From beam with Apache License 2.0 4 votes vote down vote up
private static <InputT, OutputT> Globally<InputT, OutputT> globally(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) {
  return new Globally<>(fn, fnDisplayData, true, 0, ImmutableList.of());
}
 
Example 12
Source File: Combine.java    From beam with Apache License 2.0 4 votes vote down vote up
private static <K, InputT, OutputT> PerKey<K, InputT, OutputT> perKey(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) {
  return new PerKey<>(fn, fnDisplayData, false /*fewKeys*/);
}
 
Example 13
Source File: Combine.java    From beam with Apache License 2.0 4 votes vote down vote up
/** Returns a {@link PerKey Combine.PerKey}, and set fewKeys in {@link GroupByKey}. */
private static <K, InputT, OutputT> PerKey<K, InputT, OutputT> fewKeys(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) {
  return new PerKey<>(fn, fnDisplayData, true /*fewKeys*/);
}
 
Example 14
Source File: Combine.java    From beam with Apache License 2.0 4 votes vote down vote up
private static <K, InputT, OutputT> GroupedValues<K, InputT, OutputT> groupedValues(
    GlobalCombineFn<? super InputT, ?, OutputT> fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayData) {
  return new GroupedValues<>(fn, fnDisplayData);
}
 
Example 15
Source File: Combine.java    From beam with Apache License 2.0 4 votes vote down vote up
private static void populateDisplayData(
    DisplayData.Builder builder,
    HasDisplayData fn,
    DisplayData.ItemSpec<? extends Class<?>> fnDisplayItem) {
  builder.include("combineFn", fn).add(fnDisplayItem);
}
 
Example 16
Source File: ParDo.java    From beam with Apache License 2.0 4 votes vote down vote up
private static <T> DisplayData.ItemSpec<? extends Class<?>> displayDataForFn(T fn) {
  return DisplayData.item("fn", fn.getClass()).withLabel("Transform Function");
}