hanyuzheng7 commented on code in PR #22730:
URL: https://github.com/apache/flink/pull/22730#discussion_r1223301793
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/BuiltInFunctionDefinitions.java:
##########
@@ -272,6 +281,61 @@ ANY, and(logical(LogicalTypeRoot.BOOLEAN), LITERAL)
"org.apache.flink.table.runtime.functions.scalar.ArrayUnionFunction")
.build();
+ public static final BuiltInFunctionDefinition ARRAY_MAX =
+ BuiltInFunctionDefinition.newBuilder()
+ .name("ARRAY_MAX")
+ .kind(SCALAR)
+ .inputTypeStrategy(
+ new InputTypeStrategy() {
+ @Override
+ public ArgumentCount getArgumentCount() {
+ return ConstantArgumentCount.of(1);
+ }
+
+ @Override
+ public Optional<List<DataType>>
inferInputTypes(
+ CallContext callContext, boolean
throwOnFailure) {
+ DataType inputDataType =
+
callContext.getArgumentDataTypes().get(0);
+ if (!(inputDataType.getLogicalType()
instanceof ArrayType)) {
+ return Optional.empty();
+ }
+ DataType elementDataType =
+ ((CollectionDataType)
inputDataType)
+ .getElementDataType();
+ if (!Comparable.class.isAssignableFrom(
+
elementDataType.getConversionClass())) {
+ return Optional.empty();
+ }
+ return
Optional.of(callContext.getArgumentDataTypes());
+ }
+
+ @Override
+ public List<Signature> getExpectedSignatures(
+ FunctionDefinition definition) {
+ return Collections.singletonList(
+ Signature.of(
+
Signature.Argument.of("<ARRAY<COMPARABLE>>")));
+ }
+ })
+ .outputTypeStrategy(
+ new TypeStrategy() {
Review Comment:
ok
--
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]