Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-34702][table-planner] Refactor Deduplicate optimization to defer to StreamPhysicalRank for valid StreamExecDeduplicate node conversion to avoid exceptions #25380

Merged
merged 7 commits into from
Sep 25, 2024

Conversation

lincoln-lil
Copy link
Contributor

What is the purpose of the change

A refactor to avoid using StreamPhysicalDeduplicate and instead decide to perform exec node transformations in StreamPhysicalRank, so that we can completely avoid Exception "StreamPhysicalDeduplicate doesn't support consuming update changes..." for various queries.

Brief change log

Delay the rank/dedup transformation to physical -> exec phase

Verifying this change

Streaming Rank/DedupTest and newly added test cases

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @public(Evolving): (no)
  • The serializers: (no )
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 24, 2024

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

* Stream physical RelNode which deduplicate on keys and keeps only first row or last row. This node
* is an optimization of [[StreamPhysicalRank]] for some special cases. Compared to
* [[StreamPhysicalRank]], this node could use mini-batch and access less state.
* TODO to be removed after FLINK-34702 is fixed. Stream physical RelNode which deduplicate on keys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this operator may be used in existing Flink jobs, I do not believe we can remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The StreamPhysicalDeduplicate is just an intermediate node in the optimization process, after all the optimizations are done it will be converted to StreamExecDeduplicate and eventually to the actual runtime sql duplicate operator.
Also, the compiled plan does not depend on the physical node, but on the exec node. Therefore, it does not affect existing sql jobs.

@lincoln-lil lincoln-lil marked this pull request as ready for review September 24, 2024 15:52
@lincoln-lil lincoln-lil changed the title [FLINK-34702][table-planner] Avoid using StreamPhysicalDeduplicate and instead decide to perform exec node transformations in StreamPhysicalRank [FLINK-34702][table-planner] Refactor Deduplicate optimization to defer to StreamPhysicalRank for valid StreamExecDeduplicate node conversion to avoid exceptions Sep 25, 2024
@@ -321,7 +321,7 @@ Calc(select=[amount, currency, rowtime, PROCTIME_MATERIALIZE(proctime) AS procti
: +- Calc(select=[amount, currency, rowtime, PROCTIME() AS proctime], changelogMode=[I])
: +- LegacyTableSourceScan(table=[[default_catalog, default_database, Orders, source: [CollectionTableSource(amount, currency, rowtime)]]], fields=[amount, currency, rowtime], changelogMode=[I])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the physical plan looks good to me and the exec plan is not changed +1

@liuyongvs
Copy link
Contributor

LGTM, only left one minor comment

@lincoln-lil
Copy link
Contributor Author

LGTM, only left one minor comment

Thank you for reviewing this! I've rebased the latest master and will merge it after ci green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants