You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "lostluck (via GitHub)" <gi...@apache.org> on 2025/02/03 17:29:16 UTC

[PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

lostluck opened a new pull request, #33840:
URL: https://github.com/apache/beam/pull/33840

   While implementing Triggers + Panes for Prism, I ran into inexplicable failing tests.
   
   It turns out that portable encoding of panes in the protos *does not* match the implementations in the Python, and Java SDKs, or the internal Dataflow implementation, and never has in the 5 years since it was added to the protocol buffers.
   
   Specifically, the bits for first and last panes are swapped with first being the 7 indexed bit, and last being the 6 indexed bit.
   
   Compare Python and Java
    https://github.com/apache/beam/blob/master/sdks/python/apache_beam/utils/windowed_value.py#L92
   
   https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/PaneInfo.java#L134
   
   To Go's current implementation.
   
   https://github.com/apache/beam/blob/release-2.62.0/sdks/go/pkg/beam/core/graph/coder/panes.go#L32
   
   It is worth noting that the Go implemenation didn't have the swap some years ago when it was first added in https://github.com/apache/beam/commit/b0e9f2638cbaca822ee6a58bd8ec0e61db8e799e but it wasn't unit tested at the time.
   
   But due to a different error in the implementation, the bit swap occurred in https://github.com/apache/beam/commit/657caa88c011cae818377f64f02afe9d18614da5 where it was made to match the spec in the protocol buffers on top of fixing the other error.
   
   This error wasn't caught until now due to Triggers (and thus Panes) being among the last features implemented in the SDK, and the least tested due to no real portable implementations of TestStream necessary to exercise them. The Go SDK doesn't currently provide facilities to assert against specific pane properties, and it is unlikely for there to be user code for this since it seems like the Go SDK also doesn't propagate panes properly. See https://github.com/apache/beam/pull/31174/files and #31153 .
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/actions/workflows/build_wheels.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/actions/workflows/python_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/actions/workflows/java_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/actions/workflows/go_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940245715


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -965,8 +968,8 @@ message StandardCoders {
     //         01 - on time
     //         10 - late
     //         11 - unknown
-    //     * bit 6 is 1 if this is the first pane, 0 otherwise.
-    //     * bit 7 is 1 if this is the last pane, 0 otherwise.
+    //     * bit 6 is 1 if this is the last pane, 0 otherwise.

Review Comment:
   OK I've read down and see that the Go implementation matches the Java implementation (obvs it would have to) so maybe the best way to express this is to name these by  `byte | 0x01` and `byte | 0x02`



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940254746


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -1329,7 +1332,7 @@ message Trigger {
   message AfterSynchronizedProcessingTime {
   }
 
-  // The default trigger. Equivalent to Repeat { AfterEndOfWindow } but
+  // The default trigger. Equivalent to AfterEndOfWindow { Late: Always }} but

Review Comment:
   AFAICT They are not.
   
   AfterEndOfWindow is defined as having the sub triggers as implicitly repeating with no default behavior if a sub trigger isn't defined (technically, it defaults to the never trigger). So, Repeat { AfterEndOfWindow } has only an ontime, and maybe a closing firing. The repeat isn't semantically useful.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940256176


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -965,8 +968,8 @@ message StandardCoders {
     //         01 - on time
     //         10 - late
     //         11 - unknown
-    //     * bit 6 is 1 if this is the first pane, 0 otherwise.
-    //     * bit 7 is 1 if this is the last pane, 0 otherwise.
+    //     * bit 6 is 1 if this is the last pane, 0 otherwise.

Review Comment:
   Weird, it didn't show my your second comment. Both. The answer is both though. No sense changing from "we have bit indexes" to "they don't mean anything". 



##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -965,8 +968,8 @@ message StandardCoders {
     //         01 - on time
     //         10 - late
     //         11 - unknown
-    //     * bit 6 is 1 if this is the first pane, 0 otherwise.
-    //     * bit 7 is 1 if this is the last pane, 0 otherwise.
+    //     * bit 6 is 1 if this is the last pane, 0 otherwise.

Review Comment:
   Weird, it didn't show me your second comment. Both. The answer is both though. No sense changing from "we have bit indexes" to "they don't mean anything". 



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940242896


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -1329,7 +1332,7 @@ message Trigger {
   message AfterSynchronizedProcessingTime {
   }
 
-  // The default trigger. Equivalent to Repeat { AfterEndOfWindow } but
+  // The default trigger. Equivalent to AfterEndOfWindow { Late: Always }} but

Review Comment:
   These are equivalent, but I do prefer the phrasing you have altered it to.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on PR #33840:
URL: https://github.com/apache/beam/pull/33840#issuecomment-2631774619

   The failures are unrelated to this change.
   
   --------
   
   Looks like the Java  Precommit and Examples are hit by an unrelated license generation issue, Tracked in #33836 .
   
   ------
   
   Prism doesn't yet support BoundedTried metrics, and tests were added in the last week or two to the JAva test suite, causing the prism suite to fail.
   
   org.apache.beam.sdk.metrics.MetricsTest$AttemptedMetricTests > testAllAttemptedMetrics FAILED
       java.lang.AssertionError at MetricsTest.java:435
   
   org.apache.beam.sdk.metrics.MetricsTest$AttemptedMetricTests > testAttemptedBoundedTrieMetrics FAILED
       java.lang.AssertionError at MetricsTest.java:475
   
   org.apache.beam.sdk.metrics.MetricsTest$CommittedMetricTests > testCommittedBoundedTrieMetrics FAILED
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #33840:
URL: https://github.com/apache/beam/pull/33840#issuecomment-2631773887

   Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #33840:
URL: https://github.com/apache/beam/pull/33840#issuecomment-2631830435

   Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment `assign set of reviewers`


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck merged PR #33840:
URL: https://github.com/apache/beam/pull/33840


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940251723


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -965,8 +968,8 @@ message StandardCoders {
     //         01 - on time
     //         10 - late
     //         11 - unknown
-    //     * bit 6 is 1 if this is the first pane, 0 otherwise.
-    //     * bit 7 is 1 if this is the last pane, 0 otherwise.
+    //     * bit 6 is 1 if this is the last pane, 0 otherwise.

Review Comment:
   Nope, but if you look at the Java and Python linkes (and the internal Dataflow implementation) the updated text is correct. The IsFirst bit is the last bit (index 7) in big endian order.
   
   0b01234567 - indices
   0b00000001 - IsFirst bit is true (0x01)
   0b00000010 - IsLast bit is true (0x02)
   
   I agree that the original text is more intuitive, but we can't change Python, Java, and Dataflow. It's a small blessing that the Go SDK was the only one impacted by this, and it turns out you can't even use panes properly there either due to https://github.com/apache/beam/issues/31153.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940251723


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -965,8 +968,8 @@ message StandardCoders {
     //         01 - on time
     //         10 - late
     //         11 - unknown
-    //     * bit 6 is 1 if this is the first pane, 0 otherwise.
-    //     * bit 7 is 1 if this is the last pane, 0 otherwise.
+    //     * bit 6 is 1 if this is the last pane, 0 otherwise.

Review Comment:
   Nope, but if you look at the Java and Python linkes (and the internal Dataflow implementation) the updated text is correct. The IsFirst bit is the last, least significant bit (index 7).
   
   0b01234567 - indices
   0b00000001 - IsFirst bit is true (0x01)
   0b00000010 - IsLast bit is true (0x02)
   
   I agree that the original text is more intuitive, but we can't change Python, Java, and Dataflow. It's a small blessing that the Go SDK was the only one impacted by this, and it turns out you can't even use panes properly there either due to https://github.com/apache/beam/issues/31153.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on PR #33840:
URL: https://github.com/apache/beam/pull/33840#issuecomment-2631827661

   R: @kennknowles @jrmccluskey 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940251723


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -965,8 +968,8 @@ message StandardCoders {
     //         01 - on time
     //         10 - late
     //         11 - unknown
-    //     * bit 6 is 1 if this is the first pane, 0 otherwise.
-    //     * bit 7 is 1 if this is the last pane, 0 otherwise.
+    //     * bit 6 is 1 if this is the last pane, 0 otherwise.

Review Comment:
   Nope, but if you look at the Java and Python links (and the internal Dataflow implementation) the updated text is correct. The IsFirst bit is the last, least significant bit (index 7).
   
   0b01234567 - indices
   0b00000001 - IsFirst bit is true (0x01)
   0b00000010 - IsLast bit is true (0x02)
   
   I agree that the original text is more intuitive, but we can't change Python, Java, and Dataflow. It's a small blessing that the Go SDK was the only one impacted by this, and it turns out you can't even use panes properly there either due to https://github.com/apache/beam/issues/31153.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Go SDK + Protos] Fix Proto Spec for Pane encoding + Go SDK implementation. [beam]

Posted by "kennknowles (via GitHub)" <gi...@apache.org>.
kennknowles commented on code in PR #33840:
URL: https://github.com/apache/beam/pull/33840#discussion_r1940242113


##########
model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto:
##########
@@ -965,8 +968,8 @@ message StandardCoders {
     //         01 - on time
     //         10 - late
     //         11 - unknown
-    //     * bit 6 is 1 if this is the first pane, 0 otherwise.
-    //     * bit 7 is 1 if this is the last pane, 0 otherwise.
+    //     * bit 6 is 1 if this is the last pane, 0 otherwise.

Review Comment:
   Am I just counting bits from the wrong end? https://github.com/apache/beam/blob/0230b5d420f77c0ea673c36666911e37d1aaa70a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/PaneInfo.java#L133



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org