Skip to content

Commit

Permalink
[CALCITE-6248] Illegal dates are accepted by casts
Browse files Browse the repository at this point in the history
Signed-off-by: Mihai Budiu <[email protected]>
  • Loading branch information
mihaibudiu committed Feb 13, 2024
1 parent e05b047 commit c774c31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/test/java/org/apache/calcite/test/JdbcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8203,7 +8203,7 @@ private void checkGetTimestamp(Connection con) throws SQLException {
* TIMESTAMP elements</a>. */
@Test void testArrayOfDates() {
CalciteAssert.that()
.query("select array[cast('1900-1-1' as date)]")
.query("select array[cast('1900-01-01' as date)]")
.returns("EXPR$0=[1900-01-01]\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ void testCastStringToDateTime(CastType castType, SqlOperatorFixture f) {
f.checkCastToString("DATE '1945-2-24'", null, "1945-02-24", castType);

f.checkScalar("cast('1945-02-24' as DATE)", "1945-02-24", "DATE NOT NULL");
f.checkScalar("cast(' 1945-2-4 ' as DATE)", "1945-02-04", "DATE NOT NULL");
f.checkScalar("cast(' 1945-02-04 ' as DATE)", "1945-02-04", "DATE NOT NULL");
f.checkScalar("cast(' 1945-02-24 ' as DATE)",
"1945-02-24", "DATE NOT NULL");
if (castType == CastType.CAST) {
Expand Down

0 comments on commit c774c31

Please sign in to comment.