suibianwanwank commented on code in PR #3936:
URL: https://github.com/apache/calcite/pull/3936#discussion_r1739780579


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -5185,6 +5187,60 @@ void testBitGetFunc(SqlOperatorFixture f, String 
functionName) {
     }
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6551";>[CALCITE-6551]
+   * Add DATE_FORMAT function (enabled in MySQL library)</a>. */
+  @Test void testDateFormat() {
+    final SqlOperatorFixture f = fixture()
+        .withTester(t -> TESTER).withLibrary(SqlLibrary.MYSQL);
+    f.setFor(SqlLibraryOperators.DATE_FORMAT);
+    final Locale originalLocale = Locale.getDefault();
+
+    try {
+      Locale.setDefault(Locale.US);
+      f.checkString("date_format(timestamp '2009-10-04 22:23:00', '%W %M %Y')",
+          "Sunday October 2009",
+          "VARCHAR NOT NULL");
+      f.checkString("date_format(timestamp '2009-10-04 22:23:00', '%H:%i:%s')",
+          "22:23:00",
+          "VARCHAR NOT NULL");
+      f.checkString("date_format(timestamp '1900-10-04 22:23:00', '%D %y %a %d 
%m %b %j')",
+          "4th 00 Thu 04 10 Oct 277",
+          "VARCHAR NOT NULL");
+      f.checkString("date_format(timestamp '1997-10-04 22:23:00', '%H %k %I %r 
%T %S %w')",
+          "22 22 10 10:23:00 PM 22:23:00 00 6",
+          "VARCHAR NOT NULL");
+      f.checkString("date_format(timestamp '1999-01-01', '%X %V')",

Review Comment:
   Yes, I removed time to simplify testing Case, and in fact, Mysql doesn't 
support doing that. I'll add time to this test, but for this current test, I'm 
not sure we can be consistent with Mysql in Calcite



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to