Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roundDecimal() fails for null FLOAT values #15255

Open
pauladams12345 opened this issue Mar 12, 2025 · 0 comments
Open

roundDecimal() fails for null FLOAT values #15255

pauladams12345 opened this issue Mar 12, 2025 · 0 comments

Comments

@pauladams12345
Copy link

Description

When executing a query which uses the roundDecimal function, the query will fail if the column being rounded is a FLOAT data type and any value for that column is null.

The roundDecimal function works as expected if operating on a DOUBLE column. The function also works correctly for FLOAT columns if all values queried are non-null.

Example

Schema

{  
  "schemaName": "example_table",  
  "enableColumnBasedNullHandling": true,  
  "dimensionFieldSpecs": [  
    {  
      "name": "field",  
      "dataType": "FLOAT",  
      "notNull": false  
  },
  ...

Table Contents

field timestamp
1.43 1741801200
null 1741801300

Query

SET enableNullHandling=TRUE;
SELECT roundDecimal(field, 1) FROM example_table

Expected behavior

Returns: [1.4, null]

Observed behavior:

Error Code: 200

QueryExecutionError:
java.lang.RuntimeException: Caught exception while doing operator: class org.apache.pinot.core.operator.AcquireReleaseColumnsSegmentOperator on segment: example_table__6__156__20250121T1349Z
	at org.apache.pinot.core.operator.combine.BaseCombineOperator.wrapOperatorException(BaseCombineOperator.java:197)
	at org.apache.pinot.core.operator.combine.BaseSingleBlockCombineOperator.processSegments(BaseSingleBlockCombineOperator.java:96)
	at org.apache.pinot.core.operator.combine.BaseCombineOperator$1.runJob(BaseCombineOperator.java:118)
	at org.apache.pinot.core.util.trace.TraceRunnable.run(TraceRunnable.java:40)
...
Caused by: java.lang.NumberFormatException: Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
	at java.base/java.math.BigDecimal.<init>(BigDecimal.java:608)
	at java.base/java.math.BigDecimal.<init>(BigDecimal.java:497)
	at java.base/java.math.BigDecimal.<init>(BigDecimal.java:903)
	at java.base/java.math.BigDecimal.valueOf(BigDecimal.java:1371)

Workarounds

Coalesce null values to null:

SET enableNullHandling=TRUE;
SELECT roundDecimal(COALESCE(field, null), 1) FROM example_table

Filter out null values (not applicable to all use cases):

SET enableNullHandling=TRUE;
SELECT roundDecimal(field, 1) FROM example_table WHERE field IS NOT NULL

Affected versions

This bug exists in Pinot v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant