[
https://issues.apache.org/jira/browse/CALCITE-6248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17830774#comment-17830774
]
Mihai Budiu commented on CALCITE-6248:
--------------------------------------
I thought we were ready to close this one, but the situation is more
complicated: strings representing dates and times can appear in multiple
places: as values for literals e.g., DATE '1945-1-1', as values in a VALUES
statement, which may be implicitly cast, and in casts e.g., CAST('1945-1-1' AS
DATE). And it seems that different validation rules are needed for different
contexts. It seems, for example, that casts should be more lenient than
literals in their checking.
There are several other related issues e.g., [CALCITE-5678], [CALCITE-5957]
I am afraid that this issue is not the last one in this chain. What is needed
is *two* versions of each validation function, one strict and one lenient, and
Calcite should use the appropriate function depending on the context.
> 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)