You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "elitongadotti (via GitHub)" <gi...@apache.org> on 2024/12/09 10:42:06 UTC
[I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
elitongadotti opened a new issue, #33329:
URL: https://github.com/apache/beam/issues/33329
### What happened?
Setup:
- Python SDK, version 2.60.0
- Dataflow Runner
- Streaming Job
What happened?
Take a streaming job that reads from a PubSub subscription, do some transformations and sink it back to PubSub Topic.
The message has a lot of duplicate "rows", I need to expose the primary key for an element and `GroupByKey()` to be able to fetch the latest one. Once I expose `pk` and group by it, the step downstream might have keys with no values.
**If I remove the** `early=trigger.AfterProcessingTime(some_time)` **it did work as expected (keys and values are emitted together)**.
It does not make sense to emit to the downstream steps only keys but not values. Both are part of the same output tuple and they cannot be emitted separately.
Here's part of the code:
(
to_sync
| "AddTimestamp" >> beam.ParDo(AddTimestamp())
| "Window" >> beam.WindowInto(
windowfn=window.FixedWindows(60),
trigger=trigger.AfterWatermark(early=trigger.AfterProcessingTime(30)),
accumulation_mode=trigger.AccumulationMode.DISCARDING
)
| "GroupAndFetchLatest" >> GroupAndFetchLatest()
...
)
class GroupAndFetchLatest(beam.PTransform):
"""Expose record PK, group by it and fetch the latest record (timestamp)"""
def expand(self, pcoll):
return (
pcoll
| "ExposeKey" >> beam.Map(lambda x: (x["mykey"], x))
| "Group" >> beam.GroupByKey()
| "GetLatest" >> beam.ParDo(GetLatest())
)
class GetLatest(beam.DoFn):
def process(self, grouped):
key, values = grouped
if values: # Here, I had to add this "if" to avoid keys without values.
latest = max(values, key=lambda o: o["__ts__"])
yield MyObject(
PK=key,
row=latest
)
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [X] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [X] Component: Google Cloud Dataflow Runner
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #33329:
URL: https://github.com/apache/beam/issues/33329#issuecomment-2916184733
This issue has been marked as stale due to 150 days of inactivity. It will be closed in 30 days if no further activity occurs. If you think that’s incorrect or this issue still needs to be addressed, please simply write any comment. If closed, you can reopen the issue at any time. Thank you for your contributions.
--
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: [I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #33329: [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger
URL: https://github.com/apache/beam/issues/33329
--
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: [I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #33329:
URL: https://github.com/apache/beam/issues/33329#issuecomment-3581175193
This issue has been closed due to lack of activity. If you think that is incorrect, you can reopen the issue at any time.
--
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: [I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
Posted by "elitongadotti (via GitHub)" <gi...@apache.org>.
elitongadotti commented on issue #33329:
URL: https://github.com/apache/beam/issues/33329#issuecomment-2527559099
.set-labels dataflow,python,groupbykey,fixedwindow,earlytriggers
--
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: [I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #33329:
URL: https://github.com/apache/beam/issues/33329#issuecomment-2527560132
Label groupbykey cannot be managed because it does not exist in the repo. Please check your spelling.
--
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: [I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
Posted by "elitongadotti (via GitHub)" <gi...@apache.org>.
elitongadotti commented on issue #33329:
URL: https://github.com/apache/beam/issues/33329#issuecomment-2916216851
any 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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: GroupByKey() emits only key but not values for streaming job on a FixedWindows() with early trigger [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #33329:
URL: https://github.com/apache/beam/issues/33329#issuecomment-3451112076
This issue has been marked as stale due to 150 days of inactivity. It will be closed in 30 days if no further activity occurs. If you think that’s incorrect or this issue still needs to be addressed, please simply write any comment. If closed, you can reopen the issue at any time. Thank you for your contributions.
--
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