You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "claudevdm (via GitHub)" <gi...@apache.org> on 2025/05/02 22:54:33 UTC
[PR] Encode paneinfo with PaneInfoCoder. [beam]
claudevdm opened a new pull request, #34824:
URL: https://github.com/apache/beam/pull/34824
**Please** add a meaningful description for your change here
------------------------
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)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #34824:
URL: https://github.com/apache/beam/pull/34824#issuecomment-2851425828
> > > > > Just out of curiosity, what's wrong with not having a PaneInfoCoder. I see the issue #34826, but does FastPrimitiveCoder still work?
> > > >
> > > >
> > > > FastPrimitiveCoder ends up falling back to PickleCoder and much bigger encodings. PaneInfoCoder encodes it using 1 byte.
> > >
> > >
> > > I don't get why we need to expose `PaneInfoCoder` because I don't think we want cx to use it (or mess with it). `PaneInfoCoder` should implicitly be part of `WindowValueCoder` according to runner api proto (
> > > https://github.com/apache/beam/blob/c9a0e9081543953ae581b4b0e6bc1a2045405a47/model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto#L938
> > >
> > > ).
> > > I may be missing some important piece of background in #34348, but regarding
> > > https://github.com/apache/beam/blob/c9a0e9081543953ae581b4b0e6bc1a2045405a47/sdks/python/apache_beam/transforms/util.py#L955
> > >
> > > can we do the following?
> > > ```python
> > > return key, window.GlobalWindows.windowed_value(value, timestamp, pane_info)
> > > ```
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > In this case, the coder of this output will be `KVCoder[KeyCoder, WindowedValueCoder[GlobalWindowCoder, ValueCoder]]`, instead of `KVCoder[KeyCoder, TupleCoder[ValueCoder, TimeStampCoder, PaneInfoCoder]]`.
> >
> >
> > That logic specifically avoids the window param for performance reasons #4933.
> > See the comments
> > ```
> > # In this (common) case we can use a trivial trigger driver
> > # and avoid the (expensive) window param.
> > ```
>
> Hmmmm, my understanding of that comment is different. I think the optimization in #4933 is that for global windows we don't need to put WindowParam in the DoFn. Anyway, just want to call out here.
>
> ```python
> def reify_timestamps(element, timestamp=DoFn.TimestampParam):
> ...
> ```
CC @robertwb as he previously did $4933 about the WindowParam comment here.
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on code in PR #34824:
URL: https://github.com/apache/beam/pull/34824#discussion_r2072427523
##########
sdks/python/apache_beam/coders/coders.py:
##########
@@ -1753,6 +1755,18 @@ def __hash__(self):
return hash(type(self))
+class PaneInfoCoder(FastCoder):
+ def _create_impl(self):
+ return coder_impl.PaneInfoCoderImpl()
+
+ def is_deterministic(self):
+ # type: () -> bool
+ return True
+
+ def to_type_hint(self):
+ return windowed_value.PaneInfo
+
Review Comment:
Do we need to override __eq__ and __hash__ as other coders here?
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34824:
URL: https://github.com/apache/beam/pull/34824#discussion_r2073675603
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -92,6 +93,7 @@ def register_standard_coders(self, fallback_coder):
self._register_coder_internal(bytes, coders.BytesCoder)
self._register_coder_internal(bool, coders.BooleanCoder)
self._register_coder_internal(str, coders.StrUtf8Coder)
+ self._register_coder_internal(windowed_value.PaneInfo, coders.PaneInfoCoder)
Review Comment:
@kennknowles What do you think about this? We should use `PaneInfoCoder` but it could break the job update.
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad merged PR #34824:
URL: https://github.com/apache/beam/pull/34824
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #34824:
URL: https://github.com/apache/beam/pull/34824#issuecomment-2851092228
> > > > Just out of curiosity, what's wrong with not having a PaneInfoCoder. I see the issue #34826, but does FastPrimitiveCoder still work?
> > >
> > >
> > > FastPrimitiveCoder ends up falling back to PickleCoder and much bigger encodings. PaneInfoCoder encodes it using 1 byte.
> >
> >
> > I don't get why we need to expose `PaneInfoCoder` because I don't think we want cx to use it (or mess with it). `PaneInfoCoder` should implicitly be part of `WindowValueCoder` according to runner api proto (
> > https://github.com/apache/beam/blob/c9a0e9081543953ae581b4b0e6bc1a2045405a47/model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto#L938
> >
> > ).
> > I may be missing some important piece of background in #34348, but regarding
> > https://github.com/apache/beam/blob/c9a0e9081543953ae581b4b0e6bc1a2045405a47/sdks/python/apache_beam/transforms/util.py#L955
> >
> > can we do the following?
> > ```python
> > return key, window.GlobalWindows.windowed_value(value, timestamp, pane_info)
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > In this case, the coder of this output will be `KVCoder[KeyCoder, WindowedValueCoder[GlobalWindowCoder, ValueCoder]]`, instead of `KVCoder[KeyCoder, TupleCoder[ValueCoder, TimeStampCoder, PaneInfoCoder]]`.
>
> That logic specifically avoids the window param for performance reasons #4933.
>
> See the comments
>
> ```
> # In this (common) case we can use a trivial trigger driver
> # and avoid the (expensive) window param.
> ```
Hmmmm, my understanding of that comment is different. I think the optimization in #4933 is that for global windows we don't need to put WindowParam in the DoFn. Anyway, just want to call out here.
```python
def reify_timestamps(element, timestamp=DoFn.TimestampParam):
...
```
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34824:
URL: https://github.com/apache/beam/pull/34824#issuecomment-2848329107
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #34824:
URL: https://github.com/apache/beam/pull/34824#issuecomment-2849771349
> > Just out of curiosity, what's wrong with not having a PaneInfoCoder. I see the issue #34826, but does FastPrimitiveCoder still work?
>
> FastPrimitiveCoder ends up falling back to PickleCoder and much bigger encodings. PaneInfoCoder encodes it using 1 byte.
I don't get why we need to expose PaneInfoCoder because I don't think we want cx to use it (or mess with it). PaneInfoCoder should implicitly be part of WindowValueCoder according to runner api proto (https://github.com/apache/beam/blob/c9a0e9081543953ae581b4b0e6bc1a2045405a47/model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto#L938).
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "claudevdm (via GitHub)" <gi...@apache.org>.
claudevdm commented on PR #34824:
URL: https://github.com/apache/beam/pull/34824#issuecomment-2850810697
> > > Just out of curiosity, what's wrong with not having a PaneInfoCoder. I see the issue #34826, but does FastPrimitiveCoder still work?
> >
> >
> > FastPrimitiveCoder ends up falling back to PickleCoder and much bigger encodings. PaneInfoCoder encodes it using 1 byte.
>
> I don't get why we need to expose `PaneInfoCoder` because I don't think we want cx to use it (or mess with it). `PaneInfoCoder` should implicitly be part of `WindowValueCoder` according to runner api proto (
>
> https://github.com/apache/beam/blob/c9a0e9081543953ae581b4b0e6bc1a2045405a47/model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto#L938
>
> ).
> I may be missing some important piece of background in #34348, but regarding
>
> https://github.com/apache/beam/blob/c9a0e9081543953ae581b4b0e6bc1a2045405a47/sdks/python/apache_beam/transforms/util.py#L955
>
> can we do the following?
>
> ```python
> return key, window.GlobalWindows.windowed_value(value, timestamp, pane_info)
> ```
>
> In this case, the coder of this output will be `KVCoder[KeyCoder, WindowedValueCoder[GlobalWindowCoder, ValueCoder]]`, instead of `KVCoder[KeyCoder, TupleCoder[ValueCoder, TimeStampCoder, PaneInfoCoder]]`.
That logic specifically avoids the window param for performance reasons https://github.com/apache/beam/pull/4933.
See the comments
> # In this (common) case we can use a trivial trigger driver
> # and avoid the (expensive) window param.
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #34824:
URL: https://github.com/apache/beam/pull/34824#discussion_r2073633443
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -92,6 +93,7 @@ def register_standard_coders(self, fallback_coder):
self._register_coder_internal(bytes, coders.BytesCoder)
self._register_coder_internal(bool, coders.BooleanCoder)
self._register_coder_internal(str, coders.StrUtf8Coder)
+ self._register_coder_internal(windowed_value.PaneInfo, coders.PaneInfoCoder)
Review Comment:
This fix has a large blast radius. It changed registered standard coders which is default behavior globally. Shall we do this or just put a coder implementation in new ReShuffle?
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34824:
URL: https://github.com/apache/beam/pull/34824#issuecomment-2848677824
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @liferoad for label python.
Available commands:
- `stop reviewer notifications` - opt out of the automated review tooling
- `remind me after tests pass` - tag the comment author after tests pass
- `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
The PR bot will only process comments in the main thread (not review comments).
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "liferoad (via GitHub)" <gi...@apache.org>.
liferoad commented on code in PR #34824:
URL: https://github.com/apache/beam/pull/34824#discussion_r2073723141
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -92,6 +93,7 @@ def register_standard_coders(self, fallback_coder):
self._register_coder_internal(bytes, coders.BytesCoder)
self._register_coder_internal(bool, coders.BooleanCoder)
self._register_coder_internal(str, coders.StrUtf8Coder)
+ self._register_coder_internal(windowed_value.PaneInfo, coders.PaneInfoCoder)
Review Comment:
Yes, we should update https://github.com/apache/beam/blob/master/CHANGES.md#breaking-changes-1 at least.
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "claudevdm (via GitHub)" <gi...@apache.org>.
claudevdm commented on code in PR #34824:
URL: https://github.com/apache/beam/pull/34824#discussion_r2073654232
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -92,6 +93,7 @@ def register_standard_coders(self, fallback_coder):
self._register_coder_internal(bytes, coders.BytesCoder)
self._register_coder_internal(bool, coders.BooleanCoder)
self._register_coder_internal(str, coders.StrUtf8Coder)
+ self._register_coder_internal(windowed_value.PaneInfo, coders.PaneInfoCoder)
Review Comment:
Are you suggesting to define PaneInfoCoder here https://github.com/apache/beam/blob/6f2f960b35957a7227286634d96108d6c4eb3003/sdks/python/apache_beam/transforms/util.py#L996 and then use `CoderRegistry.register_coder`?
I don't have strong opinion, is there a disadvantage to doing it here? It seems like an 'internal' coder use case?
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #34824:
URL: https://github.com/apache/beam/pull/34824#discussion_r2073679029
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -92,6 +93,7 @@ def register_standard_coders(self, fallback_coder):
self._register_coder_internal(bytes, coders.BytesCoder)
self._register_coder_internal(bool, coders.BooleanCoder)
self._register_coder_internal(str, coders.StrUtf8Coder)
+ self._register_coder_internal(windowed_value.PaneInfo, coders.PaneInfoCoder)
Review Comment:
> is there a disadvantage to doing it here
This introduces a breaking change such that windowed_value.PaneInfo has changed default coder. This is not limited to ReShuffle but also user pipeline.
Since test results shows PaneInfoCoder is much more efficient than FastPrimitiveCoder for PaneInfo, I am fine with the change, just need to know this is another breaking change introduced in 2.65.0
If we keep this change I recommend to also mention this in https://github.com/apache/beam/blob/master/CHANGES.md#breaking-changes-1
--
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] Encode paneinfo with PaneInfoCoder. [beam]
Posted by "claudevdm (via GitHub)" <gi...@apache.org>.
claudevdm commented on PR #34824:
URL: https://github.com/apache/beam/pull/34824#issuecomment-2849474854
> Just out of curiosity, what's wrong with not having a PaneInfoCoder. I see the issue #34826, but does FastPrimitiveCoder still work?
FastPrimitiveCoder ends up falling back to PickleCoder and much bigger encodings. PaneInfoCoder encodes it using 1 byte.
--
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