drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hsuan Yi Chu <hyi...@maprtech.com>
Subject Re: 'DATE - DATE' not supported?
Date Tue, 09 Feb 2016 19:52:12 GMT
The reason you are seeing this is because the types are known to Drill at
the planning time.

The planning engine Drill uses is Calcite which does not allow this
operation to happen. (as the error message suggests).

One workaround you could take is to cover up the type information by
cast(... as ANY), such as:

SELECT cast(DATE '2009-01-01' as any) - cast(DATE '2009-05-05' as any) FROM
(values(1));


On the other hand, the community is doing some work to relax the type
constraints (a component of Drill-4372). Hopefully, you could run your
original query in the near future.



On Tue, Feb 9, 2016 at 6:47 AM, Oscar Morante <spacepluk@gmail.com> wrote:

>
> Hi there,
>
> I'm new to both the list and Drill.  I'm doing some tests using Tableau
> and when I use the `DATEDIFF` function in a calculated field Tableau
> generates queries that contain stuff like this:
>
>    SELECT DATE '2009-01-01' - DATE '2009-05-05' FROM (values(1));
>
> ...which throws this error:
>
>    ExampleExceptionFormatter: exception message was: VALIDATION ERROR:
> From line 1, column 8 to line 1, column 44: Cannot apply '-' to
> arguments of type '<DATE> - <DATE>'. Supported form(s): '<NUMERIC>
-
> <NUMERIC>'
>    '<DATETIME_INTERVAL> - <DATETIME_INTERVAL>'
>    '<DATETIME> - <DATETIME_INTERVAL>'
>
> I was looking around and according to the original task (DRILL-549) that
> kind of query should be supported.  Is this a regression?  Am I doing
> something wrong?
>
> Thanks,
>
> --
> Oscar Morante
> "Self-education is, I firmly believe, the only kind of education there is."
>                                                          -- Isaac Asimov.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message