You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "Zawa-ll (via GitHub)" <gi...@apache.org> on 2024/07/17 05:51:45 UTC
[PR] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Zawa-ll opened a new pull request, #31915:
URL: https://github.com/apache/beam/pull/31915
This change addresses issue #31234 by adding a test for the RedistributeAfterSlidingWindowsAndGroupByKey function in the Apache Beam pipeline. The modifications include:
Adding a new test function testRedistributeAfterSlidingWindowsAndGroupByKey in PipelineTest.java.
Verifying that the Redistribute transformation works correctly after applying sliding windows and grouping by key.
Key changes:
PipelineTest.java: Added the testRedistributeAfterSlidingWindowsAndGroupByKey test to verify the correct functionality of the Redistribute transformation after sliding windows and grouping by key.
Redistribute.java: Refactored the Redistribute transformation code to ensure compatibility and proper functionality with the new test.
------------------------
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] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "Zawa-ll (via GitHub)" <gi...@apache.org>.
Zawa-ll commented on code in PR #31915:
URL: https://github.com/apache/beam/pull/31915#discussion_r1684802021
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Redistribute.java:
##########
@@ -160,6 +161,7 @@ public PCollection<T> expand(PCollection<T> input) {
return input
.apply("Pair with random key", ParDo.of(new AssignShardFn<>(numBuckets)))
.apply(Redistribute.<Integer, T>byKey().withAllowDuplicates(this.allowDuplicates))
+ .apply("Redistribute", ParDo.of(new RedistributeFn<>()))
Review Comment:
Sure, I just move it to the right location, can you please check the code again?
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Redistribute.java:
##########
@@ -160,6 +161,7 @@ public PCollection<T> expand(PCollection<T> input) {
return input
.apply("Pair with random key", ParDo.of(new AssignShardFn<>(numBuckets)))
.apply(Redistribute.<Integer, T>byKey().withAllowDuplicates(this.allowDuplicates))
+ .apply("Redistribute", ParDo.of(new RedistributeFn<>()))
Review Comment:
Sure, I just move it to the right location, can you please check the code again?
--
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] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #31915:
URL: https://github.com/apache/beam/pull/31915#issuecomment-2232581492
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] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #31915:
URL: https://github.com/apache/beam/pull/31915#issuecomment-2379200517
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. 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: [PR] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #31915:
URL: https://github.com/apache/beam/pull/31915#discussion_r1693231408
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/RedistributeTest.java:
##########
@@ -289,13 +284,12 @@ public void testRedistributeAfterFixedWindowsAndGroupByKey() {
@Test
@Category(ValidatesRunner.class)
public void testRedistributeAfterSlidingWindowsAndGroupByKey() {
-
PCollection<KV<String, Iterable<Integer>>> input =
pipeline
.apply(
Create.of(GBK_TESTABLE_KVS)
.withCoder(KvCoder.of(StringUtf8Coder.of(), VarIntCoder.of())))
- .apply(Window.into(FixedWindows.of(Duration.standardMinutes(10L))))
+ .apply(Window.into(SlidingWindows.of(Duration.standardMinutes(10L))))
Review Comment:
the original tests for slidingWindow was incorrect and likely never worked. After this change, test fails on portable-flink-runner validation test suite: https://github.com/apache/beam/actions/runs/10025426477/job/27708578006#step:6:202
we can leave it as is and figure it out later
--
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] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "Zawa-ll (via GitHub)" <gi...@apache.org>.
Zawa-ll commented on code in PR #31915:
URL: https://github.com/apache/beam/pull/31915#discussion_r1694460936
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/RedistributeTest.java:
##########
@@ -289,13 +284,12 @@ public void testRedistributeAfterFixedWindowsAndGroupByKey() {
@Test
@Category(ValidatesRunner.class)
public void testRedistributeAfterSlidingWindowsAndGroupByKey() {
-
PCollection<KV<String, Iterable<Integer>>> input =
pipeline
.apply(
Create.of(GBK_TESTABLE_KVS)
.withCoder(KvCoder.of(StringUtf8Coder.of(), VarIntCoder.of())))
- .apply(Window.into(FixedWindows.of(Duration.standardMinutes(10L))))
+ .apply(Window.into(SlidingWindows.of(Duration.standardMinutes(10L))))
Review Comment:
@Abacn Thank you for your response! I notice there are few failing checks relevant to style checks, I will fix them soon
--
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] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #31915:
URL: https://github.com/apache/beam/pull/31915#discussion_r1684890360
##########
runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkStreamingPortablePipelineTranslator.java:
##########
@@ -108,6 +110,9 @@ public SparkStreamingPortablePipelineTranslator() {
translatorMap.put(
PTransformTranslation.RESHUFFLE_URN,
SparkStreamingPortablePipelineTranslator::translateReshuffle);
+ translatorMap.put(
+ "urn:beam:transform:redistribute:v1", // Add the appropriate URN for Redistribute
Review Comment:
there are two urns for Redistribution, PTransformTranslation.REDISTRIBUTE_BY_KEY and PTransformTranslation.REDISTRIBUTE_ARBITRARILY
--
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] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "Zawa-ll (via GitHub)" <gi...@apache.org>.
Zawa-ll commented on code in PR #31915:
URL: https://github.com/apache/beam/pull/31915#discussion_r1685033978
##########
runners/spark/src/main/java/org/apache/beam/runners/spark/translation/SparkStreamingPortablePipelineTranslator.java:
##########
@@ -108,6 +110,9 @@ public SparkStreamingPortablePipelineTranslator() {
translatorMap.put(
PTransformTranslation.RESHUFFLE_URN,
SparkStreamingPortablePipelineTranslator::translateReshuffle);
+ translatorMap.put(
+ "urn:beam:transform:redistribute:v1", // Add the appropriate URN for Redistribute
Review Comment:
Sure, I just replace it with existing ones
REDISTRIBUTE_BY_KEY_URN and REDISTRIBUTE_ARBITRARILY_URN in PTransformTranslation.java
--
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] [Beam-31234] Add tests for Redistribute class and fix Redistribute function integration [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #31915:
URL: https://github.com/apache/beam/pull/31915#discussion_r1683562697
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Redistribute.java:
##########
@@ -160,6 +161,7 @@ public PCollection<T> expand(PCollection<T> input) {
return input
.apply("Pair with random key", ParDo.of(new AssignShardFn<>(numBuckets)))
.apply(Redistribute.<Integer, T>byKey().withAllowDuplicates(this.allowDuplicates))
+ .apply("Redistribute", ParDo.of(new RedistributeFn<>()))
Review Comment:
Thanks for proposing the fix. As this is a Spark runner issue, a proper fix should be in runners/spark code path. Java core is a common code path affects all runners.
--
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