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

Pavel Pereslegin commented on IGNITE-24909:
-------------------------------------------

Calcite uses SimpleDateFormat to parse dates internally, so issues with 
possible invalid/wrong patterns and overflows are related to Java's 
SimpleDateFormat.

For example the following is acceptable for SimpleDateFormat:
{code:java}
        DateFormat df = new SimpleDateFormat("yy-MM-dd", Locale.ENGLISH);

        System.out.println(df.parse("9999999-9999999-9999999")); // Sun Dec 27 
00:00:00 MSK 9999998
{code}

And the same is acceptable by Calcite
{code:java}
sql("SELECT CAST('9999999-9999999-9999999' AS DATE FORMAT 'yy-MM-dd')"); // 
[[-898510-03-05]]
{code}

> Sql. Improve test coverage for date/time templates support
> ----------------------------------------------------------
>
>                 Key: IGNITE-24909
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24909
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> Date/time formatting tests currently located in {{test_cast_format.test}}, 
> but the tests look incomplete.
> Need to improve checks for boundary values and templates (see 9.44 Datetime 
> templates):
> * Incorrect templates, for example YYYYY, FF0, FF10, MMM, DDDD
> * Pattern mismatching (for example {{SELECT CAST('2021-01-9999' AS DATE 
> FORMAT 'YYYY-MM-DD')}}).
> * Cast values with overflow, for example cast('9999-00-00' as date format 
> 'YYYY-MM-DD') or cast('9999-99-99' as date format 'YYYY-MM-DD') produces 
> strange results
> * Add test for cast with precision greater than zero (for example SELECT 
> cast('01:05:07.161' as time(*2*) format 'HH24:MI:SS.FF1'))
> * Add tests that uses dynamic parameters
> * Add tests that uses table columns



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to