Adding configurable option to set source parallelism#103
Merged
jeffxiang merged 9 commits intopinterest:mainfrom Nov 5, 2025
Merged
Adding configurable option to set source parallelism#103jeffxiang merged 9 commits intopinterest:mainfrom
jeffxiang merged 9 commits intopinterest:mainfrom
Conversation
nickpan47
reviewed
Oct 22, 2025
...nk/src/main/java/com/pinterest/flink/streaming/connectors/psc/table/PscConnectorOptions.java
Outdated
Show resolved
Hide resolved
nickpan47
reviewed
Oct 23, 2025
...flink/src/main/java/com/pinterest/flink/streaming/connectors/psc/table/PscDynamicSource.java
Outdated
Show resolved
Hide resolved
nickpan47
reviewed
Oct 24, 2025
...flink/src/main/java/com/pinterest/flink/streaming/connectors/psc/table/PscDynamicSource.java
Outdated
Show resolved
Hide resolved
nickpan47
reviewed
Oct 24, 2025
...ink/src/main/java/com/pinterest/flink/streaming/connectors/psc/table/PscTableSourceUtil.java
Outdated
Show resolved
Hide resolved
nickpan47
reviewed
Oct 27, 2025
...flink/src/main/java/com/pinterest/flink/streaming/connectors/psc/table/PscDynamicSource.java
Show resolved
Hide resolved
nickpan47
suggested changes
Oct 29, 2025
Contributor
nickpan47
left a comment
There was a problem hiding this comment.
lgtm overall. Please refactor the dup code block. Thanks!
...in/java/com/pinterest/flink/streaming/connectors/psc/table/UpsertPscDynamicTableFactory.java
Outdated
Show resolved
Hide resolved
...test/java/com/pinterest/flink/streaming/connectors/psc/table/PscDynamicTableFactoryTest.java
Show resolved
Hide resolved
nickpan47
reviewed
Oct 30, 2025
...nk/src/main/java/com/pinterest/flink/streaming/connectors/psc/table/PscTableCommonUtils.java
Show resolved
Hide resolved
nickpan47
reviewed
Oct 30, 2025
Contributor
nickpan47
left a comment
There was a problem hiding this comment.
nit: suggest renaming the util class. Otherwise, lgtm. Thanks!
jeffxiang
approved these changes
Oct 31, 2025
jeffxiang
pushed a commit
that referenced
this pull request
Nov 6, 2025
* Adding configurable optional to set source parallelism * fixes * make source infer parallelism * adding shuffle * revert pom * removing inference and keeping boolean flag * rework rescale apply logic * make common util * create TableCommonUtils --------- Co-authored-by: Kevin Browne <kbrowne@kbrowne-JG645XV.dyn.pinadmin.com>
jeffxiang
added a commit
that referenced
this pull request
Nov 8, 2025
* Adding configurable option to set source parallelism (#103) * Adding configurable optional to set source parallelism * fixes * make source infer parallelism * adding shuffle * revert pom * removing inference and keeping boolean flag * rework rescale apply logic * make common util * create TableCommonUtils --------- Co-authored-by: Kevin Browne <kbrowne@kbrowne-JG645XV.dyn.pinadmin.com> * Turn off error logging in flink tests --------- Co-authored-by: KevBrowne <kjbrowne0928@gmail.com> Co-authored-by: Kevin Browne <kbrowne@kbrowne-JG645XV.dyn.pinadmin.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently, PscDynamicSource defaults to parallelism equal to the number of topic partitions. Under Flink's FLIP-27 Source API, when parallelism is not explicitly set, Flink automatically derives it from the number of splits (topic partitions in this case). This creates bottlenecks when downstream operators need higher parallelism, as the source operator cannot scale beyond the partition count, leading to:
Solution
Added
scan.enable-rescale** configuration option that determines when data redistribution is needed. When enabled, the connector:table.exec.resource.default-parallelism) - https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/ExecutionConfigOptions.java#L314rescale()ONLY when parallelism > partition countThis eliminates manual calculation and automatically optimizes based on actual cluster state.
Added single boolean configuration option:
scan.enable-rescale(Boolean, default:false)rescale()shuffle to redistribute datafalseto avoid unnecessary overhead when partitions >= pipeline parallelismConfigure Pipeline Parallelism
Or via SQL:
Usage
Scenario 1: Rescale Applied
rescale()automatically"Applying rescale(): configured parallelism (10) > partition count (2)"Scenario 2: Rescale Skipped
rescale()automatically"Skipping rescale(): configured parallelism (4) <= partition count (8)"When to enable:
When to keep disabled (default):
Unit test