Unable to use ApproximateQuantiles.globally/ApproximateUnique.globally when inputs not windowed by GlobalWindows
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
Unable to use ApproximateQuantiles.globally or ApproximateUnique.globally with input windowed not using GlobalWindows.
To make it run we need to set either
```
.withoutDefaults()
```
or
```
.asSingletonView()
```
Currently we can't call any of the above on ApproximateQuantiles.globally()/ApproximateUnique.globally as it does not return underlying Combine.globally, but PTransform or Globally in case of ApproximateUnique.
Example failing case:
```
PCollection elements = p.apply(GenerateSequence.from(0).to(100)
.withRate(1,Duration.millis(1)).withTimestampFn(Instant::new));
PCollection> input = elements
.apply(Window.into(SlidingWindows.of(Duration.millis(3)).every(Duration.millis(1))))
.apply(ApproximateQuantiles.globally(17));
```
It throws expected error from internal Combine.globally() transform:
```
Default values are not supported in Combine.globally() if the input PCollection is not windowed by
GlobalWindows. Instead, use Combine.globally().withoutDefaults() to output an empty PCollection if the
input PCollection is empty, or Combine.globally().asSingletonView() to get the default output of the
CombineFn if the input PCollection is empty.
```
Imported from Jira [BEAM-10005](https://issues.apache.org/jira/browse/BEAM-10005). Original Jira may contain additional context.
Reported by: darshanjani.
Contributor guide
Assessment
This issue has not been assessed yet.