cjohnson-confluent commented on PR #29063:
URL: https://github.com/apache/flink/pull/29063#issuecomment-5543953054

   > Interestingly enough this returns `FALSE`
   > ```sql
   > SELECT JSON_VALUE('{"a": 13.37, "b": 13.37}', '$.a' RETURNING DOUBLE) = 
JSON_VALUE('{"a": 13.37, "b": 13.37}', '$.b' RETURNING DOUBLE)
   > ```
   
   Found and fixed the root cause: 
`ScalarOperatorGens.generateComparisonSameType` generates `leftTerm == 
rightTerm` for numeric types, which is reference comparison when either side is 
a boxed type (e.g., `java.lang.Double` from JSON_VALUE). Two separate 
`convertJsonScalar` calls return distinct `Double` objects, so `==` is always 
`false`.
   
   Fixed by casting to the primitive type before comparison. This affects all 
numeric and boolean types, not just DOUBLE. Regression tests added using 
different JSON paths to the same value -- identical paths get merged by 
sub-expression reuse, which masks the bug.


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