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-22915][FLIP-173] Updates the static load(...) method of Stage subclasses to take StreamExecutionEnvironment as parameter #33

Closed
wants to merge 2 commits into from

Conversation

lindong28
Copy link
Member

@lindong28 lindong28 commented Nov 14, 2021

What is the purpose of the change

This PR updates the static load(...) method of Stage subclasses to take StreamExecutionEnvironment as parameter. This is because the static load method will need to create DataStream or Table instances to read model data.

This PR also updates Model::setModelData(...) to return the Model instance itself. This could improve usability by allowing users to do e.g. return new KMeansModel().setModelData(...).

Brief change log

This PR mades the following changes:

  • Updated static load method of all Stage subclasses to take StreamExecutionEnvironment as parameter.
  • Updated a few methods in the ReadWriteUtils to take StreamExecutionEnvironment as parameter.
  • Updated Model::setModelData(...) to return the Model instance itself.

Verifying this change

The changes are validated by the existing unit tests.

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

  • Dependencies (does it add or upgrade a dependency): (yes)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (N/A)

@lindong28
Copy link
Member Author

@gaoyunhaii Could you review this PR?

@lindong28 lindong28 changed the title [FLINK-24354][FLIP-174] The static stage::load should take StreamExecutionEnvironment as parameter [FLINK-22915][FLIP-173] The static stage::load(...) should take StreamExecutionEnvironment as parameter Nov 15, 2021
@lindong28 lindong28 force-pushed the FLINK-24354-followup branch 2 times, most recently from 82eee62 to 8b05243 Compare November 15, 2021 08:16
@lindong28 lindong28 changed the title [FLINK-22915][FLIP-173] The static stage::load(...) should take StreamExecutionEnvironment as parameter Updates the static load(...) method of Stage subclasses to take StreamExecutionEnvironment as parameter Nov 15, 2021
@lindong28 lindong28 changed the title Updates the static load(...) method of Stage subclasses to take StreamExecutionEnvironment as parameter [FLINK-22915][FLIP-173] Updates the static load(...) method of Stage subclasses to take StreamExecutionEnvironment as parameter Nov 15, 2021
@@ -39,6 +39,7 @@
void save(String path) throws IOException;

// NOTE: every Stage subclass should implement a static method with signature "static T
// load(String path)", where T refers to the concrete subclass. This static method should
// instantiate a new stage instance based on the data from the given path.
// load(StreamExecutionEnvironment env, String path)", where T refers to the concrete
Copy link
Contributor

Choose a reason for hiding this comment

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

We might move this part of comment to the class comments? Then it would also appear in the java doc.

Also change static T load(StreamExecutionEnvironment env, String path) -> {@code static T load(StreamExecutionEnvironment env, String path)} and T -> {@code T}

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. The PR has been updated as suggested.

Copy link
Contributor

@gaoyunhaii gaoyunhaii left a comment

Choose a reason for hiding this comment

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

Very thanks @lindong28 for the update! LGTM and +1 to merge

@lindong28
Copy link
Member Author

Thanks for the prompt review @gaoyunhaii!

@lindong28 lindong28 deleted the FLINK-24354-followup branch November 16, 2021 03:31
@lindong28 lindong28 restored the FLINK-24354-followup branch November 16, 2021 03:35
@lindong28 lindong28 deleted the FLINK-24354-followup branch November 16, 2021 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants