You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/02/26 06:51:13 UTC

[GitHub] [flink] beyond1920 opened a new pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

beyond1920 opened a new pull request #15026:
URL: https://github.com/apache/flink/pull/15026


   ## What is the purpose of the change
   
   This pull request aims to support streaming window TopN in planner.
   
   
   ## Brief change log
   
     - Introduce `StreamPhysicalWindowRank`
     - Update `FlinkChangelogModeInterenceProgram` and `FlinkRelMdWindowProperties` to take `StreamPhysicalWindowRank` into consideration.
     - Introduce `StreamPhysicalWindowRankRule` to convert `LogicalRank` to `StreamPhysicalWindowRank` if partition keys contains window_start, window_end
   
   
   ## Verifying this change
     - UT in `WindowRankTest`.
   
   ## 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, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (yes / no / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-786469305


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823",
       "triggerID" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7b5c54a66d9bb6ec1869c566a6da55121156b01d",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14236",
       "triggerID" : "7b5c54a66d9bb6ec1869c566a6da55121156b01d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d230bc06f6471d949c037ef7940668465c27d6cf Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823) 
   * 7b5c54a66d9bb6ec1869c566a6da55121156b01d Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14236) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-792288138


   The failed e2e test is not related to this PR.
   
   Merging... 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-786469305


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823",
       "triggerID" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d230bc06f6471d949c037ef7940668465c27d6cf Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong merged pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
wuchong merged pull request #15026:
URL: https://github.com/apache/flink/pull/15026


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on a change in pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #15026:
URL: https://github.com/apache/flink/pull/15026#discussion_r588069791



##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamPhysicalWindowRank.scala
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flink.table.planner.plan.nodes.physical.stream
+
+import org.apache.flink.table.planner.plan.logical.WindowingStrategy
+import org.apache.flink.table.planner.plan.nodes.calcite.Rank
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode
+import org.apache.flink.table.planner.plan.utils._
+import org.apache.flink.table.runtime.operators.rank._
+
+import org.apache.calcite.plan.{RelOptCluster, RelTraitSet}
+import org.apache.calcite.rel._
+import org.apache.calcite.rel.`type`.RelDataTypeField
+import org.apache.calcite.util.ImmutableBitSet
+
+import java.util
+
+import scala.collection.JavaConversions._
+import scala.collection.JavaConverters._
+
+/**
+ * Stream physical RelNode for [[Rank]] requires PARTITION BY clause contains start and end
+ * columns of the windowing TVF.
+ */
+class StreamPhysicalWindowRank(
+    cluster: RelOptCluster,
+    traitSet: RelTraitSet,
+    inputRel: RelNode,
+    partitionKey: ImmutableBitSet,
+    orderKey: RelCollation,
+    rankType: RankType,
+    rankRange: RankRange,
+    rankNumberType: RelDataTypeField,
+    outputRankNumber: Boolean,
+    val windowing: WindowingStrategy)
+  extends Rank(
+    cluster,
+    traitSet,
+    inputRel,
+    partitionKey,
+    orderKey,
+    rankType,
+    rankRange,
+    rankNumberType,
+    outputRankNumber)
+  with StreamPhysicalRel {
+
+  override def requireWatermark: Boolean = windowing.isRowtime
+
+  override def copy(traitSet: RelTraitSet, inputs: util.List[RelNode]): RelNode = {
+    new StreamPhysicalWindowRank(
+      cluster,
+      traitSet,
+      inputs.get(0),
+      partitionKey,
+      orderKey,
+      rankType,
+      rankRange,
+      rankNumberType,
+      outputRankNumber,
+      windowing)
+  }
+
+  override def explainTerms(pw: RelWriter): RelWriter = {
+    val inputRowType = inputRel.getRowType
+    val inputFieldNames = inputRowType.getFieldNames.asScala.toArray
+    pw.input("input", getInput)
+      .item("rankType", rankType)
+      .item("rankRange", rankRange.toString(inputRowType.getFieldNames))
+      .item("partitionBy", RelExplainUtil.fieldToString(partitionKey.toArray, inputRowType))
+      .item("orderBy", RelExplainUtil.collationToString(orderKey, inputRowType))
+      .item("window", windowing.toSummaryString(inputFieldNames))

Review comment:
       I think window is the most important information of window topn. Could we move "window" before "rankType"? This can make the operator name in Web UI more readable. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-786451672


   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 d230bc06f6471d949c037ef7940668465c27d6cf (Fri Feb 26 06:52:46 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## 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](https://flink.apache.org/contributing/reviewing-prs.html) 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 <summary>Bot commands</summary>
     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
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-786469305


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823",
       "triggerID" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d230bc06f6471d949c037ef7940668465c27d6cf Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] beyond1920 commented on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
beyond1920 commented on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-792182788


   @wuchong Thanks for review, I've updated pr based on your comment.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-786469305


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823",
       "triggerID" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7b5c54a66d9bb6ec1869c566a6da55121156b01d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "7b5c54a66d9bb6ec1869c566a6da55121156b01d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d230bc06f6471d949c037ef7940668465c27d6cf Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823) 
   * 7b5c54a66d9bb6ec1869c566a6da55121156b01d UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-786469305


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d230bc06f6471d949c037ef7940668465c27d6cf UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15026: [FLINK-19610][table-planner-blink] Support streaming window TopN in planner

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15026:
URL: https://github.com/apache/flink/pull/15026#issuecomment-786469305


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=13823",
       "triggerID" : "d230bc06f6471d949c037ef7940668465c27d6cf",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7b5c54a66d9bb6ec1869c566a6da55121156b01d",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14236",
       "triggerID" : "7b5c54a66d9bb6ec1869c566a6da55121156b01d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7b5c54a66d9bb6ec1869c566a6da55121156b01d Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14236) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org