Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.35.0
-
None
-
None
Description
I could not find documentation on how Calcite implements something like CAST(1.9 AS INT).
I suspect that there are multiple implementations, some for compile-time and some for run-time. In the absence of a spec it's not clear that they agree. The SQL standard leaves this behavior at the choice of the implementation.
At least RexExecutorImpl uses BigDecimal.intValue for this expression, which means that the result is 1 rather than 2, as I would have guessed.
Moreover, there are many tests in SqlOperatorTests which are disabled with "brokenTestsEnabled". Most of these tests look wrong too, claiming that the above cast should fail with an error of out of range, e.g., see testCastWithRoundingToScalar. So reading the test code also does not answer this question.
Attachments
Issue Links
- Is contained by
-
CALCITE-6322 Casts to DECIMAL types are ignored
- Open
- relates to
-
CALCITE-5860 Decimal type conversion missing scale
- Open