Skip to content

Commit

Permalink
[CALCITE-6234] Add tests on SqlOperatorTest for to_char function
Browse files Browse the repository at this point in the history
  • Loading branch information
caicancai authored and rubenada committed Feb 2, 2024
1 parent 351ddeb commit 2aabf21
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4423,6 +4423,33 @@ void testBitGetFunc(SqlOperatorFixture f, String functionName) {
f.checkString("to_char(timestamp '2022-06-03 12:15:48.678', 'YYYY-MM-DD HH24:MI:SS.MS TZ')",
"2022-06-03 12:15:48.678",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 12:15:48.678', 'Day')",
"Friday",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 12:15:48.678', 'CC')",
"21",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'HH12')",
"01",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'HH24')",
"13",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'MI')",
"15",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'MS')",
"678",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'Q')",
"2",
"VARCHAR(2000) NOT NULL");
f.checkString("to_char(timestamp '2022-06-03 13:15:48.678', 'IW')",
"23",
"VARCHAR(2000) NOT NULL");
f.checkNull("to_char(timestamp '2022-06-03 12:15:48.678', NULL)");
f.checkNull("to_char(cast(NULL as timestamp), NULL)");
f.checkNull("to_char(cast(NULL as timestamp), 'Day')");
}

@Test void testFromBase64() {
Expand Down

0 comments on commit 2aabf21

Please sign in to comment.