xiangfu0 commented on code in PR #19012:
URL: https://github.com/apache/pinot/pull/19012#discussion_r3610260937
##########
pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java:
##########
@@ -317,6 +319,41 @@ private static RelDataType
positionalReturnTypeInferenceFromStringLiteral(SqlOpe
return opBinding.getTypeFactory().createSqlType(defaultSqlType);
}
+ private static RelDataType
jsonExtractScalarReturnTypeInference(SqlOperatorBinding opBinding) {
+ if (opBinding.getOperandCount() > 2 && opBinding.isOperandLiteral(2,
false)) {
+ String resultsType = opBinding.getOperandLiteralValue(2,
String.class).toUpperCase();
+ RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
+ switch (resultsType) {
+ case "JSON":
+ return typeFactory.createSqlType(SqlTypeName.VARCHAR);
+ case "BOOLEAN_ARRAY":
+ return
typeFactory.createArrayType(typeFactory.createSqlType(SqlTypeName.BOOLEAN), -1);
+ case "TIMESTAMP_ARRAY":
+ return
typeFactory.createArrayType(typeFactory.createSqlType(SqlTypeName.TIMESTAMP),
-1);
+ default:
+ break;
+ }
Review Comment:
Fixed in 725e07278c: added BIG_DECIMAL_ARRAY to Calcite ARRAY<DECIMAL>
return-type inference and added planner regression coverage through
jsonExtractScalarFirstMatch. Multi-stage physical lowering remains DOUBLE_ARRAY
and is now documented explicitly.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]