[ 
https://issues.apache.org/jira/browse/CALCITE-6248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17817544#comment-17817544
 ] 

Julian Hyde commented on CALCITE-6248:
--------------------------------------

I think we should remain reasonably liberal in the format we accept. Parsing a 
string into year / month / date fields is one thing, and verifying whether 
those fields represent a valid ISO 8601 date is another. This case is just 
about the latter question.

Reviewing the above commit, I was surprised that there were no tests that 
{{cast('1945-02-32' as DATE)}} gives an error (at validate time or run time) 
and that {{select cast(d as date) from (values '1945-02-32') as t (d)}} gives 
an error at run time.

> 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)

Reply via email to