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 2026/10/22 15:38:38 UTC
[PR] [FLINK-41065][table] Allow process table functions to exclude state entries per call [flink]
twalthr opened a new pull request, #29566:
URL: https://github.com/apache/flink/pull/29566
## What is the purpose of the change
Process table functions with a custom `TypeInference` can declare several state entries via `StateTypeStrategy`. Until now, every declared entry had to be inferable: a `StateTypeStrategy#inferType` returning `Optional.empty()` failed planning with "Could not infer a data type for state entry '...'".
This PR gives `Optional.empty()` a meaning for process table functions: the state entry is not used by this call. A function can therefore declare a superset of state entries and let the type inference decide which ones a specific call needs, with matching `eval()` / `onTimer()` overloads.
## Brief change log
- `TypeInferenceUtil#inferStateInfos` excludes state entries whose `StateTypeStrategy` returns `Optional.empty()`. `ProcessTableRunnerGenerator` and `StreamExecProcessTableFunction` derive state positions and names from the resulting map, so `eval()` / `onTimer()` resolve to the overload without a parameter for the excluded entry.
- An empty accumulator (`acc`) of aggregating functions and an untyped `NULL` still fail with a `ValidationException`.
- `StateTypeStrategy` explicitly overrides `inferType` and documents the semantics for PTFs and aggregating functions.
- `ProcessTableFunctionTestHarness` skips excluded state entries instead of throwing.
## Verifying this change
This change added tests and can be verified as follows:
- Added `process-optional-state` to `ProcessTableFunctionSemanticTests`. It calls one PTF twice in a `UNION ALL` (different `uid`s). The PTF declares two state entries, and its type inference excludes the second one for `mode => 1`. It has two `eval()` and two `onTimer()` overloads, each pair covering one of the two calls.
- Added `ProcessTableFunctionTestHarnessTest#testStateEntryExcludedByTypeInference`. It fails without the harness change with `Could not infer data type for state parameter 'unused'`.
## 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 (`StateTypeStrategy` is `@PublicEvolving`; only the meaning of an empty result changes, no signature changes)
- 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: no
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? JavaDocs
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (claude-sonnet-5-5)
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359101120
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/BuiltInProcessTableFunction.java:
##########
@@ -76,7 +99,85 @@ protected BuiltInProcessTableFunction(
.orElseThrow(IllegalStateException::new);
this.internalStateStrategies =
- toInternalStateStrategies(definitionTypeInference, callContext);
+ internalStateStrategies != null
+ ? internalStateStrategies
+ : toInternalStateStrategies(definitionTypeInference, callContext);
Review Comment:
Nothing here calls `internalState` or `customState`, and #29365 adds its own `toInternalStateType`. Will #29365 switch to these helpers?
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/BuiltInProcessTableFunction.java:
##########
@@ -76,7 +99,85 @@ protected BuiltInProcessTableFunction(
.orElseThrow(IllegalStateException::new);
this.internalStateStrategies =
- toInternalStateStrategies(definitionTypeInference, callContext);
+ internalStateStrategies != null
+ ? internalStateStrategies
+ : toInternalStateStrategies(definitionTypeInference, callContext);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies may infer
+ * external data types, they are converted to internal ones.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> internalState(
+ final Map.Entry<String, StateTypeStrategy>... entries) {
+ return state(BuiltInProcessTableFunction::toInternalStateStrategy, entries);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies must already
+ * infer the data types that the function works on, no internal conversion is applied.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> customState(
+ final Map.Entry<String, StateTypeStrategy>... entries) {
+ return state(UnaryOperator.identity(), entries);
+ }
+
+ private static LinkedHashMap<String, StateTypeStrategy> state(
+ final UnaryOperator<StateTypeStrategy> mapper,
+ final Map.Entry<String, StateTypeStrategy>[] entries) {
+ final LinkedHashMap<String, StateTypeStrategy> result = new LinkedHashMap<>();
+ for (final Map.Entry<String, StateTypeStrategy> entry : entries) {
+ result.put(entry.getKey(), mapper.apply(entry.getValue()));
+ }
+ return result;
+ }
+
+ private static StateTypeStrategy toInternalStateStrategy(final StateTypeStrategy strategy) {
Review Comment:
I think `toInternalStateStrategies` could use this too, so definition-declared state keeps its view wrapper and `isBroadcast`. PTF suites stay green with that 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:
Fair enough. Users can rely on it now though, so the Jira should get a release note.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on PR #29566:
URL: https://github.com/apache/flink/pull/29566#issuecomment-6365470309
> eventually have a docs page for advanced features
@gustavodemorais having a doc for advances features makes total sense. Definitely can be a followup, the question remains where we put this doc. I would like to avoid that downstream projects rely on internal features. I was actuallly thinking about splitting the PTF page soon, because it grew quite significantly.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359221093
##########
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:
Makes sense.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359334908
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/BuiltInProcessTableFunction.java:
##########
@@ -76,7 +99,85 @@ protected BuiltInProcessTableFunction(
.orElseThrow(IllegalStateException::new);
this.internalStateStrategies =
- toInternalStateStrategies(definitionTypeInference, callContext);
+ internalStateStrategies != null
+ ? internalStateStrategies
+ : toInternalStateStrategies(definitionTypeInference, callContext);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies may infer
+ * external data types, they are converted to internal ones.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> internalState(
+ final Map.Entry<String, StateTypeStrategy>... entries) {
+ return state(BuiltInProcessTableFunction::toInternalStateStrategy, entries);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies must already
+ * infer the data types that the function works on, no internal conversion is applied.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> customState(
+ final Map.Entry<String, StateTypeStrategy>... entries) {
+ return state(UnaryOperator.identity(), entries);
+ }
+
+ private static LinkedHashMap<String, StateTypeStrategy> state(
+ final UnaryOperator<StateTypeStrategy> mapper,
+ final Map.Entry<String, StateTypeStrategy>[] entries) {
+ final LinkedHashMap<String, StateTypeStrategy> result = new LinkedHashMap<>();
+ for (final Map.Entry<String, StateTypeStrategy> entry : entries) {
+ result.put(entry.getKey(), mapper.apply(entry.getValue()));
+ }
+ return result;
+ }
+
+ private static StateTypeStrategy toInternalStateStrategy(final StateTypeStrategy strategy) {
Review Comment:
Now I got it. Makes sense.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "gustavodemorais (via GitHub)" <gi...@apache.org>.
gustavodemorais commented on PR #29566:
URL: https://github.com/apache/flink/pull/29566#issuecomment-6368258532
> @gustavodemorais having a doc for advances features makes total sense. Definitely can be a followup, the question remains where we put this doc. I would like to avoid that downstream projects rely on internal features. I was actuallly thinking about splitting the PTF page soon, because it grew quite significantly. We could move some parts to an advanced page.
Yes, I like the fact that we have everything in one page. But I agree it's slowly time to split and having it into an advanced page makes sense. Thanks!
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359263109
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/BuiltInProcessTableFunction.java:
##########
@@ -76,7 +99,85 @@ protected BuiltInProcessTableFunction(
.orElseThrow(IllegalStateException::new);
this.internalStateStrategies =
- toInternalStateStrategies(definitionTypeInference, callContext);
+ internalStateStrategies != null
+ ? internalStateStrategies
+ : toInternalStateStrategies(definitionTypeInference, callContext);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies may infer
+ * external data types, they are converted to internal ones.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> internalState(
+ final Map.Entry<String, StateTypeStrategy>... entries) {
+ return state(BuiltInProcessTableFunction::toInternalStateStrategy, entries);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies must already
+ * infer the data types that the function works on, no internal conversion is applied.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> customState(
+ final Map.Entry<String, StateTypeStrategy>... entries) {
+ return state(UnaryOperator.identity(), entries);
+ }
+
+ private static LinkedHashMap<String, StateTypeStrategy> state(
+ final UnaryOperator<StateTypeStrategy> mapper,
+ final Map.Entry<String, StateTypeStrategy>[] entries) {
+ final LinkedHashMap<String, StateTypeStrategy> result = new LinkedHashMap<>();
+ for (final Map.Entry<String, StateTypeStrategy> entry : entries) {
+ result.put(entry.getKey(), mapper.apply(entry.getValue()));
+ }
+ return result;
+ }
+
+ private static StateTypeStrategy toInternalStateStrategy(final StateTypeStrategy strategy) {
Review Comment:
I don't fully understand this comment. But if they want to use it, they can still make adjustements to this class later.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr merged PR #29566:
URL: https://github.com/apache/flink/pull/29566
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #29566:
URL: https://github.com/apache/flink/pull/29566#issuecomment-6344862827
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7192157a42e5b95db92e6040dfeb3856fbd9bd95",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "7192157a42e5b95db92e6040dfeb3856fbd9bd95",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7192157a42e5b95db92e6040dfeb3856fbd9bd95 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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359751406
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/BuiltInProcessTableFunction.java:
##########
@@ -76,7 +99,85 @@ protected BuiltInProcessTableFunction(
.orElseThrow(IllegalStateException::new);
this.internalStateStrategies =
- toInternalStateStrategies(definitionTypeInference, callContext);
+ internalStateStrategies != null
+ ? internalStateStrategies
+ : toInternalStateStrategies(definitionTypeInference);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies may infer
+ * external data types, they are converted to internal ones.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> internalState(
Review Comment:
Correct. I shared a PoC with him.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "gustavodemorais (via GitHub)" <gi...@apache.org>.
gustavodemorais commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359467266
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeInferenceUtil.java:
##########
@@ -583,24 +582,32 @@ 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 (callContext.getFunctionDefinition().getKind() == FunctionKind.PROCESS_TABLE) {
Review Comment:
Suggestion: could we add tests for the kept failure paths: an empty accumulator, a PTF state returning `DataTypes.NULL()`, and a PTF state named `acc` that is excluded?
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/BuiltInProcessTableFunction.java:
##########
@@ -76,7 +99,85 @@ protected BuiltInProcessTableFunction(
.orElseThrow(IllegalStateException::new);
this.internalStateStrategies =
- toInternalStateStrategies(definitionTypeInference, callContext);
+ internalStateStrategies != null
+ ? internalStateStrategies
+ : toInternalStateStrategies(definitionTypeInference);
+ }
+
+ /**
+ * Declares the state entries of a specialized function in order. The strategies may infer
+ * external data types, they are converted to internal ones.
+ */
+ @SafeVarargs
+ protected static LinkedHashMap<String, StateTypeStrategy> internalState(
Review Comment:
`internalState()` / `customState()` / `toInternalStateStrategy()` are not used by any built-in PTF and not tested. Will Vas' PR use them? If not, it might be worth adding one more test.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359235606
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/BuiltInProcessTableFunction.java:
##########
@@ -76,7 +99,85 @@ protected BuiltInProcessTableFunction(
.orElseThrow(IllegalStateException::new);
this.internalStateStrategies =
- toInternalStateStrategies(definitionTypeInference, callContext);
+ internalStateStrategies != null
+ ? internalStateStrategies
+ : toInternalStateStrategies(definitionTypeInference, callContext);
Review Comment:
Yes, this PR is a preparation for future contributions. To guide AI and contributors into the right direction.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4359737886
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TypeInferenceUtil.java:
##########
@@ -583,24 +582,32 @@ 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 (callContext.getFunctionDefinition().getKind() == FunctionKind.PROCESS_TABLE) {
Review Comment:
AI generated test for all these case. But in reality they cannot happen, only if you are an expert and override default behavior. It just blows up tests if we start testing things that are far away from how people use our system.
--
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-41065][table] Allow process table functions to exclude state entries per call [flink]
Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29566:
URL: https://github.com/apache/flink/pull/29566#discussion_r4358525282
##########
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:
I would say this is a grey zone. The interface itself has not changed. Also code implementing it won't. Only the internal utility produces one error less.
--
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