You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "BrendanStans21 (via GitHub)" <gi...@apache.org> on 2024/01/12 20:47:43 UTC

[I] getBigDecimal throws exception if the decimal value has a scale greater than 0 [pinot]

BrendanStans21 opened a new issue, #12266:
URL: https://github.com/apache/pinot/issues/12266

   If the decimal value in the column being passed into the getBigDecimal() method in the PinotResultSet class has a scale greater than 0, the method will throw an exception.  Any application that uses Pinot and needs to use this method to get a decimal value will fail if the value in the table has a scale greater than 0.
   
   Suggested Solution:
   
   Because we already have access to the value in this method, we can call a separate method before setting the scale to determine the actual scale of the value.  This way any decimal value can be retrieved using this method.  The solution would look something like this:
   1. in getBigDecimal()
   ```
         String value = this.getString(columnIndex);
         int calculatedScale = getCalculatedScale(value)
         return value == null ? null : new BigDecimal(value).setScale(calculatedScale);
   ```
   2. Inside the getCalculatedScale would look like this:
   ```
           int index = value.indexOf(".");
           return index == -1 ? 0 : value.length() - index - 1;
   ```


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


Re: [I] getBigDecimal() throws exception if the decimal value has a scale greater than 0 [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on issue #12266:
URL: https://github.com/apache/pinot/issues/12266#issuecomment-1957853818

   Fixed by #12326 


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


Re: [I] getBigDecimal() throws exception if the decimal value has a scale greater than 0 [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang closed issue #12266: getBigDecimal() throws exception if the decimal value has a scale greater than 0
URL: https://github.com/apache/pinot/issues/12266


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


Re: [I] getBigDecimal() throws exception if the decimal value has a scale greater than 0 [pinot]

Posted by "walterddr (via GitHub)" <gi...@apache.org>.
walterddr commented on issue #12266:
URL: https://github.com/apache/pinot/issues/12266#issuecomment-1896992163

   this is actually a good point. 
   in ResultSet getBigDecimal(String value, int scale) has been deprecated since Java 1.2. 
   it seems like deriving the precision/scale from the value is the right way to go. 
   
   


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