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/01/07 08:04:38 UTC

[GitHub] [flink] godfreyhe opened a new pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

godfreyhe opened a new pull request #14574:
URL: https://github.com/apache/flink/pull/14574


   ## What is the purpose of the change
   
   *Separate the implementation of stream window aggregate nodes, including 
   BatchExecHashWindowAggregate
   BatchExecLocalHashWindowAggregate
   BatchExecSortWindowAggregate
   BatchExecLocalSortWindowAggregate
   BatchExecPythonGroupWindowAggregate*
   
   
   ## Brief change log
   
     - *Rename BatchExecWindowAggregateBase to BatchPhysicalWindowAggregateBase and do some refactoring*
     - *Introduce BatchPhysicalHashWindowAggregate & BatchPhysicalLocalHashWindowAggregate, and make BatchExecHashWindowAggregate only extended from ExecNode*
     - *Introduce BatchPhysicalSortWindowAggregate & BatchPhysicalLocalSortWindowAggregate, and make BatchExecSortWindowAggregate only extended from ExecNode*
     - *Introduce BatchPhysicalPythonGroupWindowAggregate, and make BatchExecPythonGroupWindowAggregate only extended from ExecNode*
   
   ## Verifying this change
   
   This change is a refactoring rework covered by existing tests.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / **not documented**)
   


----------------------------------------------------------------
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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c081c035965120267e8f86570fa8e7b43ee234d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733) 
   * a8d0d6432e87bb1a75525cb8fe1153232cd9d823 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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775",
       "triggerID" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776",
       "triggerID" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c081c035965120267e8f86570fa8e7b43ee234d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733) 
   * a8d0d6432e87bb1a75525cb8fe1153232cd9d823 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775) 
   * b56d77364d5891f4d0139c102b19b427fd49d830 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776) 
   
   <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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775",
       "triggerID" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776",
       "triggerID" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a8d0d6432e87bb1a75525cb8fe1153232cd9d823 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775) 
   * b56d77364d5891f4d0139c102b19b427fd49d830 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776) 
   
   <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] godfreyhe commented on a change in pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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



##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecHashWindowAggregate.java
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.MemorySize;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.ExecutionConfigOptions;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.calcite.FlinkRelBuilder.PlannerNamedWindowProperty;
+import org.apache.flink.table.planner.codegen.CodeGeneratorContext;
+import org.apache.flink.table.planner.codegen.agg.batch.HashWindowCodeGenerator;
+import org.apache.flink.table.planner.codegen.agg.batch.WindowCodeGenerator;
+import org.apache.flink.table.planner.delegation.PlannerBase;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
+import org.apache.flink.table.planner.plan.nodes.exec.utils.ExecNodeUtil;
+import org.apache.flink.table.planner.plan.utils.AggregateInfoList;
+import org.apache.flink.table.planner.plan.utils.AggregateUtil;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.table.runtime.generated.GeneratedOperator;
+import org.apache.flink.table.runtime.operators.CodeGenOperatorFactory;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.calcite.rel.core.AggregateCall;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/** Batch {@link ExecNode} for hash-based window aggregate operator. */
+public class BatchExecHashWindowAggregate extends ExecNodeBase<RowData>
+        implements BatchExecNode<RowData> {
+
+    private final int[] grouping;
+    private final int[] auxGrouping;
+    private final AggregateCall[] aggCalls;
+    private final LogicalWindow window;
+    private final int inputTimeFieldIndex;

Review comment:
       Different from `StreamExecWindowAggregate`, `BatchExecWindowAggregate` has local agg and global agg, and the values of  the `inputTimeFieldIndex ` are different for them. If we remove this parameter, we have to derive the value both in `BatchPhysicalWindowAggregateRule` and `BatchExecWindowAggregate`.




----------------------------------------------------------------
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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775",
       "triggerID" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c081c035965120267e8f86570fa8e7b43ee234d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733) 
   * a8d0d6432e87bb1a75525cb8fe1153232cd9d823 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775) 
   
   <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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25 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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   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 b56d77364d5891f4d0139c102b19b427fd49d830 (Fri May 28 07:03:35 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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728) 
   * 0c081c035965120267e8f86570fa8e7b43ee234d 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] godfreyhe closed pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

