当前位置: 首页>>代码示例>>Java>>正文


Java BoundedWindow类代码示例

本文整理汇总了Java中com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow的典型用法代码示例。如果您正苦于以下问题:Java BoundedWindow类的具体用法?Java BoundedWindow怎么用?Java BoundedWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BoundedWindow类属于com.google.cloud.dataflow.sdk.transforms.windowing包,在下文中一共展示了BoundedWindow类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: window

import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow; //导入依赖的package包/类
private static <T, W extends BoundedWindow> TransformEvaluator<Window.Bound<T>> window() {
  return new TransformEvaluator<Window.Bound<T>>() {
    @Override
    public void evaluate(Window.Bound<T> transform, EvaluationContext context) {
      @SuppressWarnings("unchecked")
      JavaRDDLike<WindowedValue<T>, ?> inRDD =
          (JavaRDDLike<WindowedValue<T>, ?>) context.getInputRDD(transform);
      WindowFn<? super T, W> windowFn = WINDOW_FG.get("windowFn", transform);
      if (windowFn instanceof GlobalWindows) {
        context.setOutputRDD(transform, inRDD);
      } else {
        @SuppressWarnings("unchecked")
        DoFn<T, T> addWindowsDoFn = new AssignWindowsDoFn<>(windowFn);
        DoFnFunction<T, T> dofn =
                new DoFnFunction<>(addWindowsDoFn, context.getRuntimeContext(), null);
        context.setOutputRDD(transform, inRDD.mapPartitions(dofn));
      }
    }
  };
}
 
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:21,代码来源:TransformTranslator.java

示例2: window

import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow; //导入依赖的package包/类
@Override
public BoundedWindow window() {
  if (!(fn instanceof DoFn.RequiresWindowAccess)) {
    throw new UnsupportedOperationException(
        "window() is only available in the context of a DoFn marked as RequiresWindow.");
  }
  return Iterables.getOnlyElement(windowedValue.getWindows());
}
 
开发者ID:shakamunyi,项目名称:spark-dataflow,代码行数:9,代码来源:SparkProcessContext.java

示例3: processElement

import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow; //导入依赖的package包/类
@Override
public void processElement(DoFn<List<String>, KV<String, TSProto>>.ProcessContext c)
    throws Exception {
	
 List<String> timeSeriesKey = c.element();
 BoundedWindow window = c.window();
 
  for (String s : timeSeriesKey) {
    TSProto ts =
        TSProto.newBuilder().setKey(s).setIsLive(false)
            .setTime(window.maxTimestamp().getMillis()).build();

    c.outputWithTimestamp(KV.of(s, ts), window.maxTimestamp());
    
    LOG.debug(String.format("Generated value for missing tick details are key : %s time: %s" , ts.getKey(), new Instant(ts.getTime())));

  }

}
 
开发者ID:GoogleCloudPlatform,项目名称:data-timeseries-java,代码行数:20,代码来源:CreateMissingTimeSeriesValuesDoFn.java


注:本文中的com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。