amrishlal commented on a change in pull request #6403:
URL: https://github.com/apache/incubator-pinot/pull/6403#discussion_r557232297



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/segment/index/readers/FloatDictionary.java
##########
@@ -30,7 +31,24 @@ public FloatDictionary(PinotDataBuffer dataBuffer, int 
length) {
 
   @Override
   public int insertionIndexOf(String stringValue) {
-    return binarySearch(Float.parseFloat(stringValue));
+    // First convert string to BigDecimal and then downcast to int. This 
allows type conversion from any compatible
+    // numerical value represented as string to an int value.
+    BigDecimal bigDecimal = new BigDecimal(stringValue);

Review comment:
       The expected behavior is that the query will still evaluate and produce 
results as long as the numerical value can be upcasted/downcasted to the column 
type. For example, the following works on MySQL and PostgreSQL.
   
   ```
   create table test(intColumn int, floatColumn float);
   insert into test values(5, 5.5);
   insert into test values(10, 15.56);
   
   select * from test where intColumn < 300.453;
   select * from test where intColumn < 300000000000000000000000.453;
   select * from test where floatColumn > 6;
   ```
   300000000000000000000000.453 is outside the bounds of Integer datatype, so 
it can't be represented as an Integer value, but gets parsed to something that 
can be compared to an integer.
   




----------------------------------------------------------------
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.

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