-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CALCITE-6021] Add CURRENT_DATETIME function (enabled in BigQuery library) #3457
Conversation
613832c
to
a5f3926
Compare
2f01971
to
99880b5
Compare
core/src/main/java/org/apache/calcite/rel/externalize/RelJson.java
Outdated
Show resolved
Hide resolved
| 2016-05-19T10:38:47.046465 | | ||
+----------------------------+ | ||
SELECT CURRENT_DATETIME > DATETIME '2008-12-25 15:30:00' as now; | ||
+------+ |
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.
Would it be useful if Quidem had a way to mask out results? E.g.
!mask 6 "[0-9]" "x"
SELECT CURRENT_DATETIME as now;
+----------------------------+
| now |
+----------------------------+
| 2016-05-19T10:38:47.046465 |
+----------------------------+
would succeed because '2016-05-19T10:38:47.046465' and '2023-11-11T16:38:47.012345' would both be converted to 'xxxx-xx-xxTxx:xx:xx.xxxxxx'. The 6 means 'the next 6 lines'.
I logged julianhyde/quidem#79. Please add comments there.
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.
Left a comment on the issue, sounds like a good idea.
@@ -682,6 +682,9 @@ public enum BuiltInMethod { | |||
CURRENT_TIMESTAMP(SqlFunctions.class, "currentTimestamp", DataContext.class), | |||
CURRENT_TIME(SqlFunctions.class, "currentTime", DataContext.class), | |||
CURRENT_DATE(SqlFunctions.class, "currentDate", DataContext.class), | |||
CURRENT_DATETIME(SqlFunctions.class, "currentDatetime", DataContext.class), | |||
CURRENT_DATETIME2(SqlFunctions.class, "currentDatetime", DataContext.class, | |||
String.class), |
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.
indent 4, not 2
final String currentDateTimeExpr = "select ^current_datetime^"; | ||
SqlValidatorFixture shouldFail = sql(currentDateTimeExpr) | ||
.withConformance(SqlConformanceEnum.BIG_QUERY); | ||
final String expectedError = "query [select CURRENT_DATETIME]; exception " | ||
+ "[Column 'CURRENT_DATETIME' not found in any table]; class " | ||
+ "[class org.apache.calcite.sql.validate.SqlValidatorException]; pos [line 1 col 8 thru line 1 col 8]"; | ||
shouldFail.fails("Column 'CURRENT_DATETIME' not found in any table"); | ||
// shouldFail.fails("Column 'CURRENT_DATETIME' not found in any table"); |
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.
remove the comment or the line
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 when you've fixed some cosmetic changes.
9cea2e0
to
5aafb98
Compare
…rary) Co-authored-by: Julian Hyde <[email protected]> Co-authored-by: Tanner Clary <[email protected]>
5aafb98
to
5a3d7ac
Compare
Kudos, SonarCloud Quality Gate passed! |
No description provided.