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

Maksim Zhuravkov commented on IGNITE-23073:
-------------------------------------------

Looks like an optimization in IGNITE-22765 has caused this issue.

{noformat}
Caused by: java.lang.IllegalArgumentException
        at 
com.google.common.base.Preconditions.checkArgument(Preconditions.java:129)
        at org.apache.calcite.rex.RexLiteral.<init>(RexLiteral.java:234)
        at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:1098)
        at 
org.apache.ignite.internal.sql.engine.rex.IgniteRexBuilder.makeLiteral(IgniteRexBuilder.java:55)
        at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:1664)
        at 
org.apache.ignite.internal.sql.engine.schema.TableDescriptorImpl.newColumnDefaultValue(TableDescriptorImpl.java:135)
        at 
org.apache.ignite.internal.sql.engine.prepare.PlannerHelper.tryOptimizeInsert(PlannerHelper.java:269)
        at 
org.apache.ignite.internal.sql.engine.prepare.PlannerHelper.tryOptimizeFast(PlannerHelper.java:208)
        at 
org.apache.ignite.internal.sql.engine.prepare.PlannerHelper.optimize(PlannerHelper.java:113)
        at 
org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.doOptimize(PrepareServiceImpl.java:675)
{noformat}


> Sql. Constant default value is not implemented for UUID data type
> -----------------------------------------------------------------
>
>                 Key: IGNITE-23073
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23073
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 3.0.0-beta2
>            Reporter: Andrey Khitrin
>            Priority: Major
>              Labels: ignite-3
>
> In SQL, it's possible to define default values for some columns. These values 
> would be used on insertion when explicit values are omitted. For example:
> {code:sql}
> sql-cli> create table def_time(key INTEGER not null, val TIME not null 
> default '12:12:12', primary key (key));
> sql-cli> insert into def_time (key) values (1);
> sql-cli> select * from def_time;
> ╔═════╤══════════╗
> ║ KEY │ VAL      ║
> ╠═════╪══════════╣
> ║ 1   │ 12:12:12 ║
> ╚═════╧══════════╝
> {code}
> But it's not true for *UUID* data type. It's possible to "define" default 
> value for this type, but it's not actually applied as default:
> {code:sql}
> sql-cli> create table def_uuid(key INTEGER not null, val UUID not null 
> default '4a2f1859-c73b-4eec-a29c-629ec68d8735', primary key (key));
> sql-cli> insert into def_uuid(key) values (1);
> Unknown error
> null
> {code}
> Only explicit UUID values are currently supported:
> {code:sql}
> sql-cli> insert into def_uuid values (2, 
> '46e438c5-4722-4806-8614-e5aa15b9ded8');
> Updated 1 rows.
> sql-cli> select * from def_uuid;
> ╔═════╤══════════════════════════════════════╗
> ║ KEY │ VAL                                  ║
> ╠═════╪══════════════════════════════════════╣
> ║ 2   │ 46e438c5-4722-4806-8614-e5aa15b9ded8 ║
> ╚═════╧══════════════════════════════════════╝
> {code}
> Found on `06f62ebd7abb76f9c24d171cf03bad26f21436ca`.
> Probably, it's simply a non-implemented-yet feature (as UUID-related epic is 
> not completely finished yet). In that case, feel free to trasnform this 
> ticket from bug into a feature request.



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

Reply via email to