You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Evgeny Stanilovsky (Jira)" <ji...@apache.org> on 2021/12/09 15:28:00 UTC

[jira] [Created] (IGNITE-16095) Sql. Null values insertion into columns with NOT NULL constraints throws IgniteException.

Evgeny Stanilovsky created IGNITE-16095:
-------------------------------------------

             Summary: Sql. Null values insertion into columns with NOT NULL constraints throws IgniteException.  
                 Key: IGNITE-16095
                 URL: https://issues.apache.org/jira/browse/IGNITE-16095
             Project: Ignite
          Issue Type: Improvement
          Components: sql
            Reporter: Evgeny Stanilovsky


CREATE TABLE tbl(c1 int primary key, c2 int NOT NULL);
INSERT INTO tbl(c1, c2) VALUES (2, NULL);
throws:

{noformat}
Caused by: class org.apache.ignite.lang.IgniteException: Failed to set column (null was passed, but column is not nullable): [col=Column [schemaIndex=1, columnOrder=1, name=C2, type=NativeType [name=INT32, sizeInBytes=4, fixed=true], nullable=false]]
	at org.apache.ignite.internal.table.AbstractTableView.convertException(AbstractTableView.java:100)
	at org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:358)
	at org.apache.ignite.internal.table.RecordBinaryViewImpl.mapToBinary(RecordBinaryViewImpl.java:401)
	at org.apache.ignite.internal.table.RecordBinaryViewImpl.insertAllAsync(RecordBinaryViewImpl.java:177)
	at org.apache.ignite.internal.table.RecordBinaryViewImpl.insertAll(RecordBinaryViewImpl.java:169)
	at org.apache.ignite.internal.processors.query.calcite.exec.rel.ModifyNode.flushTuples(ModifyNode.java:198)
	at org.apache.ignite.internal.processors.query.calcite.exec.rel.ModifyNode.tryEnd(ModifyNode.java:169)
	at org.apache.ignite.internal.processors.query.calcite.exec.rel.ModifyNode.end(ModifyNode.java:142)
	at org.apache.ignite.internal.processors.query.calcite.exec.rel.ProjectNode.end(ProjectNode.java:81)
	at org.apache.ignite.internal.processors.query.calcite.exec.rel.ScanNode.push(ScanNode.java:132)
	at org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext.lambda$execute$0(ExecutionContext.java:305)
	at org.apache.ignite.internal.processors.query.calcite.exec.QueryTaskExecutorImpl.lambda$execute$0(QueryTaskExecutorImpl.java:78)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: class org.apache.ignite.internal.schema.marshaller.TupleMarshallerException: Failed to set column (null was passed, but column is not nullable): [col=Column [schemaIndex=1, columnOrder=1, name=C2, type=NativeType [name=INT32, sizeInBytes=4, fixed=true], nullable=false]]
	at org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:77)
	at org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:355)
	... 13 more
Caused by: java.lang.IllegalArgumentException: Failed to set column (null was passed, but column is not nullable): [col=Column [schemaIndex=1, columnOrder=1, name=C2, type=NativeType [name=INT32, sizeInBytes=4, fixed=true], nullable=false]]
	at org.apache.ignite.internal.schema.Column.validate(Column.java:229)
	at org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.toInternalTuple(TupleMarshallerImpl.java:224)
	at org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:67)
	... 14 more

{noformat}

more suitable exception need to be thrown here.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)