MartijnVisser commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4358447613


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeInferenceUtil.java:
##########
@@ -583,24 +580,28 @@ private static CastCallContext inferInputTypes(
         return castCallContext;
     }
 
-    private static StateInfo inferStateInfo(
+    private static Optional<StateInfo> inferStateInfo(
             CallContext callContext, String name, StateTypeStrategy 
stateTypeStrategy) {
         final DataType stateType = 
stateTypeStrategy.inferType(callContext).orElse(null);
-        if (stateType == null || isUnknown(stateType)) {
-            final String errorMessage;
+        if (stateType == null) {
             if 
(name.equals(UserDefinedFunctionHelper.DEFAULT_ACCUMULATOR_NAME)) {

Review Comment:
   I think this should check the function kind instead of the name: a PTF state 
entry named `acc` still fails with the accumulator error when excluded. 
Checking `FunctionKind.PROCESS_TABLE` instead works locally.



##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/StateTypeStrategy.java:
##########
@@ -19,13 +19,25 @@
 package org.apache.flink.table.types.inference;
 
 import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.functions.ProcessTableFunction;
+import org.apache.flink.table.types.DataType;
 
 import javax.annotation.Nullable;
 
 import java.time.Duration;
 import java.util.Optional;
 
-/** Strategy for inferring a function call's intermediate result data type 
(i.e. state entry). */
+/**
+ * Strategy for inferring a function call's intermediate result data type 
(i.e. state entry).
+ *
+ * <p>For {@link ProcessTableFunction}, returning {@link Optional#empty()} 
from {@link

Review Comment:
   `StateTypeStrategy` is `@PublicEvolving` and this changes what 
`Optional.empty()` means, so shouldn't the public API answer in the description 
be yes?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to