[
https://issues.apache.org/jira/browse/CALCITE-5957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17766725#comment-17766725
]
Stamatis Zampetakis commented on CALCITE-5957:
----------------------------------------------
The SQL standard 2011 Section 5.3 (Syntax Rules) defines the following:
31) Within a <datetime literal>, the <years value> shall contain four digits.
The <seconds integer value> and other datetime components, with the exception
of <seconds fraction>, shall each contain two digits.
32) Within the definition of a <datetime literal>, the <datetime value>s are
constrained by the natural rules for dates and times according to the Gregorian
calendar.
However, we already started deviating from the strict standard definition so I
am not sure why we should allow single digit integers for everything (months,
days, hours, minutes, seconds) but not for years; this seems inconsistent.
Personally, I prefer the strict format but this is completely subjective and
people have different opinions on the topic so I am willing to follow the
majority. Nevertheless, we should clarify if the date "900-01-01" was valid
before the changes in CALCITE-5678 or not.
[~zstan] Also please comment about "2023-01-01 22:00:00.123.123". Was it valid
before CALCITE-5678? Should we accept it now?
> Valid DATE '1945-2-2' is not accepted due to regression
> -------------------------------------------------------
>
> Key: CALCITE-5957
> URL: https://issues.apache.org/jira/browse/CALCITE-5957
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.35.0
> Reporter: Runkang He
> Assignee: Evgeny Stanilovsky
> Priority: Blocker
> Labels: pull-request-available
> Fix For: avatica-1.24.0
>
> Attachments: image-2023-08-27-19-09-33-284.png
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> DATE '1945-2-2' is a valid date. In CALCITE-5923 when we turn on the result
> check of `testCastStringToDateTime`, we find that Calcite accepted DATE
> '1945-2-2' before CALCITE-5678 but not afterwards, so this is a regression
> that we need to fix.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)