Posted by GitBox <gi...@apache.org>.
godfreyhe closed pull request #14574:
URL: https://github.com/apache/flink/pull/14574


   


----------------------------------------------------------------
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] godfreyhe commented on a change in pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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



##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecHashWindowAggregate.java
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.MemorySize;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.ExecutionConfigOptions;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.calcite.FlinkRelBuilder.PlannerNamedWindowProperty;
+import org.apache.flink.table.planner.codegen.CodeGeneratorContext;
+import org.apache.flink.table.planner.codegen.agg.batch.HashWindowCodeGenerator;
+import org.apache.flink.table.planner.codegen.agg.batch.WindowCodeGenerator;
+import org.apache.flink.table.planner.delegation.PlannerBase;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
+import org.apache.flink.table.planner.plan.nodes.exec.utils.ExecNodeUtil;
+import org.apache.flink.table.planner.plan.utils.AggregateInfoList;
+import org.apache.flink.table.planner.plan.utils.AggregateUtil;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.table.runtime.generated.GeneratedOperator;
+import org.apache.flink.table.runtime.operators.CodeGenOperatorFactory;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.calcite.rel.core.AggregateCall;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/** Batch {@link ExecNode} for hash-based window aggregate operator. */
+public class BatchExecHashWindowAggregate extends ExecNodeBase<RowData>
+        implements BatchExecNode<RowData> {
+
+    private final int[] grouping;
+    private final int[] auxGrouping;
+    private final AggregateCall[] aggCalls;
+    private final LogicalWindow window;
+    private final int inputTimeFieldIndex;
+    private final boolean inputTimeIsDate;
+    private final PlannerNamedWindowProperty[] namedWindowProperties;
+    private final RowType aggInputRowType;
+    private final boolean enableAssignPane;
+    private final boolean isMerge;
+    private final boolean isFinal;
+
+    public BatchExecHashWindowAggregate(
+            int[] grouping,
+            int[] auxGrouping,
+            AggregateCall[] aggCalls,
+            LogicalWindow window,
+            int inputTimeFieldIndex,
+            boolean inputTimeIsDate,
+            PlannerNamedWindowProperty[] namedWindowProperties,
+            RowType aggInputRowType,
+            boolean enableAssignPane,
+            boolean isMerge,
+            boolean isFinal,
+            ExecEdge inputEdge,
+            RowType outputType,
+            String description) {
+        super(Collections.singletonList(inputEdge), outputType, description);
+        this.grouping = grouping;
+        this.auxGrouping = auxGrouping;
+        this.aggCalls = aggCalls;
+        this.window = window;
+        this.inputTimeFieldIndex = inputTimeFieldIndex;
+        this.inputTimeIsDate = inputTimeIsDate;
+        this.namedWindowProperties = namedWindowProperties;
+        this.aggInputRowType = aggInputRowType;
+        this.enableAssignPane = enableAssignPane;
+        this.isMerge = isMerge;
+        this.isFinal = isFinal;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected Transformation<RowData> translateToPlanInternal(PlannerBase planner) {
+        final ExecNode<RowData> inputNode = (ExecNode<RowData>) getInputNodes().get(0);
+        final Transformation<RowData> inputTransform = inputNode.translateToPlan(planner);
+
+        final AggregateInfoList aggInfos =
+                AggregateUtil.transformToBatchAggregateInfoList(
+                        aggInputRowType,
+                        JavaScalaConversionUtil.toScala(Arrays.asList(aggCalls)),
+                        null,
+                        null);
+
+        final TableConfig tableConfig = planner.getTableConfig();
+        final int groupBufferLimitSize =
+                tableConfig
+                        .getConfiguration()
+                        .getInteger(ExecutionConfigOptions.TABLE_EXEC_WINDOW_AGG_BUFFER_SIZE_LIMIT);
+
+        final Tuple2<Long, Long> windowSizeAndSlideSize = WindowCodeGenerator.getWindowDef(window);
+        final RowType inputRowType = (RowType) inputNode.getOutputType();
+        final HashWindowCodeGenerator hashWindowCodeGenerator =
+                new HashWindowCodeGenerator(
+                        new CodeGeneratorContext(tableConfig),
+                        planner.getRelBuilder(),
+                        window,
+                        inputTimeFieldIndex,
+                        inputTimeIsDate,
+                        JavaScalaConversionUtil.toScala(Arrays.asList(namedWindowProperties)),
+                        aggInfos,
+                        inputRowType,
+                        grouping,
+                        auxGrouping,
+                        enableAssignPane,
+                        isMerge,
+                        isFinal);
+        final GeneratedOperator<OneInputStreamOperator<RowData, RowData>> generatedOperator =
+                hashWindowCodeGenerator.gen(
+                        inputRowType,
+                        (RowType) getOutputType(),
+                        groupBufferLimitSize,
+                        0,
+                        windowSizeAndSlideSize.f0,
+                        windowSizeAndSlideSize.f1);
+
+        final long managedMemory =
+                MemorySize.parse(

Review comment:
       done




----------------------------------------------------------------
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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c081c035965120267e8f86570fa8e7b43ee234d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733) 
   
   <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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775",
       "triggerID" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776",
       "triggerID" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b56d77364d5891f4d0139c102b19b427fd49d830 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776) 
   
   <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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775",
       "triggerID" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776",
       "triggerID" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b56d77364d5891f4d0139c102b19b427fd49d830 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11776) 
   
   <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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728) 
   
   <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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728) 
   * 0c081c035965120267e8f86570fa8e7b43ee234d Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733) 
   
   <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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   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 1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25 (Thu Jan 07 08:07:05 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] godfreyhe commented on pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   Thanks for the review, I will resolve the conflict in my local and merge the pr


