Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Druid SQL CEIL time function should support all the time units it shows in error messages #8179

Closed
sashidhar opened this issue Jul 28, 2019 · 2 comments
Labels

Comments

@sashidhar
Copy link
Contributor

sashidhar commented Jul 28, 2019

Affected Version

Druid version 0.15.0 (and probably all other previous versions)

Description

Run the below query

SELECT CEIL(CURRENT_TIMESTAMP TO XYZ) from wikipedia LIMIT 1;

Following is the error message:

Unknown exception / Encountered "TO XYZ" at line 1, column 46. Was expecting one of: ")" ... "NOT" ... "IN" ... "<" ... "<=" ... ">" ... ">=" ... "=" ... "<>" ... "!=" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "+" ... "-" ... "*" ... "/" ... "%" ... "||" ... "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ... "CONTAINS" ... "OVERLAPS" ... "EQUALS" ... "PRECEDES" ... "SUCCEEDS" ... "IMMEDIATELY" ... "MULTISET" ... "[" ... "(" ... "TO" "MICROSECOND" ... "TO" "MILLISECOND" ... "TO" "SECOND" ... "TO" "MINUTE" ... "TO" "HOUR" ... "TO" "DAY" ... "TO" "DOW" ... "TO" "DOY" ... "TO" "ISODOW" ... "TO" "ISOYEAR" ... "TO" "WEEK" ... "TO" "MONTH" ... "TO" "QUARTER" ... "TO" "YEAR" ... "TO" "EPOCH" ... "TO" "DECADE" ... "TO" "CENTURY" ... "TO" "MILLENNIUM" ... / org.apache.calcite.sql.parser.SqlParseException

CEIL function doesn't support these time units mentioned in the above error message - MICROSECOND, MILLISECOND, DOW, DOY, ISODOW, ISOYEAR, EPOCH, DECADE, CENTURY and MILLENNIUM

For example,

SELECT CEIL(CURRENT_TIMESTAMP TO MICROSECOND) from wikipedia LIMIT 1;

returns

Unknown exception / Cannot build plan for query: SELECT * FROM (SELECT CEIL(CURRENT_TIMESTAMP TO MICROSECOND) from wikipedia LIMIT 1) LIMIT 5000 / org.apache.druid.java.util.common.ISE

SELECT CEIL(CURRENT_TIMESTAMP TO ISODOW) from wikipedia LIMIT 1;

returns

Unknown exception / ISODOW / org.apache.calcite.sql.parser.SqlParseException

Found this while playing around with CEIL function on the lines of #7935.

@stale
Copy link

stale bot commented May 3, 2020

This issue has been marked as stale due to 280 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@druid.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label May 3, 2020
@stale
Copy link

stale bot commented May 31, 2020

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.

@stale stale bot closed this as completed May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant