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

DruidSQL should support everything that it claims to support in error messages #7935

Closed
vogievetsky opened this issue Jun 20, 2019 · 0 comments · Fixed by #8068
Closed

DruidSQL should support everything that it claims to support in error messages #7935

vogievetsky opened this issue Jun 20, 2019 · 0 comments · Fixed by #8068

Comments

@vogievetsky
Copy link
Contributor

vogievetsky commented Jun 20, 2019

Affected Version

Druid version 0.15.0 (and probably all the ones that came before)

Description

I run the query:

SELECT EXTRACT(DATE FROM __time) AS T FROM wikipedia LIMIT 1

I get the error message of:

Encountered "DATE" at line 1, column 31. Was expecting one of: "MICROSECOND" ... "MILLISECOND" ... "SECOND" ... "MINUTE" ... "HOUR" ... "DAY" ... "DOW" ... "DOY" ... "ISODOW" ... "ISOYEAR" ... "WEEK" ... "MONTH" ... "QUARTER" ... "YEAR" ... "EPOCH" ... "DECADE" ... "CENTURY" ... "MILLENNIUM" ...

That is fair enough DATE is not supported, not sure what I was thinking.

The error message seems to imply what is supported but the issue is only a subset of those work.

For example:

SELECT EXTRACT(ISOYEAR FROM __time) AS T FROM wikipedia LIMIT 1

returns

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

and

SELECT EXTRACT(MILLISECOND FROM __time) AS T FROM wikipedia LIMIT 1

returns

Unknown exception / Cannot build plan for query: SELECT EXTRACT(MILLISECOND FROM __time) AS T FROM wikipedia LIMIT 1 / org.apache.druid.java.util.common.ISE

Encountered while doing research for #7934

sashidhar pushed a commit to sashidhar/incubator-druid that referenced this issue Jul 12, 2019
…for MILLISECOND 3. Added a test case to test extracting millisecond from expression. apache#7935
clintropolis pushed a commit that referenced this issue Jul 20, 2019
…Units (#8068)

* 1. Added TimestampExtractExprMacro.Unit for MILLISECOND 2. expr eval for MILLISECOND 3. Added a test case to test extracting millisecond from expression. #7935

* 1. Adding DATASOURCE4 in tests. 2. Adding test TimeExtractWithMilliseconds

* Fixing testInformationSchemaTables test

* Fixing failing tests in DruidAvaticaHandlerTest

* Adding cannotVectorize() call before the test

* Extract time function - Adding support for MICROSECOND, ISODOW, ISOYEAR and CENTURY time units, documentation changes.

* Adding MILLISECOND in test case

* Adding support DECADE and MILLENNIUM, updating test case and documentation

* Fixing expression eval for DECADE and MILLENIUM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant