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-25845][table] Introduce EXECUTE PLAN #18648

Closed
wants to merge 14 commits into from

Conversation

slinkydeveloper
Copy link
Contributor

What is the purpose of the change

Introduce EXECUTE PLAN statement.

@flinkbot
Copy link
Collaborator

flinkbot commented Feb 7, 2022

CI report:

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

@flinkbot
Copy link
Collaborator

flinkbot commented Feb 7, 2022

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 88b2fd7 (Mon Feb 07 15:10:09 UTC 2022)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

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

@slinkydeveloper slinkydeveloper force-pushed the FLINK-25845 branch 2 times, most recently from 7fac1d2 to 2e7e7a6 Compare February 9, 2022 16:52
@slinkydeveloper slinkydeveloper marked this pull request as ready for review February 9, 2022 16:53
@slinkydeveloper
Copy link
Contributor Author

@flinkbot run azure

Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

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

Very nice work @slinkydeveloper. I added some feedback.

private SqlNode checkOperand(SqlNode operand) {
if (!(operand instanceof RichSqlInsert || operand instanceof SqlStatementSet)) {
throw new UnsupportedOperationException(
"SqlCompilePlan supports only RichSqlInsert or SqlStatementSet as operand");
Copy link
Contributor

Choose a reason for hiding this comment

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

Could a user see this? If yes, remove internal class names and write the exception like: COMPILE PLAN supports only INSERT INTO or STATEMENT SET definitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No this happens only in case of a parser bug or a validator bug. The parser should not be able to parse at all a COMPILE (or a COMPILE AND EXECUTE) if the next AST nodes are not one of these two, because of this: https://github.com/apache/flink/pull/18648/files#diff-3aa4700ca748e2278129878cb20655276a6575183ef6a0b631a219106cf96491R1860-R1864

It would probably be better to use the assert statement instead of UnsupportedOperationException, but the reason i used it is for consistency.

}
}

if (!tableConfig.getConfiguration().get(TableConfigOptions.PLAN_FORCE_RECOMPILE)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this into compiledPlan.writeToFile/into the planner? Then the force overwrite is valid everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I added a commit where now writeToFile is consistent with this method. But still I wasn't able to unify them, as there is an essential difference here that while in the sql case i don't have an instance of CompiledPlan already built and with the string value in it, while in table i have it. So i had to duplicate the logic in two different places.

…test execution

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>

[fixup] Add ExecutePlanOperation, implement and test it

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
…ement and test it

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
… AND EXECUTE PLAN parsing

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
…tion

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
…anITCase

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
… AND EXECUTE

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

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

LGTM, I had only a minor comment. I can address it while merging. Thanks.


```
mvn -Pgenerate-config-docs install
mvn -Pgenerate-config-docs install -DskipTests -Dcheckstyle.skip -Drat.skip -Dscalastyle.skip -Denforcer.skip=true -Dspotless.check.skip=true -Dskip.npm=true -DskipITs=true -Dmaven.javadoc.skip=true -Djapicmp.skip=true
Copy link
Contributor

Choose a reason for hiding this comment

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

this might a bit too specific, who know what things we need to skip in the future. what we can suggest is -DskipTests -Dfast that should be enough for most use cases, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep let's just use -dfast

@twalthr twalthr closed this in 1923d70 Feb 14, 2022
@slinkydeveloper slinkydeveloper deleted the FLINK-25845 branch February 14, 2022 14:57
MrWhiteSike pushed a commit to MrWhiteSike/flink that referenced this pull request Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants