Tabnine Logo
WindowingStrategyTranslation.fromProto
Code IndexAdd Tabnine to your IDE (free)

How to use
fromProto
method
in
org.apache.beam.runners.core.construction.WindowingStrategyTranslation

Best Java code snippets using org.apache.beam.runners.core.construction.WindowingStrategyTranslation.fromProto (Showing top 13 results out of 315)

origin: org.apache.beam/beam-runners-core-construction-java

 @Override
 public WindowingStrategy<?, ?> load(String id) throws Exception {
  @Nullable
  RunnerApi.WindowingStrategy windowingStrategyProto =
    components.getWindowingStrategiesOrDefault(id, null);
  checkState(
    windowingStrategyProto != null,
    "No WindowingStrategy with id '%s' in serialized components",
    id);
  return WindowingStrategyTranslation.fromProto(
    windowingStrategyProto, RehydratedComponents.this);
 }
});
origin: org.apache.beam/beam-runners-core-construction-java

/**
 * Converts from a {@link RunnerApi.WindowingStrategy} accompanied by {@link Components} to the
 * SDK's {@link WindowingStrategy}.
 */
public static WindowingStrategy<?, ?> fromProto(RunnerApi.MessageWithComponents proto)
  throws InvalidProtocolBufferException {
 switch (proto.getRootCase()) {
  case WINDOWING_STRATEGY:
   return fromProto(
     proto.getWindowingStrategy(),
     RehydratedComponents.forComponents(proto.getComponents()));
  default:
   throw new IllegalArgumentException(
     String.format(
       "Expected a %s with components but received %s",
       RunnerApi.WindowingStrategy.class.getCanonicalName(), proto));
 }
}
origin: org.apache.beam/beam-runners-flink_2.11

 public static WindowingStrategy getWindowingStrategy(
   String pCollectionId, RunnerApi.Components components) {
  RunnerApi.WindowingStrategy windowingStrategyProto =
    components.getWindowingStrategiesOrThrow(
      components.getPcollectionsOrThrow(pCollectionId).getWindowingStrategyId());

  final WindowingStrategy<?, ?> windowingStrategy;
  try {
   return WindowingStrategyTranslation.fromProto(
     windowingStrategyProto, RehydratedComponents.forComponents(components));
  } catch (InvalidProtocolBufferException e) {
   throw new IllegalStateException(
     String.format(
       "Unable to hydrate windowing strategy %s for %s.",
       windowingStrategyProto, pCollectionId),
     e);
  }
 }
}
origin: org.apache.beam/beam-runners-flink

 public static WindowingStrategy getWindowingStrategy(
   String pCollectionId, RunnerApi.Components components) {
  RunnerApi.WindowingStrategy windowingStrategyProto =
    components.getWindowingStrategiesOrThrow(
      components.getPcollectionsOrThrow(pCollectionId).getWindowingStrategyId());

  final WindowingStrategy<?, ?> windowingStrategy;
  try {
   return WindowingStrategyTranslation.fromProto(
     windowingStrategyProto, RehydratedComponents.forComponents(components));
  } catch (InvalidProtocolBufferException e) {
   throw new IllegalStateException(
     String.format(
       "Unable to hydrate windowing strategy %s for %s.",
       windowingStrategyProto, pCollectionId),
     e);
  }
 }
}
origin: org.apache.beam/beam-runners-core-construction-java

/**
 * Converts from {@link RunnerApi.WindowingStrategy} to the SDK's {@link WindowingStrategy} using
 * the provided components to dereferences identifiers found in the proto.
 */
public static WindowingStrategy<?, ?> fromProto(
  RunnerApi.WindowingStrategy proto, RehydratedComponents components)
  throws InvalidProtocolBufferException {
 SdkFunctionSpec windowFnSpec = proto.getWindowFn();
 WindowFn<?, ?> windowFn = windowFnFromProto(windowFnSpec);
 TimestampCombiner timestampCombiner = timestampCombinerFromProto(proto.getOutputTime());
 AccumulationMode accumulationMode = fromProto(proto.getAccumulationMode());
 Trigger trigger = TriggerTranslation.fromProto(proto.getTrigger());
 ClosingBehavior closingBehavior = fromProto(proto.getClosingBehavior());
 Duration allowedLateness = Duration.millis(proto.getAllowedLateness());
 OnTimeBehavior onTimeBehavior = fromProto(proto.getOnTimeBehavior());
 return WindowingStrategy.of(windowFn)
   .withAllowedLateness(allowedLateness)
   .withMode(accumulationMode)
   .withTrigger(trigger)
   .withTimestampCombiner(timestampCombiner)
   .withClosingBehavior(closingBehavior)
   .withOnTimeBehavior(onTimeBehavior);
}
origin: org.apache.beam/beam-runners-flink

