[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16679151#comment-16679151 ] ASF GitHub Bot commented on FLINK-10676: sunjincheng121 commented on issue #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#issuecomment-436838520 CI find `JobManagerHAProcessFailureRecoveryITCase.testDispatcherProcessFailure:331 » IllegalArgument` test fail which looks no relation with this PR. I'll check it, then merge this PR. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16679285#comment-16679285 ] ASF GitHub Bot commented on FLINK-10676: asfgit closed pull request #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md index 76bd5b28ef2..ed3a97d8def 100644 --- a/docs/dev/table/tableApi.md +++ b/docs/dev/table/tableApi.md @@ -1571,13 +1571,15 @@ The `OverWindow` defines a range of rows over which aggregates are computed. `Ov preceding - Required + Optional Defines the interval of rows that are included in the window and precede the current row. The interval can either be specified as time or row-count interval. Bounded over windows are specified with the size of the interval, e.g., 10.minutes for a time interval or 10.rows for a row-count interval. Unbounded over windows are specified using a constant, i.e., UNBOUNDED_RANGE for a time interval or UNBOUNDED_ROW for a row-count interval. Unbounded over windows start with the first row of a partition. + +If the preceding clause is omitted, UNBOUNDED_RANGE and CURRENT_RANGE are used as the default preceding and following for the window. diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/java/windows.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/java/windows.scala index f326f6f6a7c..121aab8f776 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/java/windows.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/java/windows.scala @@ -18,7 +18,8 @@ package org.apache.flink.table.api.java -import org.apache.flink.table.api.{TumbleWithSize, OverWindowWithPreceding, SlideWithSize, SessionWithGap} +import org.apache.flink.table.api.scala.{CURRENT_RANGE, UNBOUNDED_RANGE} +import org.apache.flink.table.api.{OverWindow, TumbleWithSize, OverWindowWithPreceding, SlideWithSize, SessionWithGap} import org.apache.flink.table.expressions.{Expression, ExpressionParser} /** @@ -144,4 +145,21 @@ class OverWindowWithOrderBy( new OverWindowWithPreceding(partitionByExpr, orderByExpr, precedingExpr) } + /** +* Assigns an alias for this window that the following `select()` clause can refer to. +* +* @param alias alias for this over window +* @return over window +*/ + def as(alias: String): OverWindow = as(ExpressionParser.parseExpression(alias)) + + /** +* Assigns an alias for this window that the following `select()` clause can refer to. +* +* @param alias alias for this over window +* @return over window +*/ + def as(alias: Expression): OverWindow = { +OverWindow(alias, partitionByExpr, orderByExpr, UNBOUNDED_RANGE, CURRENT_RANGE) + } } diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/windows.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/windows.scala index 91bf1a6c739..2f88248a7f1 100644 --- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/windows.scala +++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/windows.scala @@ -18,8 +18,8 @@ package org.apache.flink.table.api.scala -import org.apache.flink.table.api.{TumbleWithSize, OverWindowWithPreceding, SlideWithSize, SessionWithGap} -import org.apache.flink.table.expressions.Expression +import org.apache.flink.table.api.{OverWindow, TumbleWithSize, OverWindowWithPreceding, SlideWithSize, SessionWithGap} +import org.apache.flink.table.expressions.{Expression, ExpressionParser} /** * Helper object for creating a tumbling window. Tumbling windows are consecutive, non-overlapping @@ -127,7 +127,6 @@ case class PartitionedOver(partitionBy: Array[Expression]) { case class OverWindowWithOrderBy(partitionBy: Seq[Expression], orderBy: Expression) { - /** * Set the preceding offset (based on time or row-count intervals) for over window. * @@ -138,4 +137,21 @@ case class OverWindowWithOrderBy(partitionBy: Seq[Expression], orderBy: Expressi new OverWindowWithPreceding(partitionBy, orderBy, preceding) } + /** +* Assigns an alias for this window that the following `select()` clause can refer to. +* +* @param alias alias for this over window +* @return over window +*/ + def as(alias: String): OverWindow =
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16679270#comment-16679270 ] ASF GitHub Bot commented on FLINK-10676: sunjincheng121 commented on issue #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#issuecomment-436862717 After the rerun, the error disappeared. no specific reasons are found, so created a JIRA. [FLINK-10819](https://issues.apache.org/jira/browse/FLINK-10819), and will continue to pay attention. Merging this PR... This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16679786#comment-16679786 ] ASF GitHub Bot commented on FLINK-10676: hequn8128 commented on issue #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#issuecomment-437000167 Thanks a lot for the review and merging! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678462#comment-16678462 ] ASF GitHub Bot commented on FLINK-10676: sunjincheng121 edited a comment on issue #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#issuecomment-436683222 @hequn8128 Thanks for the updated! +1 to merged. Thanks, Jincheng This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678461#comment-16678461 ] ASF GitHub Bot commented on FLINK-10676: sunjincheng121 commented on issue #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#issuecomment-436683222 @hequn8128 Thanks for the updated! + 1 to merged. Thanks, Jincheng This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678451#comment-16678451 ] ASF GitHub Bot commented on FLINK-10676: hequn8128 commented on issue #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#issuecomment-436680634 Hi @sunjincheng121 , thanks a lot for your view. I think all of the suggestions are good! I have addressed the comments and updated the pr. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678405#comment-16678405 ] ASF GitHub Bot commented on FLINK-10676: hequn8128 commented on a change in pull request #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#discussion_r231555804 ## File path: docs/dev/table/tableApi.md ## @@ -1571,13 +1571,15 @@ The `OverWindow` defines a range of rows over which aggregates are computed. `Ov preceding - Required + Optional Defines the interval of rows that are included in the window and precede the current row. The interval can either be specified as time or row-count interval. Bounded over windows are specified with the size of the interval, e.g., 10.minutes for a time interval or 10.rows for a row-count interval. Unbounded over windows are specified using a constant, i.e., UNBOUNDED_RANGE for a time interval or UNBOUNDED_ROW for a row-count interval. Unbounded over windows start with the first row of a partition. + +If the preceding and following clause both are omitted, RANGE UNBOUNDED PRECEDING AND CURRENT ROW is used as default for window. Review comment: make sense! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678374#comment-16678374 ] ASF GitHub Bot commented on FLINK-10676: sunjincheng121 commented on a change in pull request #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#discussion_r231500525 ## File path: docs/dev/table/tableApi.md ## @@ -1571,13 +1571,15 @@ The `OverWindow` defines a range of rows over which aggregates are computed. `Ov preceding - Required + Optional Defines the interval of rows that are included in the window and precede the current row. The interval can either be specified as time or row-count interval. Bounded over windows are specified with the size of the interval, e.g., 10.minutes for a time interval or 10.rows for a row-count interval. Unbounded over windows are specified using a constant, i.e., UNBOUNDED_RANGE for a time interval or UNBOUNDED_ROW for a row-count interval. Unbounded over windows start with the first row of a partition. + +If the preceding and following clause both are omitted, RANGE UNBOUNDED PRECEDING AND CURRENT ROW is used as default for window. Review comment: UNBOUNDED_RANGE and CURRENT_RANGE appear in pairs,So the following description is recommended: If the preceding clause is omitted, UNBOUNDED_RANGE and CURRENT_RANGE is used as default for window. What do you think? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678376#comment-16678376 ] ASF GitHub Bot commented on FLINK-10676: sunjincheng121 commented on a change in pull request #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#discussion_r231500755 ## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/windows.scala ## @@ -18,8 +18,8 @@ package org.apache.flink.table.api.scala -import org.apache.flink.table.api.{TumbleWithSize, OverWindowWithPreceding, SlideWithSize, SessionWithGap} -import org.apache.flink.table.expressions.Expression +import org.apache.flink.table.api._ Review comment: Same as java/windows.scala comments. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678375#comment-16678375 ] ASF GitHub Bot commented on FLINK-10676: sunjincheng121 commented on a change in pull request #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949#discussion_r231493947 ## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/java/windows.scala ## @@ -18,7 +18,8 @@ package org.apache.flink.table.api.java -import org.apache.flink.table.api.{TumbleWithSize, OverWindowWithPreceding, SlideWithSize, SessionWithGap} +import org.apache.flink.table.api.scala.{CURRENT_RANGE, UNBOUNDED_RANGE} +import org.apache.flink.table.api._ Review comment: I think using `import org.apache.flink.table.api.{OverWindow, TumbleWithSize, OverWindowWithPreceding, SlideWithSize, SessionWithGap} ` is better than using wildcard, because there are not many classes imported here.What do you think? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16665968#comment-16665968 ] ASF GitHub Bot commented on FLINK-10676: hequn8128 opened a new pull request #6949: [FLINK-10676][table] Add 'as' method for OverWindowWithOrderBy URL: https://github.com/apache/flink/pull/6949 ## What is the purpose of the change The preceding clause of OVER Window in the traditional database is optional. The default is UNBOUNDED. So we can add the `as` method to `OverWindowWithOrderBy`. This way OVER Window is written more easily. e.g.: `.window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as 'w)` Can be simplified as follows: `.window(Over partitionBy 'c orderBy 'proctime as 'w)` SQL has already supported such feature. ## Brief change log - Add `as` function for `OverWindowWithOrderBy` both for scala and java. - Add tests to check result plan. ## Verifying this change This change added tests and can be verified as follows: - Added tests that validate result plan, such as tests in `OverWindowTest` and `OverWindowStringExpressionTest`. ## 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)`: (yes) - 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? (yes) - If yes, how is the feature documented? (docs) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Hequn Cheng >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16663575#comment-16663575 ] Chesnay Schepler commented on FLINK-10676: -- Apologies, I assigned myself by accident. I've assigned it back to you. > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Chesnay Schepler >Priority: Major > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16663566#comment-16663566 ] Hequn Cheng commented on FLINK-10676: - [~Zentol] Hi, could I assign the task to myself?:) > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Chesnay Schepler >Priority: Major > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10676) Add 'as' method for OverWindowWithOrderBy in Java API
[ https://issues.apache.org/jira/browse/FLINK-10676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16663530#comment-16663530 ] Hequn Cheng commented on FLINK-10676: - [~sunjincheng121] Thanks for proposing the improvement. It is more succinct. Oracle and SqlServer do the same: *SqlServer* If ROWS/RANGE is not specified but ORDER BY is specified, RANGE UNBOUNDED PRECEDING AND CURRENT ROW is used as default for window frame[1]. *Oracle* If you omit the windowing_clause entirely, then the default is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW[2]. [1] [https://docs.microsoft.com/en-us/sql/t-sql/queries/select-over-clause-transact-sql?view=sql-server-2017#general-remarks|https://docs.microsoft.com/en-us/sql/t-sql/queries/select-over-clause-transact-sql?view=sql-server-2017#general-remarks] [2] [https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions004.htm#SQLRF06174|https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions004.htm#SQLRF06174] > Add 'as' method for OverWindowWithOrderBy in Java API > - > > Key: FLINK-10676 > URL: https://issues.apache.org/jira/browse/FLINK-10676 > Project: Flink > Issue Type: Improvement > Components: Table API SQL >Affects Versions: 1.7.0 >Reporter: sunjincheng >Assignee: Chesnay Schepler >Priority: Major > Fix For: 1.7.0 > > > The preceding clause of OVER Window in the traditional database is optional. > The default is UNBOUNDED. So we can add the "as" method to > OverWindowWithOrderBy. This way OVERWindow is written more easily. e.g.: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime preceding UNBOUNDED_ROW as > 'w){code} > Can be simplified as follows: > {code:java} > .window(Over partitionBy 'c orderBy 'proctime as 'w){code} > What do you think? > -- This message was sent by Atlassian JIRA (v7.6.3#76005)