1fanwang opened a new pull request, #5220:
URL: https://github.com/apache/calcite/pull/5220

   ## Jira Link
   
   [CALCITE-6792](https://issues.apache.org/jira/browse/CALCITE-6792)
   
   ## Changes Proposed
   
   A plan containing NaN or infinity cannot make a RelJson round trip. The 
writer emits those values as bare tokens, and the reader fails with:
   
   ```text
   JsonParseException: Non-standard token 'Infinity'
   ```
   
   Non-finite approximate literals are now written as JSON strings. When the 
declared type is approximate, the reader converts those strings back to 
doubles. Finite numbers remain numeric, and a character literal containing 
"Infinity" remains a string.
   
   ### Testing
   
   ```console
   $ SOURCE=core/src/main/java/org/apache/calcite/rel/externalize/RelJson.java
   $ git checkout 5e3326a0a8 -- "$SOURCE"
   $ JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :core:test \
       --tests 
'org.apache.calcite.plan.RelWriterTest.testNonFiniteApproxLiteral' \
       --no-daemon --console=plain
   Expected: "literal": "Infinity"
        but: "literal": Infinity
   1 completed, 1 failed, 0 skipped
   
   $ git checkout 9bace4f2d8 -- "$SOURCE"
   $ JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :core:test \
       --tests 
'org.apache.calcite.plan.RelWriterTest.testNonFiniteApproxLiteral' \
       --no-daemon --console=plain
   1 completed, 0 failed, 0 skipped
   BUILD SUCCESSFUL
   ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to