You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "hanyuzheng7 (via GitHub)" <gi...@apache.org> on 2023/06/30 14:12:44 UTC
[GitHub] [flink] hanyuzheng7 commented on pull request #22917: [FLINK-32498][table] Fix the problem of array_max return type, it sho…
hanyuzheng7 commented on PR #22917:
URL: https://github.com/apache/flink/pull/22917#issuecomment-1614713400
> the return type is not right. it should always return nullable.
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);
}
}
}
```
So can you tell which cases will have bug during use this TypeStrategy, I've been thinking about this for a long time.
--
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