You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "shenyu0127 (via GitHub)" <gi...@apache.org> on 2023/05/06 00:19:03 UTC
[GitHub] [pinot] shenyu0127 commented on a diff in pull request #10650: [bugfix] fix floating point and integral type backward incompatible issue
shenyu0127 commented on code in PR #10650:
URL: https://github.com/apache/pinot/pull/10650#discussion_r1186566162
##########
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());
Review Comment:
Here you can do something simpler: https://stackoverflow.com/questions/26099818/how-quickly-check-whether-double-fits-in-float-java
##########
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:
If this PR is to fix backward incompatibility issue, why bother adding this method?
--
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-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org