【发布时间】:2017-02-14 01:49:36
【问题描述】:
我有一个看起来像这样的管道
pipeline.apply(PubsubIO.read.subscription("some subscription"))
.apply(Window.into(SlidingWindow.of(10 mins).every(20 seconds)
.triggering(AfterProcessingTime.pastFirstElementInPane()
.plusDelayOf(20 seconds))
.withAllowedLateness(Duration.ZERO)
.accumulatingFiredPanes()))
.apply(RemoveDuplicates.create())
.apply(Window.discardingFiredPanes()) // this is suggested in the warnings under https://cloud.google.com/dataflow/model/triggers#window-accumulation-modes
.apply(Count.<String>globally().withoutDefaults())
此管道显着高估了不同的值(20 倍正常值)。最初,我怀疑默认触发器可能导致了这个问题。我已经调整以使用不允许迟到/丢弃触发的窗格/使用处理时间的触发器,所有这些都有类似的过度计数问题。
我也尝试过ApproximateUnique.globally:它在管道构建过程中失败,因为异常看起来像
Default values are not supported in Combine.globally() if the output PCollection is not windowed by GlobalWindows. 似乎没有办法将withoutDefaults 添加到它(就像我们对Count.globally 所做的那样)。
有没有推荐的方法在数据流/束流管道中以合理的精度执行COUNT(DISTINCT)?
附:我正在使用 Java 数据流 SDK 1.9.0。
【问题讨论】:
标签: google-cloud-dataflow dataflow