Skip to content

Commit

Permalink
Add flag to turn off broken case
Browse files Browse the repository at this point in the history
  • Loading branch information
herunkang2018 committed Oct 12, 2023
1 parent 86fb814 commit efb6656
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/src/main/java/org/apache/calcite/util/Bug.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ public abstract class Bug {
* MILLISECOND and MICROSECOND units in INTERVAL literal</a> is fixed. */
public static final boolean CALCITE_5422_FIXED = false;

/** Whether
* <a href="https://issues.apache.org/jira/browse/CALCITE-5678">[CALCITE-5678]
* Calcite should reject date literals not satisfying Gregorian calendar,
* per SQL standard</a> is fixed. */
public static final boolean CALCITE_5678_FIXED = false;

/**
* Use this to flag temporary code.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,6 @@ void testCastStringToDateTime(CastType castType, SqlOperatorFixture f) {

f.checkScalar("cast('1945-02-24 12:42:25' as TIMESTAMP)",
"1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL");
f.checkScalar("cast('1945-2-2 12:2:5' as TIMESTAMP)",
"1945-02-02 12:02:05", "TIMESTAMP(0) NOT NULL");
f.checkScalar("cast(' 1945-02-24 12:42:25 ' as TIMESTAMP)",
"1945-02-24 12:42:25", "TIMESTAMP(0) NOT NULL");
f.checkScalar("cast('1945-02-24 12:42:25.34' as TIMESTAMP)",
Expand All @@ -1256,6 +1254,10 @@ void testCastStringToDateTime(CastType castType, SqlOperatorFixture f) {
f.checkScalar("cast('1945-02-24 12:42:25.34' as TIMESTAMP(2))",
"1945-02-24 12:42:25.34", "TIMESTAMP(2) NOT NULL");
}
if (Bug.CALCITE_5678_FIXED) {
f.checkFails("cast('1945-2-2 12:2:5' as TIMESTAMP)",
"Invalid DATE value, '1945-2-2 12:2:5'", true);
}
f.checkFails("cast('nottime' as TIMESTAMP)", BAD_DATETIME_MESSAGE, true);
f.checkScalar("cast('1241241' as TIMESTAMP)",
"1241-01-01 00:00:00", "TIMESTAMP(0) NOT NULL");
Expand Down

0 comments on commit efb6656

Please sign in to comment.