You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2023/01/18 18:55:17 UTC
[GitHub] [calcite] tjbanghart commented on a diff in pull request #3034: [CALCITE-5357] Implement BigQuery FORMAT_TIMESTAMP, FORMAT_DATE, FORMAT_TIME, and FORMAT_DATETIME
tjbanghart commented on code in PR #3034:
URL: https://github.com/apache/calcite/pull/3034#discussion_r1073950252
##########
core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java:
##########
@@ -184,6 +185,46 @@ public MysqlSqlDialect(Context context) {
return super.getCastSpec(type);
}
+ /** {@inheritDoc}
+ *
+ * <p>MySQL format element reference:
+ * <a href="https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format">
+ * MySQL Date and Time Functions</a>.
+ */
+ @Override public String getFormatElement(FormatElementEnum fmtElement) {
Review Comment:
Each dialect might have a different set of elements to represent the same type of datetime unit.
For example an abbreviated month name like `Jan` is `%b` in MySQL and `MON` in Snowflake. Each `SqlDialect` will have to override this method to supply the correct string for the element type. I only did MySQL, BigQuery, and Snowflake in the first commit because I wanted to get some feedback before working on each dialect.
Oracle's format elements were chosen as the "base" set since they map closely to the SQL:2016 standard as described in [CALCITE-2980](https://issues.apache.org/jira/browse/CALCITE-2980).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org