-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[FLINK-11908][table] Port window classes into flink-api-java #7976
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
Conversation
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. DetailsThe 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 commandsThe @flinkbot bot supports the following commands:
|
| * <p>For finite batch tables, group windows provide shortcuts for time-based groupBy. | ||
| * | ||
| * <p>Note: {@link Window} is temporally used as the father class of {@link GroupWindow} for the | ||
| * sake of compatibility. It will be removed later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here just a suggestion, how about we open a new PR for Deprecated the Window in release-1.8, since we should create a new RC2 for release 1.8. If we do not do that the Window will keep existing for almost half a year. And I'll create the Jira FLINK-11918, and link to release-1.8 vote mail thread, ask RM's options. If all of you do not agree, I'll close the JIRA, otherwise, we can open the new PR for Deprecated the window.
sunjincheng121
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. @hequn8128
The PR looks good to me. I only left a few suggestions.
And one suggestion about deprecated Window in a new PR, I think @twalthr may give us some suggestions.
Best,
Jincheng
| * aggregate for each input row over a range of its neighboring rows. | ||
| * | ||
| * <p>Java users should use the methods with parameters of String type, while Scala users should use | ||
| * the methods with parameters of Expression type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need mention Java users should not using Expression. Frankly speaking, we expect Java users to use Expression easily after FLINK-11890. What do you think?
| * elements in 5 minutes intervals. | ||
| * | ||
| * <p>Java users should use the methods with parameters of String type, while Scala users should use | ||
| * the methods with parameters of Expression type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
| @Deprecated | ||
| @deprecated( | ||
| "This method will be removed. Use table.window(window: GroupWindow) instead", | ||
| "1.9.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on FLINK-11918
| */ | ||
| def every(slide: Expression): SlideWithSizeAndSlide = new SlideWithSizeAndSlide(size, slide) | ||
| def every(slide: Expression): SlideWithSizeAndSlide = | ||
| new SlideWithSizeAndSlideImpl(size, slide) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary change?
c1d9b8c to
272d6c6
Compare
|
@sunjincheng121 Thanks a lot for your review. I have addressed all your comments. @twalthr @sunjincheng121 I have also rebased to the deprecating window pr and delete the deprecated methods and classes in this one. Would be great if you can take a look. Best, Hequn |
7236b9b to
03f4a80
Compare
|
Update, rebase to the latest deprecating window PR to unblock review. The updates contain two commits. One is the PR of deprecating window, the other one is the PR of the current issue. |
03f4a80 to
b05cfc2
Compare
|
Rebase to the latest flink/master |
twalthr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for rebasing the PR @hequn8128. Did you see my comment in the JIRA issue? I think instead of doing a lot of reflection magic for getting the implementation for every window. We should treat the cause of the problem which is the missing ExpressionParser. I would suggest to rename ExpressionParser to ExpressionParserImpl and introduce ExpressionParser.parseExpression in flink-table-api-java that performs a reflection step at just one location. This allows to finalize the API porting with interfaces and implementation for windows. And also solves related issues that require an expression parser.
|
@twalthr Sorry. I missed the important messages from you. Converting the ExpressionParser into an interface is a good solution. So we can port TumbleWithSize, TumbleWithSizeOnTime, etc. directly into api-java. This also performs a reflection step at just one location. Good idea! Best, Hequn |
369a5cb to
e00d2fc
Compare
|
@twalthr @sunjincheng121 I have updated the PR. Would be great if you can take another look. Some changes are explained by the followings:
Best, |
twalthr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @hequn8128. The code looks very good. I had just minor comments and will address them while merging.
| public static PlannerExpressionParser getExpressionParser() { | ||
|
|
||
| if (expressionParser == null) { | ||
| synchronized (SingletonPlannerExpressionParser.class) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API is single-threaded we don't need to synchronized code blocks.
| alias, | ||
| partitionBy, | ||
| orderBy, | ||
| ExpressionParser.parseExpression("UNBOUNDED_RANGE"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't introduce string constants at an arbitrary code location. Instead, either move it to the top of a class as a static final field or in this case use an already existing constant in BuiltInFunctionDefinitions.
| /** Defines a partitioning of the input on one or more attributes. */ | ||
| private final List<Expression> partitionBy; | ||
|
|
||
| public OverWindowPartitioned(List<Expression> partitionBy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use a default visibility for intermediate API classes. Such that users can not accidentally use the wrong methods.
|
@flinkbot approve all |
|
@twalthr Thanks for your valuable suggestions. I will move on the next PR(convert Table to the interface). |
What is the purpose of the change
This pull request ports window classes into flink-api-java module.
Brief change log
def window(window: Window): WindowedTableand adddef window(window: GroupWindow): GroupWindowedTableVerifying this change
This change is already covered by existing Window IT/UT test cases.
Furthermore, WindowValidationTest has been add to test failures for the creation of window.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes)Documentation