You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "twalthr (via GitHub)" <gi...@apache.org> on 2024/11/18 11:45:54 UTC

[PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

twalthr opened a new pull request, #25665:
URL: https://github.com/apache/flink/pull/25665

   ## What is the purpose of the change
   
   Update TypeInference and introduce StateTypeStrategy, StaticArgument, StaticArgumentTraits and related declarations.
   According to FLIP-440.
   
   ## Brief change log
   
   - Generalize typedArguments/namedArguments to StaticArgument
   - Generalize accumulatorStrategy to StateTypeStrategy
   
   ## Verifying this change
   
   This change is already covered by existing tests, such as TypeInferenceExtractorTest.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: yes
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, 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? JavaDocs
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on PR #25665:
URL: https://github.com/apache/flink/pull/25665#issuecomment-2490399670

   Reviewed by Chi on 21/11/24 Need a committer / subject area expert to review. Notice that the Tests are failing 


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #25665:
URL: https://github.com/apache/flink/pull/25665#issuecomment-2482816293

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "9a8f75a63c72b83ead4717ff5671dd4ed86654a8",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9a8f75a63c72b83ead4717ff5671dd4ed86654a8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9a8f75a63c72b83ead4717ff5671dd4ed86654a8 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #25665:
URL: https://github.com/apache/flink/pull/25665#discussion_r1846647908


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinition.java:
##########
@@ -292,11 +293,18 @@ public Builder kind(FunctionKind kind) {
             return this;
         }
 
+        public Builder staticArguments(StaticArgument... staticArguments) {
+            this.typeInferenceBuilder.staticArguments(staticArguments);
+            return this;
+        }
+
+        /** @deprecated Use {@link #staticArguments(StaticArgument...)} instead. */

Review Comment:
   Of course. I missed this.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #25665:
URL: https://github.com/apache/flink/pull/25665#discussion_r1846688930


##########
flink-table/flink-sql-client/src/test/resources/sql/function.q:
##########
@@ -406,7 +406,7 @@ describe function extended temp_upperudf;
 |              requirements |                                         $VAR_UDF_JAR_PATH_SPACE [] |
 |          is deterministic |                                       $VAR_UDF_JAR_PATH_SPACE true |
 | supports constant folding |                                       $VAR_UDF_JAR_PATH_SPACE true |
-|                 signature |                $VAR_UDF_JAR_PATH_SPACE c1.db.temp_upperudf(STRING) |
+|                 signature |        $VAR_UDF_JAR_PATH_SPACE c1.db.temp_upperudf(arg0 => STRING) |

Review Comment:
   No, this is the SQL syntax for named arguments.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #25665:
URL: https://github.com/apache/flink/pull/25665#discussion_r1846638198


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinition.java:
##########
@@ -292,11 +293,18 @@ public Builder kind(FunctionKind kind) {
             return this;
         }
 
+        public Builder staticArguments(StaticArgument... staticArguments) {
+            this.typeInferenceBuilder.staticArguments(staticArguments);
+            return this;
+        }
+
+        /** @deprecated Use {@link #staticArguments(StaticArgument...)} instead. */

Review Comment:
   Shouldn't we add `@Deprecated` annotation as well?
   At least this is what javadoc for `@Deprecated` says
   >The @Deprecated annotation should always be present if the @deprecated javadoc tag is present, and vice-versa.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #25665:
URL: https://github.com/apache/flink/pull/25665#discussion_r1846690960


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/StateTypeStrategy.java:
##########
@@ -0,0 +1,24 @@
+/*
+ * 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.types.inference;
+
+/** Strategy for inferring a function call's intermediate result data type (i.e. state entry). */

Review Comment:
   From annotations, Java reflection or custom type inference. See e.g. org.apache.flink.table.types.extraction.TypeInferenceExtractor#forAggregateFunction



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on PR #25665:
URL: https://github.com/apache/flink/pull/25665#issuecomment-2490397302

   Reviewed by Chi on 21/11/24 Need a committer/ subject area expert to review


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on code in PR #25665:
URL: https://github.com/apache/flink/pull/25665#discussion_r1846682464


##########
flink-table/flink-sql-client/src/test/resources/sql/function.q:
##########
@@ -406,7 +406,7 @@ describe function extended temp_upperudf;
 |              requirements |                                         $VAR_UDF_JAR_PATH_SPACE [] |
 |          is deterministic |                                       $VAR_UDF_JAR_PATH_SPACE true |
 | supports constant folding |                                       $VAR_UDF_JAR_PATH_SPACE true |
-|                 signature |                $VAR_UDF_JAR_PATH_SPACE c1.db.temp_upperudf(STRING) |
+|                 signature |        $VAR_UDF_JAR_PATH_SPACE c1.db.temp_upperudf(arg0 => STRING) |

Review Comment:
   Does this mean that the function takes a function producing a string?  
   
   This is a surprising change to me.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on code in PR #25665:
URL: https://github.com/apache/flink/pull/25665#discussion_r1846685201


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/StateTypeStrategy.java:
##########
@@ -0,0 +1,24 @@
+/*
+ * 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.types.inference;
+
+/** Strategy for inferring a function call's intermediate result data type (i.e. state entry). */

Review Comment:
   How do UDAFs presently handle inferring intermediate state types?



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-36704] Update TypeInference with StaticArgument and StateTypeStrategy [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr merged PR #25665:
URL: https://github.com/apache/flink/pull/25665


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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