[ 
https://issues.apache.org/jira/browse/IGNITE-25552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-25552:
--------------------------------------
    Description: 
FormatModels shipped with Apache Calcite can not be used to implement an SQL 
standard compliant parser. Consider the following code:

{code:java}
{
            List<FormatElement> elements = 
FormatModels.DEFAULT.parseNoCache("YYYY/MM/DD");
            System.err.println(elements);
        }
        {
            List<FormatElement> elements = 
FormatModels.DEFAULT.parseNoCache("RR/MM/DD");
            System.err.println(elements);
        }
        {
            List<FormatElement> elements = 
FormatModels.DEFAULT.parseNoCache("RR/MM/DD HH.MI");
            System.err.println(elements);
        }
{code}

Output:
{code:java}
[Y, Y, Y, Y, /, MM, /, D, D] - 4 Ys instead of YYYY
[RR/, MM, /, D, D]  - RR is a literal
[RR/, MM, /, D, D,  HH., MI]  - HH is a literal
{code}

To resolve these issues, we have to implement a parser for a SQL datetime 
format. The parser should collect fields values from a string given some format 
pattern. 
 

  was:
FormatModels shipped with Apache Calcite can not be used to implement an SQL 
standard compliant parser. Consider the following code:

{code:java}
{
            List<FormatElement> elements = 
FormatModels.DEFAULT.parseNoCache("YYYY/MM/DD");
            System.err.println(elements);
        }
        {
            List<FormatElement> elements = 
FormatModels.DEFAULT.parseNoCache("RR/MM/DD");
            System.err.println(elements);
        }
        {
            List<FormatElement> elements = 
FormatModels.DEFAULT.parseNoCache("RR/MM/DD HH.MI");
            System.err.println(elements);
        }
{code}

Output:
{code:java}
[Y, Y, Y, Y, /, MM, /, D, D] - 4 Ys instead of YYYY
[RR/, MM, /, D, D]  - RR is a literal
[RR/, MM, /, D, D,  HH., MI]  - HH is a literal
{code}

To resolve these issues, we have to implement a parser for a SQL datetime 
format.
 


> Sql. Date/Time. Parser for SQL datetime format
> ----------------------------------------------
>
>                 Key: IGNITE-25552
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25552
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql ai3
>            Reporter: Maksim Zhuravkov
>            Assignee: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> FormatModels shipped with Apache Calcite can not be used to implement an SQL 
> standard compliant parser. Consider the following code:
> {code:java}
> {
>             List<FormatElement> elements = 
> FormatModels.DEFAULT.parseNoCache("YYYY/MM/DD");
>             System.err.println(elements);
>         }
>         {
>             List<FormatElement> elements = 
> FormatModels.DEFAULT.parseNoCache("RR/MM/DD");
>             System.err.println(elements);
>         }
>         {
>             List<FormatElement> elements = 
> FormatModels.DEFAULT.parseNoCache("RR/MM/DD HH.MI");
>             System.err.println(elements);
>         }
> {code}
> Output:
> {code:java}
> [Y, Y, Y, Y, /, MM, /, D, D] - 4 Ys instead of YYYY
> [RR/, MM, /, D, D]  - RR is a literal
> [RR/, MM, /, D, D,  HH., MI]  - HH is a literal
> {code}
> To resolve these issues, we have to implement a parser for a SQL datetime 
> format. The parser should collect fields values from a string given some 
> format pattern. 
>  



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

Reply via email to