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

Maksim Zhuravkov updated IGNITE-20593:
--------------------------------------
    Description: 
In order to make behaviour of types in DDL commands consistent with other SQL 
statements, we need to update `DdlSqlToCommandConverter` to make it in sync 
with implicit type coercion rules 
- if type T1 can be converted from T2, then DEFAULT for type T1 can accept 
values of type T2.


Example:

{code:java}
@Test
public void testDdl() {
    sql("CREATE TABLE date_dim (id INTEGER PRIMARY KEY, dim DATE DEFAULT 
'2000-01-01')");
}

//ERROR:

Caused by: java.lang.ClassCastException: class 
org.apache.calcite.sql.SqlCharStringLiteral cannot be cast to class 
org.apache.calcite.sql.SqlUnknownLiteral 
(org.apache.calcite.sql.SqlCharStringLiteral and 
org.apache.calcite.sql.SqlUnknownLiteral are in unnamed module of loader 'app')
        at 
org.apache.ignite.internal.sql.engine.prepare.ddl.DdlSqlToCommandConverter.fromLiteral(DdlSqlToCommandConverter.java:837)
        ... 18 more
{code}


  was:
In order to make behaviour of types in DDL commands consistent with other SQL 
statements, we need to update `DdlSqlToCommandConverter` to make it in sync 
with implicit type coercion rules 
- if type T1 can be converted from T2, then DEFAULT for type T1 can accept 
values of type T2.



> Sql. Add implicit cast coercion rules to DdlSqlToCommandConverter.
> ------------------------------------------------------------------
>
>                 Key: IGNITE-20593
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20593
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Minor
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>
> In order to make behaviour of types in DDL commands consistent with other SQL 
> statements, we need to update `DdlSqlToCommandConverter` to make it in sync 
> with implicit type coercion rules 
> - if type T1 can be converted from T2, then DEFAULT for type T1 can accept 
> values of type T2.
> Example:
> {code:java}
> @Test
> public void testDdl() {
>     sql("CREATE TABLE date_dim (id INTEGER PRIMARY KEY, dim DATE DEFAULT 
> '2000-01-01')");
> }
> //ERROR:
> Caused by: java.lang.ClassCastException: class 
> org.apache.calcite.sql.SqlCharStringLiteral cannot be cast to class 
> org.apache.calcite.sql.SqlUnknownLiteral 
> (org.apache.calcite.sql.SqlCharStringLiteral and 
> org.apache.calcite.sql.SqlUnknownLiteral are in unnamed module of loader 
> 'app')
>       at 
> org.apache.ignite.internal.sql.engine.prepare.ddl.DdlSqlToCommandConverter.fromLiteral(DdlSqlToCommandConverter.java:837)
>       ... 18 more
> {code}



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

Reply via email to