What is the bug?
Some math functions return ±NaN instead of NULL. NaN is not serializable by GSON lib.
For example, LN uses Math.log which returns -NaN for negative values.
|
v -> new ExprDoubleValue(Math.log(v.doubleValue()))), |
How can one reproduce the bug?
opensearchsql> select LN(-12.34567);
{'reason': 'Invalid SQL query', 'details': 'NaN is not a valid double value as per JSON specification. To override this behavior, use GsonBuilder.serializeSpecialFloatingPointValues() method.', 'type': 'IllegalArgumentException'}
What is the expected behavior?
mysql> select LN(-12.34567);
+---------------+
| LN(-12.34567) |
+---------------+
| NULL |
+---------------+
What is your host/environment?
main @ 9d4a841
Do you have any additional context?
Fix all math functions or patch serializer callee in protocol module to replace all ±NaN by NULLs.
What is the bug?
Some math functions return
±NaNinstead ofNULL.NaNis not serializable by GSON lib.For example,
LNusesMath.logwhich returns-NaNfor negative values.sql/core/src/main/java/org/opensearch/sql/expression/operator/arthmetic/MathematicalFunction.java
Line 220 in 9d4a841
How can one reproduce the bug?
What is the expected behavior?
What is your host/environment?
main@ 9d4a841Do you have any additional context?
Fix all math functions or patch serializer callee in
protocolmodule to replace all±NaNbyNULLs.