Skip to content

Allow zero period for TIMESTAMPADD to help make Tableau operable  #10530

@john-bodley

Description

@john-bodley

Description

Tableau provides an option to choose a time period representing the current month,

Screen Shot 2020-10-24 at 5 25 41 PM

which results in auto-generated SQL of the form,

 TIMESTAMPADD(MONTH,0,...)

which results in Druid throwing an error per here of the form,

Unknown exception (java.lang.IllegalArgumentException): zero period is not acceptable in PeriodGranularity!

Granted adding a zero period is atypical, but I was wondering why this should be an error (the check was introduced in #3644). For reference MySQL et al. support having a zero period,

mysql> SELECT TIMESTAMPADD(MONTH,0,'2020-10-24');
+------------------------------------+
| TIMESTAMPADD(MONTH,2,'2020-10-24') |
+------------------------------------+
| 2020-10-24                         | 
+------------------------------------+
1 row in set (0.00 sec)

Motivation

Please provide the following for the desired feature or change:

  • The TIMESTAMPADD should allow for an zero interval to ensure applications like Tableau are functional.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions