Jackie-Jiang commented on code in PR #10650: URL: https://github.com/apache/pinot/pull/10650#discussion_r1206034842
########## pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java: ########## @@ -90,32 +90,55 @@ static Pair<FieldSpec.DataType, Object> inferLiteralDataTypeAndValue(String lite public LiteralContext(Literal literal) { Preconditions.checkState(literal.getFieldValue() != null, "Field value cannot be null for field:" + literal.getSetField()); - switch (literal.getSetField()){ + switch (literal.getSetField()) { case BOOL_VALUE: _type = FieldSpec.DataType.BOOLEAN; _value = literal.getFieldValue(); + _bigDecimalValue = PinotDataType.BOOLEAN.toBigDecimal(_value); break; case DOUBLE_VALUE: - _type = FieldSpec.DataType.DOUBLE; - _value = literal.getFieldValue(); + Number floatingNumber = NumberUtils.createNumber(literal.getFieldValue().toString()); + _bigDecimalValue = new BigDecimal(literal.getFieldValue().toString()); + if (floatingNumber instanceof Float) { + _type = FieldSpec.DataType.FLOAT; + _value = _bigDecimalValue.floatValue(); + } else { + _type = FieldSpec.DataType.DOUBLE; + _value = _bigDecimalValue.doubleValue(); + } break; case LONG_VALUE: - _type = FieldSpec.DataType.LONG; - _value = literal.getFieldValue(); + Number integralNumber = NumberUtils.createNumber(literal.getFieldValue().toString()); Review Comment: Can be simplified with checking if the long value is between Integer.MIN to Integer.MAX ########## pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java: ########## @@ -86,6 +86,10 @@ public double getDoubleLiteral() { return _doubleLiteral; } + public float getFloatLiteral() { Review Comment: (nit) Move it above `getDoubleLiteral()` -- 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