2121import org .apache .flink .annotation .Internal ;
2222import org .apache .flink .table .api .TableException ;
2323import org .apache .flink .table .catalog .DataTypeFactory ;
24- import org .apache .flink .table .connector .ChangelogMode ;
25- import org .apache .flink .table .functions .ChangelogFunction .ChangelogContext ;
2624import org .apache .flink .table .types .DataType ;
25+ import org .apache .flink .table .types .inference .ChangelogModeStrategy ;
2726import org .apache .flink .table .types .inference .InputTypeStrategy ;
2827import org .apache .flink .table .types .inference .StaticArgument ;
2928import org .apache .flink .table .types .inference .TypeInference ;
3534import java .util .Arrays ;
3635import java .util .Locale ;
3736import java .util .Optional ;
38- import java .util .function .Function ;
3937import java .util .regex .Pattern ;
4038
4139import static org .apache .flink .util .Preconditions .checkArgument ;
@@ -75,7 +73,7 @@ public final class BuiltInFunctionDefinition implements SpecializedFunction {
7573
7674 private final SqlCallSyntax sqlCallSyntax ;
7775
78- private final @ Nullable Function < ChangelogContext , ChangelogMode > changelogModeResolver ;
76+ private final @ Nullable ChangelogModeStrategy changelogModeStrategy ;
7977
8078 private final String sqlName ;
8179
@@ -90,7 +88,7 @@ private BuiltInFunctionDefinition(
9088 boolean isRuntimeProvided ,
9189 String runtimeClass ,
9290 boolean isInternal ,
93- @ Nullable Function < ChangelogContext , ChangelogMode > changelogModeResolver ) {
91+ @ Nullable ChangelogModeStrategy changelogModeStrategy ) {
9492 this .name = checkNotNull (name , "Name must not be null." );
9593 this .sqlName = sqlName ;
9694 this .version = isInternal ? null : version ;
@@ -101,7 +99,7 @@ private BuiltInFunctionDefinition(
10199 this .runtimeClass = runtimeClass ;
102100 this .isInternal = isInternal ;
103101 this .sqlCallSyntax = sqlCallSyntax ;
104- this .changelogModeResolver = changelogModeResolver ;
102+ this .changelogModeStrategy = changelogModeStrategy ;
105103 validateFunction (this .name , this .version , this .isInternal );
106104 }
107105
@@ -139,11 +137,11 @@ public boolean isInternal() {
139137 }
140138
141139 /**
142- * Returns the optional changelog mode resolver for built-in PTFs that emit updates (e.g.,
140+ * Returns the optional {@link ChangelogModeStrategy} for built-in PTFs that emit updates (e.g.,
143141 * FROM_CHANGELOG). The planner uses this to determine the output changelog mode.
144142 */
145- public Optional <Function < ChangelogContext , ChangelogMode >> getChangelogModeResolver () {
146- return Optional .ofNullable (changelogModeResolver );
143+ public Optional <ChangelogModeStrategy > getChangelogModeStrategy () {
144+ return Optional .ofNullable (changelogModeStrategy );
147145 }
148146
149147 public String getQualifiedName () {
@@ -268,7 +266,7 @@ public static final class Builder {
268266
269267 private SqlCallSyntax sqlCallSyntax = SqlCallSyntax .FUNCTION ;
270268
271- private @ Nullable Function < ChangelogContext , ChangelogMode > changelogModeResolver ;
269+ private @ Nullable ChangelogModeStrategy changelogModeStrategy ;
272270
273271 public Builder () {
274272 // default constructor to allow a fluent definition
@@ -417,12 +415,11 @@ public Builder sqlName(String name) {
417415 }
418416
419417 /**
420- * Sets a resolver that determines the output {@link ChangelogMode} for this built-in
421- * function . Only needed for functions that emit updates (e.g., FROM_CHANGELOG).
418+ * Sets the {@link ChangelogModeStrategy} that determines the output changelog mode for this
419+ * built-in PTF . Only needed for PTFs that emit updates (e.g., FROM_CHANGELOG).
422420 */
423- public Builder changelogModeResolver (
424- Function <ChangelogContext , ChangelogMode > changelogModeResolver ) {
425- this .changelogModeResolver = changelogModeResolver ;
421+ public Builder changelogModeStrategy (ChangelogModeStrategy changelogModeStrategy ) {
422+ this .changelogModeStrategy = changelogModeStrategy ;
426423 return this ;
427424 }
428425
@@ -438,7 +435,7 @@ public BuiltInFunctionDefinition build() {
438435 isRuntimeProvided ,
439436 runtimeClass ,
440437 isInternal ,
441- changelogModeResolver );
438+ changelogModeStrategy );
442439 }
443440 }
444441}
0 commit comments