benWize commented on a change in pull request #15174:
URL: https://github.com/apache/beam/pull/15174#discussion_r698875183
##########
File path:
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAggregations.java
##########
@@ -376,29 +445,45 @@ public BigDecimal toBigDecimal(BigDecimal record) {
}
}
- static class BitOr<T extends Number> extends CombineFn<T, Long, Long> {
+ static class BitOr<T extends Number> extends CombineFn<T, BitOr.Accum, Long>
{
+ static class Accum implements Serializable {
+ /** True if no inputs have been seen yet. */
+ boolean isEmpty = true;
+ /** The bitwise-and of the inputs seen so far. */
+ long bitOr = 0L;
+ }
+
@Override
- public Long createAccumulator() {
- return 0L;
+ public Accum createAccumulator() {
+ return new Accum();
}
@Override
- public Long addInput(Long accum, T input) {
- return accum | input.longValue();
+ public Accum addInput(Accum accum, T input) {
+ accum.bitOr |= input.longValue();
Review comment:
I added a validation similar to BitAnd
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]