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

Maksim Zhuravkov updated IGNITE-25314:
--------------------------------------
    Description: 
1. It is accepts time with AM/PM when it should not:

{noformat}
sql-cli>  SELECT CAST('05:01' AS TIME FORMAT 'hh12:mi')
╔════════════════════════════════════════╗
║ CAST('05:01' AS TIME FORMAT 'hh12:mi') ║
╠════════════════════════════════════════╣
║ 05:01                                  ║
╚════════════════════════════════════════╝
{noformat}

2. It fails to parse a format when it has AM/PM.

{noformat}
sql-cli> SELECT CAST('05:01 p.m.' AS TIME FORMAT 'hh12:mi p.m.')
SQL query execution error
java.sql.SQLException: Invalid format: 'hh12:mi p.m.' for datetime string: 
'05:01 p.m.'.
{noformat}

Expected results:

{noformat}
SELECT CAST('05:01 p.m.' AS TIME FORMAT 'hh12:mi p.m.')
UNION ALL
SELECT CAST('05:01 a.m.' AS TIME FORMAT 'hh12:mi a.m.')
---
17:01:00
05:01:00

{noformat}



  was:
1. It is accepts time with AM/PM when it should not:

{noformat}
sql-cli>  SELECT CAST('05:01' AS TIME FORMAT 'hh12:mi')
╔════════════════════════════════════════╗
║ CAST('05:01' AS TIME FORMAT 'hh12:mi') ║
╠════════════════════════════════════════╣
║ 05:01                                  ║
╚════════════════════════════════════════╝
{noformat}

2. It fails to parse a format when it has AM/PM.

{noformat}
sql-cli> SELECT CAST('05:01 p.m.' AS TIME FORMAT 'hh12:mi p.m.')
SQL query execution error
java.sql.SQLException: Invalid format: 'hh12:mi pm' for datetime string: '05:01 
pm'.
{noformat}

Expected results:

{noformat}
SELECT CAST('05:01 p.m.' AS TIME FORMAT 'hh12:mi p.m.')
UNION ALL
SELECT CAST('05:01 a.m.' AS TIME FORMAT 'hh12:mi a.m.')
---
17:01:00
05:01:00

{noformat}




> Sql. Cast FORMAT. Parsing of hh/h12 format is incorrect
> -------------------------------------------------------
>
>                 Key: IGNITE-25314
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25314
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>
> 1. It is accepts time with AM/PM when it should not:
> {noformat}
> sql-cli>  SELECT CAST('05:01' AS TIME FORMAT 'hh12:mi')
> ╔════════════════════════════════════════╗
> ║ CAST('05:01' AS TIME FORMAT 'hh12:mi') ║
> ╠════════════════════════════════════════╣
> ║ 05:01                                  ║
> ╚════════════════════════════════════════╝
> {noformat}
> 2. It fails to parse a format when it has AM/PM.
> {noformat}
> sql-cli> SELECT CAST('05:01 p.m.' AS TIME FORMAT 'hh12:mi p.m.')
> SQL query execution error
> java.sql.SQLException: Invalid format: 'hh12:mi p.m.' for datetime string: 
> '05:01 p.m.'.
> {noformat}
> Expected results:
> {noformat}
> SELECT CAST('05:01 p.m.' AS TIME FORMAT 'hh12:mi p.m.')
> UNION ALL
> SELECT CAST('05:01 a.m.' AS TIME FORMAT 'hh12:mi a.m.')
> ---
> 17:01:00
> 05:01:00
> {noformat}



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

Reply via email to