macroguo-ghy commented on code in PR #3373:
URL: https://github.com/apache/calcite/pull/3373#discussion_r1299376297
##########
core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java:
##########
@@ -510,6 +510,30 @@ public static SqlOperandTypeChecker variadic(
}
};
+ public static final SqlSingleOperandTypeChecker ARRAY_OF_INTEGER =
+ new SqlSingleOperandTypeChecker() {
+ @Override public boolean checkSingleOperandType(SqlCallBinding
callBinding, SqlNode operand,
+ int iFormalOperand, boolean throwOnFailure) {
+ assert 0 == iFormalOperand;
+ RelDataType type = SqlTypeUtil.deriveType(callBinding, operand);
+ RelDataType componentType =
+ requireNonNull(type.getComponentType(), "componentType");
+ if (SqlTypeUtil.isArray(type)
+ && SqlTypeUtil.isIntType(componentType)) {
+ return true;
+ }
+
+ if (throwOnFailure) {
+ throw callBinding.newValidationSignatureError();
+ }
+ return false;
+ }
+
+ @Override public String getAllowedSignatures(SqlOperator op, String
opName) {
+ return opName + "(<INTEGER ARRAY>)";
+ }
+ };
+
Review Comment:
Done.
--
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]