-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 EXTRACT time function - adding support for additional Time Units #8068
Conversation
…for MILLISECOND 3. Added a test case to test extracting millisecond from expression. apache#7935
@@ -689,6 +689,18 @@ private void checkSqlRequestLog(boolean success) | |||
} | |||
} | |||
|
|||
@Test | |||
public void testExtractMillisecondFromExpr() throws Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think CalciteQueryTests
might be a more appropriate place to test this, maybe have a look at CalciteQueryTest.testFilterOnTimeExtract
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @clintropolis for the pointer. Moved this test to CalciteQueryTest. Added testFilterOnTimeExtractWithMilliseconds() in CalciteQueryTest. If the code changes look fine I'll go ahead and handle other time units. Introduced new data source DATASOURCE4 in tests to avoid polluting existing datasources (this is useful to test other time units as well).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall seems reasonable to me 👍. You could probably test most/all of the additions in a single test if the timestamps for the datasource you added are sufficient, if you'd like to avoid repeating a lot of the near same boilerplate in the calcite tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍makes sense.
How do I fix this error ? The test was successful before I rebased changes from master. Post rebasing it failed. Trying to figure out how to fix this. https://travis-ci.org/apache/incubator-druid/jobs/558313543 [ERROR] testFilterOnTimeExtractWithMilliseconds(org.apache.druid.sql.calcite.CalciteQueryTest) Time elapsed: 0.055 s <<< ERROR! .... [ERROR] org.apache.druid.sql.calcite.CalciteQueryTest.testFilterOnTimeExtractWithMilliseconds(org.apache.druid.sql.calcite.CalciteQueryTest) |
Ah, add this to the beginning of your test
A vectorized query engine got merged, but it doesn't fully support all query and filter types, so some tests, such as those which use Druid expressions as this, will need that until supported. |
…AR and CENTURY time units, documentation changes.
Changes made
Pending Timestamp used in the test |
Added support for the remaining time units i.e DECADE and MILLENNIUM. With this support for all missing time units is handled. Updated the test case accordingly. If the overall changes including the expression evaluation logic looks fine, I'll add and/or update more tests as needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍, thanks!
Fixes #7935.
Description
Test case
Documentation
Made corresponding documentation changes.