[
https://issues.apache.org/jira/browse/CALCITE-922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14971794#comment-14971794
]
Julian Hyde commented on CALCITE-922:
-------------------------------------
Looks mostly good. However, I added a test to misc.oq (run via
JdbcTest.testRunMisc):
{noformat}# [CALCITE-922] Value of INTERVAL literal
select deptno * interval '2' day as d2,
deptno * interval -'3' hour as h3
from "scott".dept;
+-----+------+
| D2 | H3 |
+-----+------+
| +20 | -30 |
| +40 | -60 |
| +60 | -90 |
| +80 | -120 |
+-----+------+
(4 rows)
!ok{noformat}
(also in
https://github.com/julianhyde/incubator-calcite/tree/922-interval-literals)
and it gave the wrong results for negative intervals. E.g. h3 in the first row
was +30, should be -30.
I saw your discussion about negative intervals on the dev list and I think we
should fix those as part of this issue.
> CAST(...) * (INTERVAL constant) results into Internal Error
> ------------------------------------------------------------
>
> Key: CALCITE-922
> URL: https://issues.apache.org/jira/browse/CALCITE-922
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Sean Hsuan-Yi Chu
> Assignee: Sean Hsuan-Yi Chu
>
> For example,
> {code}
> select cast(empno as Integer) * (INTERVAL '1' DAY)
> from emp
> {code}
> results into
> {code}
> java.lang.AssertionError: Internal error: invalid literal: INTERVAL '1' DAY
> {code}
> The reason is that INTERVAL constant is not extracted properly in the cases
> where this constant times a CAST() function
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)