----------------------------------------------------------------
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] godfreyhe commented on pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   Thanks for the review, I will resolve the conflict in my local and merge the pr


----------------------------------------------------------------
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] godfreyhe closed pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

Posted by GitBox <gi...@apache.org>.
godfreyhe closed pull request #14574:
URL: https://github.com/apache/flink/pull/14574


   


----------------------------------------------------------------
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] wenlong88 commented on a change in pull request #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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



##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecHashWindowAggregate.java
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.MemorySize;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.ExecutionConfigOptions;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.calcite.FlinkRelBuilder.PlannerNamedWindowProperty;
+import org.apache.flink.table.planner.codegen.CodeGeneratorContext;
+import org.apache.flink.table.planner.codegen.agg.batch.HashWindowCodeGenerator;
+import org.apache.flink.table.planner.codegen.agg.batch.WindowCodeGenerator;
+import org.apache.flink.table.planner.delegation.PlannerBase;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
+import org.apache.flink.table.planner.plan.nodes.exec.utils.ExecNodeUtil;
+import org.apache.flink.table.planner.plan.utils.AggregateInfoList;
+import org.apache.flink.table.planner.plan.utils.AggregateUtil;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.table.runtime.generated.GeneratedOperator;
+import org.apache.flink.table.runtime.operators.CodeGenOperatorFactory;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.calcite.rel.core.AggregateCall;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/** Batch {@link ExecNode} for hash-based window aggregate operator. */
+public class BatchExecHashWindowAggregate extends ExecNodeBase<RowData>
+        implements BatchExecNode<RowData> {
+
+    private final int[] grouping;
+    private final int[] auxGrouping;
+    private final AggregateCall[] aggCalls;
+    private final LogicalWindow window;
+    private final int inputTimeFieldIndex;

Review comment:
       the same as Stream, we can get from LogicalWindow?

##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecHashWindowAggregate.java
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.MemorySize;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.ExecutionConfigOptions;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.calcite.FlinkRelBuilder.PlannerNamedWindowProperty;
+import org.apache.flink.table.planner.codegen.CodeGeneratorContext;
+import org.apache.flink.table.planner.codegen.agg.batch.HashWindowCodeGenerator;
+import org.apache.flink.table.planner.codegen.agg.batch.WindowCodeGenerator;
+import org.apache.flink.table.planner.delegation.PlannerBase;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
+import org.apache.flink.table.planner.plan.nodes.exec.utils.ExecNodeUtil;
+import org.apache.flink.table.planner.plan.utils.AggregateInfoList;
+import org.apache.flink.table.planner.plan.utils.AggregateUtil;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.table.runtime.generated.GeneratedOperator;
+import org.apache.flink.table.runtime.operators.CodeGenOperatorFactory;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.calcite.rel.core.AggregateCall;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/** Batch {@link ExecNode} for hash-based window aggregate operator. */
+public class BatchExecHashWindowAggregate extends ExecNodeBase<RowData>
+        implements BatchExecNode<RowData> {
+
+    private final int[] grouping;
+    private final int[] auxGrouping;
+    private final AggregateCall[] aggCalls;
+    private final LogicalWindow window;
+    private final int inputTimeFieldIndex;
+    private final boolean inputTimeIsDate;
+    private final PlannerNamedWindowProperty[] namedWindowProperties;
+    private final RowType aggInputRowType;
+    private final boolean enableAssignPane;
+    private final boolean isMerge;
+    private final boolean isFinal;
+
+    public BatchExecHashWindowAggregate(
+            int[] grouping,
+            int[] auxGrouping,
+            AggregateCall[] aggCalls,
+            LogicalWindow window,
+            int inputTimeFieldIndex,
+            boolean inputTimeIsDate,
+            PlannerNamedWindowProperty[] namedWindowProperties,
+            RowType aggInputRowType,
+            boolean enableAssignPane,
+            boolean isMerge,
+            boolean isFinal,
+            ExecEdge inputEdge,
+            RowType outputType,
+            String description) {
+        super(Collections.singletonList(inputEdge), outputType, description);
+        this.grouping = grouping;
+        this.auxGrouping = auxGrouping;
+        this.aggCalls = aggCalls;
+        this.window = window;
+        this.inputTimeFieldIndex = inputTimeFieldIndex;
+        this.inputTimeIsDate = inputTimeIsDate;
+        this.namedWindowProperties = namedWindowProperties;
+        this.aggInputRowType = aggInputRowType;
+        this.enableAssignPane = enableAssignPane;
+        this.isMerge = isMerge;
+        this.isFinal = isFinal;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected Transformation<RowData> translateToPlanInternal(PlannerBase planner) {
+        final ExecNode<RowData> inputNode = (ExecNode<RowData>) getInputNodes().get(0);
+        final Transformation<RowData> inputTransform = inputNode.translateToPlan(planner);
+
+        final AggregateInfoList aggInfos =
+                AggregateUtil.transformToBatchAggregateInfoList(
+                        aggInputRowType,
+                        JavaScalaConversionUtil.toScala(Arrays.asList(aggCalls)),
+                        null,
+                        null);
+
+        final TableConfig tableConfig = planner.getTableConfig();
+        final int groupBufferLimitSize =
+                tableConfig
+                        .getConfiguration()
+                        .getInteger(ExecutionConfigOptions.TABLE_EXEC_WINDOW_AGG_BUFFER_SIZE_LIMIT);
+
+        final Tuple2<Long, Long> windowSizeAndSlideSize = WindowCodeGenerator.getWindowDef(window);
+        final RowType inputRowType = (RowType) inputNode.getOutputType();
+        final HashWindowCodeGenerator hashWindowCodeGenerator =
+                new HashWindowCodeGenerator(
+                        new CodeGeneratorContext(tableConfig),
+                        planner.getRelBuilder(),
+                        window,
+                        inputTimeFieldIndex,
+                        inputTimeIsDate,
+                        JavaScalaConversionUtil.toScala(Arrays.asList(namedWindowProperties)),
+                        aggInfos,
+                        inputRowType,
+                        grouping,
+                        auxGrouping,
+                        enableAssignPane,
+                        isMerge,
+                        isFinal);
+        final GeneratedOperator<OneInputStreamOperator<RowData, RowData>> generatedOperator =
+                hashWindowCodeGenerator.gen(
+                        inputRowType,
+                        (RowType) getOutputType(),
+                        groupBufferLimitSize,
+                        0,
+                        windowSizeAndSlideSize.f0,
+                        windowSizeAndSlideSize.f1);
+
+        final long managedMemory =
+                MemorySize.parse(

Review comment:
       use the utility method

##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecSortWindowAggregate.java
##########
@@ -0,0 +1,150 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.streaming.api.transformations.OneInputTransformation;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.ExecutionConfigOptions;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.calcite.FlinkRelBuilder.PlannerNamedWindowProperty;
+import org.apache.flink.table.planner.codegen.CodeGeneratorContext;
+import org.apache.flink.table.planner.codegen.agg.batch.SortWindowCodeGenerator;
+import org.apache.flink.table.planner.codegen.agg.batch.WindowCodeGenerator;
+import org.apache.flink.table.planner.delegation.PlannerBase;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
+import org.apache.flink.table.planner.plan.utils.AggregateInfoList;
+import org.apache.flink.table.planner.plan.utils.AggregateUtil;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.table.runtime.generated.GeneratedOperator;
+import org.apache.flink.table.runtime.operators.CodeGenOperatorFactory;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.calcite.rel.core.AggregateCall;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/** Batch {@link ExecNode} for sort-based window aggregate operator. */
+public class BatchExecSortWindowAggregate extends ExecNodeBase<RowData>
+        implements BatchExecNode<RowData> {
+
+    private final int[] grouping;
+    private final int[] auxGrouping;
+    private final AggregateCall[] aggCalls;
+    private final LogicalWindow window;
+    private final int inputTimeFieldIndex;

Review comment:
       ditto

##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecHashWindowAggregate.java
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.MemorySize;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.table.api.TableConfig;
+import org.apache.flink.table.api.config.ExecutionConfigOptions;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.calcite.FlinkRelBuilder.PlannerNamedWindowProperty;
+import org.apache.flink.table.planner.codegen.CodeGeneratorContext;
+import org.apache.flink.table.planner.codegen.agg.batch.HashWindowCodeGenerator;
+import org.apache.flink.table.planner.codegen.agg.batch.WindowCodeGenerator;
+import org.apache.flink.table.planner.delegation.PlannerBase;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
+import org.apache.flink.table.planner.plan.nodes.exec.utils.ExecNodeUtil;
+import org.apache.flink.table.planner.plan.utils.AggregateInfoList;
+import org.apache.flink.table.planner.plan.utils.AggregateUtil;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.table.runtime.generated.GeneratedOperator;
+import org.apache.flink.table.runtime.operators.CodeGenOperatorFactory;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.calcite.rel.core.AggregateCall;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+/** Batch {@link ExecNode} for hash-based window aggregate operator. */
+public class BatchExecHashWindowAggregate extends ExecNodeBase<RowData>
+        implements BatchExecNode<RowData> {
+
+    private final int[] grouping;
+    private final int[] auxGrouping;
+    private final AggregateCall[] aggCalls;
+    private final LogicalWindow window;
+    private final int inputTimeFieldIndex;
+    private final boolean inputTimeIsDate;

Review comment:
       the same as inputTimeFieldIndex




----------------------------------------------------------------
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 #14574: [FLINK-20857][table-planner-blink] Separate the implementation of batch window aggregate nodes

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11728",
       "triggerID" : "1bb0e2c9d4a79abdc7bf7ea88c33430512d89e25",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733",
       "triggerID" : "0c081c035965120267e8f86570fa8e7b43ee234d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775",
       "triggerID" : "a8d0d6432e87bb1a75525cb8fe1153232cd9d823",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b56d77364d5891f4d0139c102b19b427fd49d830",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c081c035965120267e8f86570fa8e7b43ee234d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11733) 
   * a8d0d6432e87bb1a75525cb8fe1153232cd9d823 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11775) 
   * b56d77364d5891f4d0139c102b19b427fd49d830 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