Re: What type is DATE + INTERVAL?

2017-02-16 Thread Gian Merlino
Yes I have, although it's disabled in Druid for now because of a bug: https://issues.apache.org/jira/browse/CALCITE-1601. I haven't had time yet to look into why that's happening. Gian On Thu, Feb 16, 2017 at 1:59 PM, Julian Hyde wrote: > Yes, exactly. > > FLOOR( .. TO timeUnit) is non-standard

Re: What type is DATE + INTERVAL?

2017-02-16 Thread Julian Hyde
Yes, exactly. FLOOR( .. TO timeUnit) is non-standard, if that matters. Have you seen DateRangeRules (and DateRangeRulesTest)? The work you are doing would fit in perfectly. Julian > On Feb 16, 2017, at 1:28 PM, Gian Merlino wrote: > > Fair enough, so I guess the way to do that without usin

Re: What type is DATE + INTERVAL?

2017-02-16 Thread Gian Merlino
Fair enough, so I guess the way to do that without using FLOOR would be: CAST(CAST(ts AS DATE) AS TIMESTAMP) + EXTRACT(HOUR FROM ts) * INTERVAL '1' HOUR (Casting to date and back to timestamp to do a poor mans' floor to day) Gian On Wed, Feb 15, 2017 at 11:48 PM, Julian Hyde wrote: > Funny

Re: What type is DATE + INTERVAL?

2017-02-15 Thread Julian Hyde
Funny you should ask. I went through the exact same exercise yesterday, in https://github.com/apache/calcite/commit/d8c4d73fe9bd188ebc004e11ef0f48d934124d8c . The answer is that Calcite is right. The SQL:2014 dra

What type is DATE + INTERVAL?

2017-02-15 Thread Gian Merlino
I've run into SQL in the wild that did something like: CAST(ts AS DATE) + EXTRACT(HOUR FROM ts) * INTERVAL '1' HOUR Which the user expected to mean the same thing as: FLOOR(ts TO HOUR) I started writing a planner rule to make the former work, but ran into type errors since Calcite treats