rubenada commented on code in PR #3237:
URL: https://github.com/apache/calcite/pull/3237#discussion_r1219413878
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -937,6 +937,14 @@ private static RelDataType
arrayReturnType(SqlOperatorBinding opBinding) {
ReturnTypes.LEAST_RESTRICTIVE,
OperandTypes.AT_LEAST_ONE_SAME_VARIADIC);
+ /** The "ARRAY_TO_STRING(array, delimiter [, nullText ])" function. */
+ @LibraryOperator(libraries = {BIG_QUERY})
+ public static final SqlFunction ARRAY_TO_STRING =
+ SqlBasicFunction.create(SqlKind.ARRAY_TO_STRING,
+ ReturnTypes.explicit(SqlTypeName.VARCHAR)
Review Comment:
There are already 5 places (this would be the 6th) in SqlLibraryOperators
(and another one in SqlRegexpReplaceFunction) that use the code
`ReturnTypes.explicit(SqlTypeName.VARCHAR).andThen(SqlTypeTransforms.TO_NULLABLE)`
Why don't we just create in `ReturnTypes`:
```
public static final SqlReturnTypeInference VARCHAR_NULLABLE =
explicit(SqlTypeName.VARCHAR).andThen(SqlTypeTransforms.TO_NULLABLE)
```
and use simply `ReturnTypes.VARCHAR_NULLABLE` in all those places (include
the new ARRAY_TO_STRING definition)?
--
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]