try {
 windowingStrategy =
   WindowingStrategyTranslation.fromProto(windowingStrategyProto, rehydratedComponents);
} catch (InvalidProtocolBufferException e) {
 throw new IllegalStateException(
origin: org.apache.beam/beam-runners-core-construction-java

@Test
public void testToProtoAndBack() throws Exception {
 WindowingStrategy<?, ?> windowingStrategy = toProtoAndBackSpec.getWindowingStrategy();
 SdkComponents components = SdkComponents.create();
 components.registerEnvironment(Environments.createDockerEnvironment("java"));
 WindowingStrategy<?, ?> toProtoAndBackWindowingStrategy =
   WindowingStrategyTranslation.fromProto(
     WindowingStrategyTranslation.toMessageProto(windowingStrategy, components));
 assertThat(
   toProtoAndBackWindowingStrategy,
   equalTo((WindowingStrategy) windowingStrategy.fixDefaults()));
}
origin: org.apache.beam/beam-runners-flink_2.11

try {
 windowingStrategy =
   WindowingStrategyTranslation.fromProto(windowingStrategyProto, rehydratedComponents);
} catch (InvalidProtocolBufferException e) {
 throw new IllegalStateException(
origin: org.apache.beam/beam-runners-flink_2.11

try {
 windowingStrategy =
   WindowingStrategyTranslation.fromProto(windowingStrategyProto, rehydratedComponents);
} catch (InvalidProtocolBufferException e) {
 throw new IllegalStateException(
origin: org.apache.beam/beam-runners-flink

try {
 windowingStrategy =
   WindowingStrategyTranslation.fromProto(windowingStrategyProto, rehydratedComponents);
} catch (InvalidProtocolBufferException e) {
 throw new IllegalStateException(
origin: org.apache.beam/beam-runners-flink_2.11

 windowingStrategy =
   (WindowingStrategy<Object, BoundedWindow>)
     WindowingStrategyTranslation.fromProto(windowingStrategyProto, rehydratedComponents);
} catch (InvalidProtocolBufferException e) {
 throw new IllegalStateException(
origin: org.apache.beam/beam-runners-flink

 windowingStrategy =
   (WindowingStrategy<Object, BoundedWindow>)
     WindowingStrategyTranslation.fromProto(windowingStrategyProto, rehydratedComponents);
} catch (InvalidProtocolBufferException e) {
 throw new IllegalStateException(
origin: org.apache.beam/beam-runners-core-construction-java

 @Test
 public void testToProtoAndBackWithComponents() throws Exception {
  WindowingStrategy<?, ?> windowingStrategy = toProtoAndBackSpec.getWindowingStrategy();
  SdkComponents components = SdkComponents.create();
  components.registerEnvironment(Environments.createDockerEnvironment("java"));
  RunnerApi.WindowingStrategy proto =
    WindowingStrategyTranslation.toProto(windowingStrategy, components);
  RehydratedComponents protoComponents =
    RehydratedComponents.forComponents(components.toComponents());

  assertThat(
    WindowingStrategyTranslation.fromProto(proto, protoComponents).fixDefaults(),
    equalTo(windowingStrategy.fixDefaults()));

  protoComponents.getCoder(
    components.registerCoder(windowingStrategy.getWindowFn().windowCoder()));
  assertThat(
    proto.getAssignsToOneWindow(),
    equalTo(windowingStrategy.getWindowFn().assignsToOneWindow()));
 }
}
org.apache.beam.runners.core.constructionWindowingStrategyTranslationfromProto

Javadoc

Converts from a RunnerApi.WindowingStrategy accompanied by Components to the SDK's WindowingStrategy.

Popular methods of WindowingStrategyTranslation

  • windowFnFromProto
  • toMessageProto
    Converts a WindowingStrategy into a RunnerApi.MessageWithComponents where RunnerApi.MessageWithCompo
  • toProto
    Converts a WindowingStrategy into a RunnerApi.WindowingStrategy, registering any components in the p
  • timestampCombinerFromProto

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top plugins for Android Studio
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