flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-20899][table-planner-blink] Fix ClassCastException when calculating cost in HepPlanner

Open godfreyhe opened this issue 4 years ago • 3 comments

What is the purpose of the change

After TREACE level is enabled for Logger, we will encounter ClassCastException when executing the following query: SELECT COUNT(1) FROM MyTable. The reason is the HepPlanner will calculate the cost of the optimized plan when TRACE is enabled, while the cost factory in hep planner is RelOptCostImpl.Factory, not the sub-class of FlinkCostFactory. The solution is we should create HepPlanner with the cost factory in the RelOptCluster.

Brief change log

  • Fix ClassCastException when calculating cost in HepPlanner

Verifying this change

This change added tests and can be verified as follows:

  • Added FlinkHepProgramTest to verify the bug

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

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

Documentation

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

godfreyhe avatar Jan 08 '21 12:01 godfreyhe

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 ed4c8bb2788d76c2b031fe230f85010e0f936259 (Fri May 28 07:03:06 UTC 2021)

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.

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 avatar Jan 08 '21 12:01 flinkbot

CI report:

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

flinkbot avatar Jan 08 '21 12:01 flinkbot

Hey @godfreyhe would you like to rebase this PR to fix the conflicts?

leonardBang avatar Jan 03 '24 07:01 leonardBang