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-9787]Change ExecutionConfig#getGlobalJobParameters to return a… #8175

Closed
wants to merge 1 commit into from

Conversation

tianchen92
Copy link
Contributor

What is the purpose of the change

related to FLINK-9787. Change ExecutionConfig#getGlobalJobParameters to return an instance of GlobalJobParameters instead of null if no custom globalJobParameters are set yet

Brief change log

  • change ExecutionConfig#getGlobalJobParameters and add test

Verifying this change

This change added tests and can be verified as follows:

  • *Added ExecutionConfigTest#testGlobalParameters *

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, 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

flinkbot commented Apr 15, 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 36cd7b9 (Fri Aug 30 07:58:35 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.


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

Copy link
Contributor

@xintongsong xintongsong 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 opening this PR, @tianchen92. The PR LGTM.

However, I find another potential issue, which is not introduced by this PR.

GlobalJobParameters is designed to be an abstract class (according to the comments), but is actually implemented with a default toMap method. Therefore, it fails to guarantee that all classes that extend GlobalJobParameters implement proper toMap method. I would suggest to make GlobalJobParameters an interface, and introduce a singleton class EmptyGlobalJobParameters as the default.

I think we can either address this issue in this PR if you would like to, or merge this PR as it is and create another ticket regarding this. What do you think?

@flinkbot
Copy link
Collaborator

flinkbot commented Aug 22, 2019

CI report:

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

LGTM +1

only two nits you might accept.

@@ -741,6 +741,9 @@ public boolean isSysoutLoggingEnabled() {
}

public GlobalJobParameters getGlobalJobParameters() {
Copy link
Member

Choose a reason for hiding this comment

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

Nice to mark it as @NonNull now.

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 the community agreed that all return values which are not annotated with @Nullable are meant to be implicitly @NonNull. Hence theres should be no need for it.

@Test
public void testGlobalParameters() {
final ExecutionConfig config = new ExecutionConfig();

Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe we get GlobalJobParameters empty = config.getGlobalJobParameters() first and then do the assertion.

Copy link
Contributor

@tillrohrmann tillrohrmann 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 this fix @tianchen92. I had some more comments how we could simplify the code further. Please take a look.

@tianchen92
Copy link
Contributor Author

Thanks a lot for all your comments. @xintongsong I am fine if you would like to create another issue.
@tisonkun @tillrohrmann I updated this PR according to your comments.

Copy link
Contributor

@tillrohrmann tillrohrmann 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 this fix @tianchen92. Your changes look good to me modulo the added equals method. I'll remove this change and if Travis gives green light, then I'll merge this PR.

@Override
public boolean equals(Object obj) {
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this? If this is not needed, then please revert.

Copy link
Contributor

Choose a reason for hiding this comment

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

I now understand why we need it.

Copy link
Contributor

Choose a reason for hiding this comment

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

can we document the answer?

Copy link
Contributor

Choose a reason for hiding this comment

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

The equals method is needed for the equals method of the ExecutionConfig which was not needed before because the field was null.

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