Jackie-Jiang commented on code in PR #12118:
URL: https://github.com/apache/pinot/pull/12118#discussion_r1431875567


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java:
##########
@@ -1512,6 +1517,30 @@ private void computeResultsForLiteral(Literal literal, 
List<String> columnNames,
         columnTypes.add(DataSchema.ColumnDataType.UNKNOWN);
         row.add(null);
         break;
+      case BIG_DECIMAL_VALUE:

Review Comment:
   (nit) Move this after `DOUBLE_VALUE`



##########
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java:
##########
@@ -163,6 +166,37 @@ public static Expression getLiteralExpression(boolean 
value) {
     return expression;
   }
 
+  public static Expression getLiteralExpression(int[] value) {

Review Comment:
   (nit) Move them after the single value methods



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/CastTransformFunction.java:
##########
@@ -56,6 +56,10 @@ public void init(List<TransformFunction> arguments, 
Map<String, ColumnContext> c
     TransformFunction castFormatTransformFunction = arguments.get(1);
     if (castFormatTransformFunction instanceof LiteralTransformFunction) {
       String targetType = ((LiteralTransformFunction) 
castFormatTransformFunction).getStringLiteral().toUpperCase();
+      if ("OBJECT".equals(targetType)) {

Review Comment:
   Hmm, what does `CAST to OBJECT` mean?



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/utils/TypeUtils.java:
##########
@@ -66,6 +66,12 @@ public static Object convert(Object value, ColumnDataType 
storedType) {
         if (value instanceof FloatArrayList) {
           // For ArrayAggregationFunction
           return ((FloatArrayList) value).elements();
+        } else if (value instanceof double[]) {

Review Comment:
   Why do we need this special handling?



##########
pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java:
##########
@@ -171,13 +180,70 @@ private static RexNode 
evaluateLiteralOnlyFunction(RexCall rexCall, RexBuilder r
           "Caught exception while converting result value: " + resultValue + " 
to type: " + rexNodeType, e);
     }
     try {
+      if (rexNodeType instanceof ArraySqlType) {
+        List<Object> resultValues = new ArrayList<>();
+        assert resultValue != null;

Review Comment:
   Why?



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java:
##########
@@ -1512,6 +1517,30 @@ private void computeResultsForLiteral(Literal literal, 
List<String> columnNames,
         columnTypes.add(DataSchema.ColumnDataType.UNKNOWN);
         row.add(null);
         break;
+      case BIG_DECIMAL_VALUE:
+        columnTypes.add(DataSchema.ColumnDataType.BIG_DECIMAL);
+        row.add(BigDecimalUtils.deserialize(literal.getBigDecimalValue()));
+        break;
+      case INT_ARRAY_VALUE:
+        columnTypes.add(DataSchema.ColumnDataType.INT_ARRAY);
+        row.add(literal.getIntArrayValue());
+        break;
+      case LONG_ARRAY_VALUE:
+        columnTypes.add(DataSchema.ColumnDataType.LONG_ARRAY);
+        row.add(literal.getLongArrayValue());
+        break;
+      case FLOAT_ARRAY_VALUE:
+        columnTypes.add(DataSchema.ColumnDataType.FLOAT_ARRAY);
+        
row.add(literal.getFloatArrayValue().stream().map(Float::intBitsToFloat).collect(Collectors.toList()));
+        break;
+      case DOUBLE_ARRAY_VALUE:
+        columnTypes.add(DataSchema.ColumnDataType.DOUBLE_ARRAY);
+        row.add(literal.getDoubleArrayValue());
+        break;
+      case STRING_ARRAY_VALUE:
+        columnTypes.add(DataSchema.ColumnDataType.STRING_ARRAY);
+        row.add(literal.getStringArrayValue());
+        break;
       default:

Review Comment:
   Not introduced in this PR, but should we throw exception here?



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to