Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-16095

Sql. Null values insertion into columns with NOT NULL constraints throws IgniteException.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • sql

    Description

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

      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
      
      

      more suitable exception need to be thrown here.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zstan Evgeny Stanilovsky
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: