[ 
https://issues.apache.org/jira/browse/BEAM-11637?focusedWorklogId=535652&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-535652
 ]

ASF GitHub Bot logged work on BEAM-11637:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Jan/21 19:25
            Start Date: 13/Jan/21 19:25
    Worklog Time Spent: 10m 
      Work Description: ibzib commented on a change in pull request #13745:
URL: https://github.com/apache/beam/pull/13745#discussion_r556773587



##########
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAggregations.java
##########
@@ -397,40 +397,54 @@ public Long extractOutput(Long accum) {
    * <p>Note: null values are ignored when mixed with non-null values.
    * (https://issues.apache.org/jira/browse/BEAM-10379)
    */
-  static class BitAnd<T extends Number> extends CombineFn<T, Long, Long> {
-    // Indicate if input only contains null value.
-    private boolean isEmpty = true;
+  static class BitAnd<T extends Number> extends CombineFn<T, BitAnd.Accum, 
Long> {
+    static class Accum {
+      /** True if no inputs have been seen yet. */
+      boolean isEmpty = true;

Review comment:
       If isNull is true, the other values become meaningless. I added a 
comment.




----------------------------------------------------------------
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: 535652)
    Time Spent: 50m  (was: 40m)

> BitAnd unsafely mutates an instance field.
> ------------------------------------------
>
>                 Key: BEAM-11637
>                 URL: https://issues.apache.org/jira/browse/BEAM-11637
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>            Reporter: Kyle Weaver
>            Assignee: Kyle Weaver
>            Priority: P2
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> BitAnd uses isEmpty, an instance field, to track if inputs seen thus far are 
> null. This is an unsafe usage of CombineFn, since all mutable state is 
> expected to be stored in the Accumulator.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to