[
https://issues.apache.org/jira/browse/CALCITE-6248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17820904#comment-17820904
]
Mihai Budiu commented on CALCITE-6248:
--------------------------------------
I see two tests in SqlOperatorTest:
{code}
f.checkScalar("cast('52534253' as DATE)", "7368-10-13", "DATE NOT NULL");
f.checkScalar("cast('1945-30-24' as DATE)", "1947-06-26", "DATE NOT NULL");
{code}
The second test suggests that accepting illegal dates is actually by design, so
perhaps this issue is actually wrong.
I don't know how to interpret the first string as a date. Is there a spec for
how casts from strings to dates are supposed to work?
> Illegal dates are accepted by casts
> -----------------------------------
>
> Key: CALCITE-6248
> URL: https://issues.apache.org/jira/browse/CALCITE-6248
> Project: Calcite
> Issue Type: Bug
> Components: avatica, core
> Affects Versions: 1.36.0
> Reporter: Mihai Budiu
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The following test passes in SqlOperatorTest:
> {code:java}
> @Test public void testIllegalDate() {
> final SqlOperatorFixture f = fixture();
> f.checkScalar("cast('1945-02-32' as DATE)",
> "1945-03-04", "DATE NOT NULL");
> }
> {code}
> There is no February 32, I suspect that this expression should produce an
> error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)