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

Maksim Zhuravkov updated IGNITE-27744:
--------------------------------------
    Description: 
Looks like this issue is caused by usage of `SchemaMismatchException(String) 
constructor` that calls deprecated constructor of its superclass which sets 
error code to INTERNAL_ERR.

{noformat}
Caused by: org.apache.ignite.lang.IgniteException: IGN-MARSHALLING-1 
org.apache.ignite.lang.MarshallerException: IGN-MARSHALLING-1 Failed to 
serialize row for table PUBLIC.KV. Column 'VAL' does not allow NULLs 
TraceId:8c28c8c0
        at 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:132)
        at 
org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:445)
        at 
org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:429)

<omitted for brevity>

        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.ignite.internal.schema.SchemaMismatchException: 
IGN-CMN-65535 Column 'VAL' does not allow NULLs TraceId:8c28c8c0
        at org.apache.ignite.internal.schema.Column.validate(Column.java:212)
        at 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.gatherStatistics(TupleMarshallerImpl.java:235)
        at 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:118)
        ... 21 more
 TraceId:8c28c8c0
{noformat}

This happens in both client and embedded modes.

*Expected behaviour*
This one and similar SchemaExceptions should not have INTERNAL_ERROR.


Reproducer:
{noformat}

import static org.junit.jupiter.api.Assertions.fail;

import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
import org.apache.ignite.table.KeyValueView;
import org.apache.ignite.table.Tuple;
import org.junit.jupiter.api.Test;

public class NullsTest extends ClusterPerClassIntegrationTest {
    
    @Test
    public void client() {
        try (var client = 
IgniteClient.builder().addresses("localhost:10800").build()) {
            example(client);
        }
    }
    
    @Test
    public void embedded() {
        example(node(0));
    }
    
    private static void example(Ignite ignite) {
        ignite.sql().executeScript("DROP TABLE IF EXISTS kv; CREATE TABLE kv 
(key INT, val INT NOT NULL, PRIMARY KEY (key))");
        
        KeyValueView<Tuple, Tuple> view = 
ignite.tables().table("kv").keyValueView();
        
        try {
            view.put(null, Tuple.create(Map.of("key", 1)), Tuple.create());
            fail();
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
    }
}
{noformat}



  was:
Looks like this issue is caused by usage of `SchemaMismatchException(String) 
constructor` that calls deprecated constructor of its superclass which sets 
error code to INTERNAL_ERR.

{noformat}
Caused by: org.apache.ignite.lang.IgniteException: IGN-MARSHALLING-1 
org.apache.ignite.lang.MarshallerException: IGN-MARSHALLING-1 Failed to 
serialize row for table PUBLIC.KV. Column 'VAL' does not allow NULLs 
TraceId:8c28c8c0
        at 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:132)
        at 
org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:445)
        at 
org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:429)

<omitted for brevity>

        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.ignite.internal.schema.SchemaMismatchException: 
IGN-CMN-65535 Column 'VAL' does not allow NULLs TraceId:8c28c8c0
        at org.apache.ignite.internal.schema.Column.validate(Column.java:212)
        at 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.gatherStatistics(TupleMarshallerImpl.java:235)
        at 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:118)
        ... 21 more
 TraceId:8c28c8c0
{noformat}

This happens in both client and embedded modes.

*Expected behaviour *
This one and similar SchemaExceptions should not have INTERNAL_ERROR.


Reproducer:
{noformat}

import static org.junit.jupiter.api.Assertions.fail;

import java.util.Map;
import org.apache.ignite.Ignite;
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
import org.apache.ignite.table.KeyValueView;
import org.apache.ignite.table.Tuple;
import org.junit.jupiter.api.Test;

public class NullsTest extends ClusterPerClassIntegrationTest {
    
    @Test
    public void client() {
        try (var client = 
IgniteClient.builder().addresses("localhost:10800").build()) {
            example(client);
        }
    }
    
    @Test
    public void embedded() {
        example(node(0));
    }
    
    private static void example(Ignite ignite) {
        ignite.sql().executeScript("DROP TABLE IF EXISTS kv; CREATE TABLE kv 
(key INT, val INT NOT NULL, PRIMARY KEY (key))");
        
        KeyValueView<Tuple, Tuple> view = 
ignite.tables().table("kv").keyValueView();
        
        try {
            view.put(null, Tuple.create(Map.of("key", 1)), Tuple.create());
            fail();
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
    }
}
{noformat}




> KeyValueView.  NOT NULL constraint violation has INTERNAL_ERR code in its 
> cause
> -------------------------------------------------------------------------------
>
>                 Key: IGNITE-27744
>                 URL: https://issues.apache.org/jira/browse/IGNITE-27744
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 3.1
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>
> Looks like this issue is caused by usage of `SchemaMismatchException(String) 
> constructor` that calls deprecated constructor of its superclass which sets 
> error code to INTERNAL_ERR.
> {noformat}
> Caused by: org.apache.ignite.lang.IgniteException: IGN-MARSHALLING-1 
> org.apache.ignite.lang.MarshallerException: IGN-MARSHALLING-1 Failed to 
> serialize row for table PUBLIC.KV. Column 'VAL' does not allow NULLs 
> TraceId:8c28c8c0
>       at 
> org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:132)
>       at 
> org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:445)
>       at 
> org.apache.ignite.internal.table.RecordBinaryViewImpl.marshal(RecordBinaryViewImpl.java:429)
> <omitted for brevity>
>       at java.base/java.lang.Thread.run(Thread.java:833)
> Caused by: org.apache.ignite.internal.schema.SchemaMismatchException: 
> IGN-CMN-65535 Column 'VAL' does not allow NULLs TraceId:8c28c8c0
>       at org.apache.ignite.internal.schema.Column.validate(Column.java:212)
>       at 
> org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.gatherStatistics(TupleMarshallerImpl.java:235)
>       at 
> org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.marshal(TupleMarshallerImpl.java:118)
>       ... 21 more
>  TraceId:8c28c8c0
> {noformat}
> This happens in both client and embedded modes.
> *Expected behaviour*
> This one and similar SchemaExceptions should not have INTERNAL_ERROR.
> Reproducer:
> {noformat}
> import static org.junit.jupiter.api.Assertions.fail;
> import java.util.Map;
> import org.apache.ignite.Ignite;
> import org.apache.ignite.client.IgniteClient;
> import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
> import org.apache.ignite.table.KeyValueView;
> import org.apache.ignite.table.Tuple;
> import org.junit.jupiter.api.Test;
> public class NullsTest extends ClusterPerClassIntegrationTest {
>     
>     @Test
>     public void client() {
>         try (var client = 
> IgniteClient.builder().addresses("localhost:10800").build()) {
>             example(client);
>         }
>     }
>     
>     @Test
>     public void embedded() {
>         example(node(0));
>     }
>     
>     private static void example(Ignite ignite) {
>         ignite.sql().executeScript("DROP TABLE IF EXISTS kv; CREATE TABLE kv 
> (key INT, val INT NOT NULL, PRIMARY KEY (key))");
>         
>         KeyValueView<Tuple, Tuple> view = 
> ignite.tables().table("kv").keyValueView();
>         
>         try {
>             view.put(null, Tuple.create(Map.of("key", 1)), Tuple.create());
>             fail();
>         } catch (Exception e) {
>             e.printStackTrace(System.err);
>         }
>     }
> }
> {noformat}



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

Reply via email to