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 2020/10/27 07:02:09 UTC

[GitHub] [flink] WeiZhong94 opened a new pull request #13804: [FLINK-19233][python] support distinct and filter keywords on Python UDAF.

WeiZhong94 opened a new pull request #13804:
URL: https://github.com/apache/flink/pull/13804


   ## What is the purpose of the change
   
   *This pull request supports distinct and filter keywords on Python UDAF.*
   
   
   ## Brief change log
   
     - *Support distinct keyword on Python UDAF.*
     - *support filter keyword on Python UDAF.*
   
   ## Verifying this change
   
   This change is already covered by existing tests.
   
   ## 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): (yes)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - 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 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] dianfu closed pull request #13804: [FLINK-19233][python] Support distinct and filter keywords on Python UDAF

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


   


----------------------------------------------------------------
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 #13804: [FLINK-19233][python] Support distinct and filter keywords on Python UDAF

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "triggerType" : "PUSH"
     }, {
       "hash" : "73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8396",
       "triggerID" : "73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3 UNKNOWN
   * 73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8396) 
   
   <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 #13804: [FLINK-19233][python] Support distinct and filter keywords on Python UDAF

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "triggerType" : "PUSH"
     }, {
       "hash" : "73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3 UNKNOWN
   * 73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11 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 #13804: [FLINK-19233][python] Support distinct and filter keywords on Python UDAF

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "triggerType" : "PUSH"
     }, {
       "hash" : "73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8396",
       "triggerID" : "73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3 UNKNOWN
   * 73e7b9a8a0a994a9c3fdcf5e38456f255fa1dc11 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8396) 
   
   <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 #13804: [FLINK-19233][python] Support distinct and filter keywords on Python UDAF

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 46b133cb8ff1cfff2aadad0cf145c4dcd36edbc3 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] WeiZhong94 commented on pull request #13804: [FLINK-19233][python] Support distinct and filter keywords on Python UDAF

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


   @dianfu Thanks for your comments! I have updated this 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] dianfu commented on a change in pull request #13804: [FLINK-19233][python] Support distinct and filter keywords on Python UDAF

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



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/python/PythonAggregateFunctionInfo.java
##########
@@ -0,0 +1,63 @@
+/*
+ * 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.functions.python;
+
+import org.apache.flink.annotation.Internal;
+
+/**
+ * PythonFunctionInfo contains the execution information of a Python aggregate function, such as:

Review comment:
       ```suggestion
    * PythonAggregateFunctionInfo contains the execution information of a Python aggregate function, such as:
   ```

##########
File path: flink-python/pyflink/fn_execution/aggregate.py
##########
@@ -297,6 +300,10 @@ def __init__(self,
             self._get_value_indexes.remove(index_of_count_star)
         self._udf_data_view_specs = udf_data_view_specs
         self._udf_data_views = []
+        self._filter_args = filter_args
+        self._distinct_mapping = distinct_mapping
+        self._distinct_view_reuse_descriptors = distinct_view_reuse_descriptors
+        self._distinct_data_view = {}

Review comment:
       ```suggestion
           self._distinct_data_views = {}
   ```

##########
File path: flink-python/pyflink/table/tests/test_aggregate.py
##########
@@ -358,6 +386,48 @@ def test_map_view_iterate(self):
                 ["Hi,Hi2,Hi3", "1,2,3", "Hi:3,Hi2:2,Hi3:1", 3, "hi"]],
                 columns=['a', 'b', 'c', 'd', 'e']))
 
+    def test_distinct_and_filter(self):
+        self.t_env.create_temporary_system_function(
+            "concat",
+            ConcatAggregateFunction())
+        self.t_env.get_config().get_configuration().set_string(

Review comment:
       What's the purpose to set these configuration explicitly in this test case?

##########
File path: flink-python/pyflink/fn_execution/aggregate.py
##########
@@ -287,7 +287,10 @@ def __init__(self,
                  udfs: List[AggregateFunction],
                  input_extractors: List,
                  index_of_count_star: int,
-                 udf_data_view_specs: List[List[DataViewSpec]]):
+                 udf_data_view_specs: List[List[DataViewSpec]],
+                 filter_args: List[int],
+                 distinct_mapping: List[int],
+                 distinct_view_reuse_descriptors: Dict[int, Tuple['function', List[int]]]):

Review comment:
       ```suggestion
                    distinct_view_descriptors: Dict[int, Tuple['function', List[int]]]):
   ```

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/python/PythonAggregateFunctionInfo.java
##########
@@ -0,0 +1,63 @@
+/*
+ * 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.functions.python;
+
+import org.apache.flink.annotation.Internal;
+
+/**
+ * PythonFunctionInfo contains the execution information of a Python aggregate function, such as:
+ * the actual Python function, the input arguments, the filter arg, the distinct flag, etc.

Review comment:
       ```suggestion
    * the actual Python aggregation function, the input arguments, the filter arg, the distinct flag, etc.
   ```

##########
File path: flink-python/pyflink/fn_execution/operations.py
##########
@@ -285,23 +285,46 @@ def open(self):
     def generate_func(self, serialized_fn):
         user_defined_aggs = []
         input_extractors = []
+        filter_args = []
+        # stores which distinct view current function shared with
+        distinct_mapping = []

Review comment:
       ```suggestion
           distinct_view_indexes = []
   ```

##########
File path: flink-python/pyflink/fn_execution/aggregate.py
##########
@@ -287,7 +287,10 @@ def __init__(self,
                  udfs: List[AggregateFunction],
                  input_extractors: List,
                  index_of_count_star: int,
-                 udf_data_view_specs: List[List[DataViewSpec]]):
+                 udf_data_view_specs: List[List[DataViewSpec]],
+                 filter_args: List[int],
+                 distinct_mapping: List[int],

Review comment:
       ```suggestion
                    distinct_view_indexes: List[int],
   ```




----------------------------------------------------------------
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 #13804: [FLINK-19233][python] support distinct and filter keywords on Python UDAF.

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


   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 5ebc247ba0fd1827f7a12ba58d74b783fe1b0129 (Tue Oct 27 07:04:48 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-19233).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <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