OldTruckDriver opened a new pull request, #5007:
URL: https://github.com/apache/calcite/pull/5007

   Fixes CALCITE-7553.
   
   This PR separates TIMESTAMP_TZ's Java natural ordering from SQL value 
comparison semantics.
   
   TimestampWithTimeZoneString.compareTo now compares by instant first, then by 
the canonical string value as a tie-breaker. This makes compareTo consistent 
with equals/hashCode, so Java sorted collections do not collapse distinct 
TIMESTAMP_TZ values that represent the same instant.
   
   SQL comparison paths now use an explicit Rex SQL value comparison helper. 
For TIMESTAMP_TZ, the helper compares instants; other values keep their 
existing natural ordering. This preserves SQL semantics for literal folding and 
RexInterpreter evaluation.
   
   RexBuilder and RexSimplify now avoid constructing Sarg ranges for 
TIMESTAMP_TZ values in the affected paths, because Sarg still relies on natural 
Comparable ordering. This keeps IN/BETWEEN and simplification paths from using 
the wrong ordering. Full TIMESTAMP_TZ SQL-value comparison support inside 
Sarg/range handling is left for a follow-up PR.
   
   The TIMESTAMP_TZ epoch-millis conversion in RexLiteral now delegates to 
TimestampWithTimeZoneString.getMillisSinceEpoch(), using the same instant 
calculation as the comparison helper.
   
   Tests:
   - ./gradlew :core:test -Djunit.jupiter.execution.parallel.enabled=false 
--tests org.apache.calcite.rex.RexProgramTest --tests 
org.apache.calcite.rex.RexBuilderTest
   - ./gradlew :core:check


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