[
https://issues.apache.org/jira/browse/BEAM-7013?focusedWorklogId=309256&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-309256
]
ASF GitHub Bot logged work on BEAM-7013:
----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Sep/19 21:19
Start Date: 09/Sep/19 21:19
Worklog Time Spent: 10m
Work Description: robinyqiu commented on pull request #9519: [BEAM-7013]
Use a 0-length byte array to represent empty sketch in HllCount
URL: https://github.com/apache/beam/pull/9519#discussion_r322400143
##########
File path:
sdks/java/extensions/zetasketch/src/main/java/org/apache/beam/sdk/extensions/zetasketch/HllCountMergePartialFn.java
##########
@@ -94,9 +99,9 @@ private HllCountMergePartialFn() {}
@Override
public byte[] extractOutput(@Nullable HyperLogLogPlusPlus<HllT> accumulator)
{
if (accumulator == null) {
- throw new IllegalStateException(
- "HllCountMergePartialFn.extractOutput() should not be called on a
null accumulator.");
+ return new byte[0];
Review comment:
The reason is that the superclass `CombineFn` has a default
[implementation](https://github.com/robinyqiu/beam/blob/3b6a628c9ad0fbf63b7c1f7d355dbc8cf5219eb2/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Combine.java#L455-L458):
```
@Override
public OutputT defaultValue() {
return extractOutput(createAccumulator());
}
```
For `MergePartial`, this implementation already gives the correct result:
`createAccumulator()` returns `null` and `extractOutput(null)` returns `new
byte[0]`.
But for `Init`, the output of this implementation will be a valid empty
sketch for each type (e.g. `LONGS_PROTO_OF_EMPTY_SKETCH` as you mentioned in
the next comment), which is not what we want, so we need to override it there.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 309256)
Time Spent: 30.5h (was: 30h 20m)
> A new count distinct transform based on BigQuery compatible HyperLogLog++
> implementation
> ----------------------------------------------------------------------------------------
>
> Key: BEAM-7013
> URL: https://issues.apache.org/jira/browse/BEAM-7013
> Project: Beam
> Issue Type: New Feature
> Components: extensions-java-sketching, sdk-java-core
> Reporter: Yueyang Qiu
> Assignee: Yueyang Qiu
> Priority: Major
> Fix For: 2.16.0
>
> Time Spent: 30.5h
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.2#803003)