[
https://issues.apache.org/jira/browse/CALCITE-7435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18064177#comment-18064177
]
Mihai Budiu commented on CALCITE-7435:
--------------------------------------
Yes, this is the problem,but you are showing the outer stack trace, whereas the
exception is in an inner stack trace.
I expect it will be easy to fix, just add a new case label to the function I
mention.
> WINDOW functions should allow ORDER BY fields of type INTERVAL
> --------------------------------------------------------------
>
> Key: CALCITE-7435
> URL: https://issues.apache.org/jira/browse/CALCITE-7435
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Mihai Budiu
> Priority: Minor
>
> {code:java}
> CREATE TABLE data (
> t0 TIMESTAMP NOT NULL,
> location INT NOT NULL
> );
>
> CREATE VIEW IT AS SELECT (t0 - TIMESTAMP '2020-01-01 00:00:00') SECOND AS t,
> location FROM data;
>
> CREATE VIEW V AS
> SELECT
> *,
> COUNT(*) OVER(
> PARTITION BY location
> ORDER BY t
> RANGE BETWEEN INTERVAL '2' DAYS PRECEDING AND INTERVAL '1' DAYS
> PRECEDING) AS c
> FROM IT; {code}
> Calcite's syntax for arithmetic on timestamps is not accepted by other
> databases, so I could not validate this query, but I see no reason it should
> be rejected.
> Validation fails in SqlTypeFamily.allowableDifferenceTypes, which only
> accepts NUMERIC, DATE, TIME, and TIMESTAMP types. But since INTERVAL types
> support the minus operation, I think they should be allowed too.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)