Skip to content

Commit

Permalink
[FLINK-22484][table] Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
snuyanzin committed Mar 12, 2023
1 parent b65f818 commit d7b14d4
Showing 1 changed file with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.apache.flink.table.api.DataTypes;
import org.apache.flink.table.api.JsonOnNull;
import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
import org.apache.flink.table.types.CollectionDataType;
import org.apache.flink.table.types.KeyValueDataType;
import org.apache.flink.table.types.inference.ArgumentTypeStrategy;
import org.apache.flink.table.types.inference.ConstantArgumentCount;
import org.apache.flink.table.types.inference.InputTypeStrategies;
Expand Down Expand Up @@ -129,35 +131,26 @@ public final class SpecificInputTypeStrategies {
callContext ->
Optional.of(
DataTypes.ARRAY(
callContext
.getArgumentDataTypes()
.get(0)
.getChildren()
.get(0))
.nullable());
((KeyValueDataType) callContext.getArgumentDataTypes().get(0))
.getKeyDataType()));

/** Type strategy specific for {@link BuiltInFunctionDefinitions#MAP_VALUES}. */
public static final TypeStrategy MAP_VALUES =
callContext ->
Optional.of(
DataTypes.ARRAY(
callContext
.getArgumentDataTypes()
.get(0)
.getChildren()
.get(1)));
((KeyValueDataType) callContext.getArgumentDataTypes().get(0))
.getValueDataType()));

/** Type strategy specific for {@link BuiltInFunctionDefinitions#MAP_FROM_ARRAYS}. */
public static final TypeStrategy ARRAYS_FOR_MAP =
callContext ->
Optional.of(
DataTypes.MAP(
callContext.getArgumentDataTypes().get(0).getChildren().get(0),
callContext
.getArgumentDataTypes()
.get(1)
.getChildren()
.get(0)));
((CollectionDataType) callContext.getArgumentDataTypes().get(0))
.getElementDataType(),
((CollectionDataType) callContext.getArgumentDataTypes().get(1))
.getElementDataType()));

private SpecificInputTypeStrategies() {
// no instantiation
Expand Down

0 comments on commit d7b14d4

Please sign in to comment.