hanyuzheng7 commented on code in PR #22917:
URL: https://github.com/apache/flink/pull/22917#discussion_r1247910219
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/strategies/SpecificTypeStrategies.java:
##########
@@ -58,8 +58,12 @@ public final class SpecificTypeStrategies {
/** See {@link ArrayTypeStrategy}. */
public static final TypeStrategy ARRAY = new ArrayTypeStrategy();
- /** See {@link ArrayElementOutputTypeStrategy}. */
- public static final TypeStrategy ARRAY_ELEMENT = new
ArrayElementOutputTypeStrategy();
+ /** Type strategy specific for array element. */
+ public static final TypeStrategy ARRAY_ELEMENT =
+ callContext ->
+ Optional.of(
Review Comment:
It seem the return in this class is always nullable. so why you change it?
```
/** Specific {@link TypeStrategy} for {@link
BuiltInFunctionDefinitions#ARRAY_MAX}. */
@Internal
public class ArrayElementOutputTypeStrategy implements TypeStrategy {
@Override
public Optional<DataType> inferType(CallContext callContext) {
DataType inputDataType = callContext.getArgumentDataTypes().get(0);
if (inputDataType.getLogicalType().getTypeRoot() !=
LogicalTypeRoot.ARRAY) {
return Optional.empty();
}
final DataType elementDataType = ((CollectionDataType)
inputDataType).getElementDataType();
if (inputDataType.getLogicalType().isNullable()) {
return Optional.of(elementDataType.nullable());
} else {
return Optional.of(elementDataType);
}
}
}
```
--
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]