Skip to content

Conversation

@aljoscha
Copy link
Contributor

What is the purpose of the change

{{PlanExecutor}} has a method {{getOptimizerPlanAsJSON()}} that is used by DataSet environments to get a JSON version of the execution plan. To ease future work and to make it more maintainable we should get rid of that method and instead have a dedicated utility for generating JSON plans that the environments can use.

(The only reason this method is on the executor is because only {{flink-clients}} via {{flink-optimizer}} has the required components to derive a JSON plan.)

Brief change log

Please look at the list of commits for a changelog, each commit is an isolated refactoring on the path to the final result.

Verifying this change

  • Added a test for the new ExecutionPlanUtil

Documentation

  • Does this pull request introduce a new feature? no

@aljoscha aljoscha requested a review from kl0u September 16, 2019 11:47
@kl0u
Copy link
Contributor

kl0u commented Sep 16, 2019

Thanks @aljoscha ! I will have a look

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 16, 2019

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 0e68c41 (Wed Oct 16 08:18:57 UTC 2019)

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.

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 Sep 16, 2019

CI report:

@aljoscha aljoscha changed the title Decouple plan preview [FLINK-14067] Decouple PlanExecutor from JSON plan generation Sep 17, 2019
Copy link
Contributor

@kl0u kl0u 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 work @aljoscha ! I really like this cleanup. I had some minor comments. Feel free to merge after integrating them.

public String getExecutionPlan() throws Exception {
Plan plan = createProgramPlan("unnamed job");

OptimizedPlan op = ClusterClient.getOptimizedPlan(client.compiler, plan, getParallelism());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that now we can make the client.compiler field private to avoid leaking information about internal state.

Copy link
Contributor

Choose a reason for hiding this comment

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

And maybe other ClusterClient fields can become private as well.

* @throws Exception Thrown, if the compiler could not be instantiated.
*/
public abstract String getExecutionPlan() throws Exception;
public String getExecutionPlan() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can remove the Exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to remove it here because it is a @Public class.

…in root class

Before, each subclass had a slightly different way of getting the
execution plan (as JSON). Now, we factor that part out into a utility
and use that in the ExecutionEnvironment root class. This does mean,
that we don't take into account special information that a cluster
client or some other environment might have for plan generation.

Also, we can't remove the throws Exception from getExecutionPlan()
because it is a @public method.
We do this to get rid of the dependency on PlanExecutor for generating
the JSON plan. The executor should not be concerned with printing JSON
plans and this will simplify future executor work.
@aljoscha aljoscha force-pushed the decouple-plan-preview branch from 15a0e84 to 0e68c41 Compare September 17, 2019 15:07
@aljoscha aljoscha closed this Sep 18, 2019
@aljoscha aljoscha deleted the decouple-plan-preview branch September 18, 2019 07:54
@aljoscha
Copy link
Contributor Author

merged

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