Skip to content

Conversation

@tsreaper
Copy link
Contributor

What is the purpose of the change

JoinDeriveNullFilterRule will filter out null join keys to prevent data skew for joins. Currently this rule is only applied before join reorder. After join reorder the join keys for some inputs might change and we need to apply this rule again.

This PR applies the rule again after join reorder.

Brief change log

  • Apply JoinDeriveNullFilterRule after join reorder

Verifying this change

This change added tests and can be verified by running the added tests.

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/Mesos, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 247a8b4 (Thu Oct 29 07:27:38 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.

Details
The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Oct 29, 2020

CI report:

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

Copy link
Contributor

@godfreyhe godfreyhe left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @tsreaper, I left a few comments.

PREDICATE_SIMPLIFY_EXPRESSION_RULES.asScala ++
FILTER_RULES.asScala
FILTER_RULES.asScala ++
RuleSets.ofList(JoinDeriveNullFilterRule.INSTANCE).asScala
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better we do not put JoinDeriveNullFilterRule into JOIN_COND_EQUAL_TRANSFER_RULES collection, instead I suggest we can add a program into JOIN_REWRITE stage after JOIN_COND_EQUAL_TRANSFER_RULES

Comment on lines 73 to 92
util.addTableSource("T6", types, Array("a6", "b6", "c6"), FlinkStatistic.builder()
.tableStats(new TableStats(500000L, Map(
"a6" -> new ColumnStats(200000L, 50000L, 4.0, 4, null, null),
"b6" -> new ColumnStats(100000L, 0L, 8.0, 8, null, null),
"c6" -> new ColumnStats(50000L, 20000L, 8.0, 8, null, null)
))).build())

util.addTableSource("T7", types, Array("a7", "b7", "c7"), FlinkStatistic.builder()
.tableStats(new TableStats(500000L, Map(
"a7" -> new ColumnStats(200000L, 50000L, 4.0, 4, null, null),
"b7" -> new ColumnStats(100000L, 0L, 8.0, 8, null, null),
"c7" -> new ColumnStats(50000L, 20000L, 8.0, 8, null, null)
))).build())

util.addTableSource("T8", types, Array("a8", "b8", "c8"), FlinkStatistic.builder()
.tableStats(new TableStats(500000L, Map(
"a8" -> new ColumnStats(200000L, 50000L, 4.0, 4, null, null),
"b8" -> new ColumnStats(100000L, 0L, 8.0, 8, null, null),
"c8" -> new ColumnStats(50000L, 20000L, 8.0, 8, null, null)
))).build())
Copy link
Contributor

@godfreyhe godfreyhe Oct 30, 2020

Choose a reason for hiding this comment

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

if they are only used in one test method, we can move them into the specific method

.tableStats(new TableStats(500000L, Map(
"a6" -> new ColumnStats(200000L, 50000L, 4.0, 4, null, null),
"b6" -> new ColumnStats(100000L, 0L, 8.0, 8, null, null),
"c6" -> new ColumnStats(50000L, 20000L, 8.0, 8, null, null)
Copy link
Contributor

Choose a reason for hiding this comment

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

please do not use deprecated constructor

FILTER_RULES.asScala
).asJava)

val JOIN_NULL_FILTER_RULES: RuleSet = RuleSets.ofList(
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better JOIN_PREDICATE_REWRITE_RULES could reuse this rule set

Copy link
Contributor

@godfreyhe godfreyhe left a comment

Choose a reason for hiding this comment

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

Thanks for the update, LGTM

@tsreaper
Copy link
Contributor Author

tsreaper commented Nov 3, 2020

@flinkbot run azure

@godfreyhe godfreyhe merged commit d0458aa into apache:master Nov 3, 2020
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