Evgeny Stanilovsky created CALCITE-7001:
-------------------------------------------

             Summary: Cast of malformed literal  to TIMESTAMP WITH LOCAL TIME 
ZONE need to throw informative error
                 Key: CALCITE-7001
                 URL: https://issues.apache.org/jira/browse/CALCITE-7001
             Project: Calcite
          Issue Type: Task
          Components: core
    Affects Versions: 1.39.0
            Reporter: Evgeny Stanilovsky


Query like :

{noformat}
select TIMESTAMP WITH LOCAL TIME ZONE '0000-01-01 00:00:00';
or 
select TIMESTAMP WITH LOCAL TIME ZONE 'malformed';
{noformat}

will throw smth like:

{noformat}
Illegal TIMESTAMP WITH LOCAL TIME ZONE literal '0000-01-01 00:00:00': not in 
format 'yyyy-MM-dd HH:mm:ss'
{noformat}

but 

{noformat}
select cast ('malformed' AS TIMESTAMP WITH LOCAL TIME ZONE);
{noformat}

will throw:

with jdk21
{noformat}
Caused by: java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of 
bounds for length 19
{noformat}

and 

with jdk11
{noformat}
StringIndexOutOfBoundsException: begin 0, end -1, length 20
{noformat}

Seems this NON-informative error need to be aligned with upper case



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

Reply via email to