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

Maksim Zhuravkov updated IGNITE-21836:
--------------------------------------
    Description: 
GetNullable method of KeyValueView produces a confusing error for a PoJo when a 
field is primitive but underlying column is nullable:

{code:java}

public class ItKvTest extends BaseSqlIntegrationTest {

    public static class BoolStr {
        boolean boolCol;
        String strCol;
    }

    @Test
    public void testGetNullable() {
        sql("CREATE TABLE t0 (ID INTEGER PRIMARY KEY, boolCol BOOLEAN, strCol 
VARCHAR)");

        Table table = CLUSTER.aliveNode().tables().table("T0");

        KeyValueView<Integer, BoolStr> view = 
table.keyValueView(Mapper.of(Integer.class), Mapper.of(BoolStr.class));

        view.put(null, 1, null);

        view.getNullable(null, 1);
    }
}
{code}

{code:java}
org.apache.ignite.lang.MarshallerException: IGN-CMN-65535 
TraceId:ef2d9c71-8f2d-4279-99fc-25e8e14ede40 Failed to write field [id=0]

        at 
org.apache.ignite.internal.table.KeyValueViewImpl.marshal(KeyValueViewImpl.java:524)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.lambda$putAsync$16(KeyValueViewImpl.java:225)
        at 
org.apache.ignite.internal.table.AbstractTableView.lambda$withSchemaSync$1(AbstractTableView.java:180)
        at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
        at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:180)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:171)
        at 
org.apache.ignite.internal.table.AbstractTableView.doOperation(AbstractTableView.java:147)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.putAsync(KeyValueViewImpl.java:224)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.lambda$put$15(KeyValueViewImpl.java:216)
        at 
org.apache.ignite.internal.table.AbstractTableView.sync(AbstractTableView.java:124)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.put(KeyValueViewImpl.java:216)
        at 
org.apache.ignite.internal.sql.api.ItKevtest.testGetNullable(ItKevtest.java:24)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: org.apache.ignite.internal.marshaller.MarshallerException: 
IGN-CMN-65535 TraceId:ef2d9c71-8f2d-4279-99fc-25e8e14ede40 Failed to write 
field [id=0]
        at 
org.apache.ignite.internal.marshaller.FieldAccessor.write(FieldAccessor.java:401)
        at 
org.apache.ignite.internal.marshaller.Marshaller$PojoMarshaller.writeObject(Marshaller.java:274)
        at 
org.apache.ignite.internal.schema.marshaller.reflection.KvMarshallerImpl.marshal(KvMarshallerImpl.java:102)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.marshal(KeyValueViewImpl.java:522)
        ... 15 more
Caused by: java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:233)
        at 
java.base/java.lang.invoke.VarHandleBooleans$FieldInstanceReadOnly.get(VarHandleBooleans.java:90)
        at 
org.apache.ignite.internal.marshaller.FieldAccessor$VarHandleAccessor.get(FieldAccessor.java:552)
        at 
org.apache.ignite.internal.marshaller.FieldAccessor$BooleanPrimitiveAccessor.write0(FieldAccessor.java:581)
        at 
org.apache.ignite.internal.marshaller.FieldAccessor.write(FieldAccessor.java:399)
        ... 18 more
{code}

This error message can be improved to say exactly what is wrong and how to fix 
user code.


  was:
GetNullable method of KeyValueView produces a confusing error for a PoJo when a 
field is primitive but underlying column is nullable:

{code:java}

public class ItKvTest extends BaseSqlIntegrationTest {

    public static class BoolStr {
        boolean boolCol;
        String strCol;
    }

    @Test
    public void testGetNullable() {
        sql("CREATE TABLE t0 (ID INTEGER PRIMARY KEY, boolCol BOOLEAN, strCol 
VARCHAR)");

        Table table = CLUSTER.aliveNode().tables().table("T0");

        KeyValueView<Integer, BoolStr> view = 
table.keyValueView(Mapper.of(Integer.class), Mapper.of(BoolStr.class));

        view.put(null, 1, null);

        view.getNullable(null, 1);
    }
}
{code}

{code:java}
org.apache.ignite.lang.MarshallerException: IGN-CMN-65535 
TraceId:ef2d9c71-8f2d-4279-99fc-25e8e14ede40 Failed to write field [id=0]

        at 
org.apache.ignite.internal.table.KeyValueViewImpl.marshal(KeyValueViewImpl.java:524)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.lambda$putAsync$16(KeyValueViewImpl.java:225)
        at 
org.apache.ignite.internal.table.AbstractTableView.lambda$withSchemaSync$1(AbstractTableView.java:180)
        at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
        at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:180)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:171)
        at 
org.apache.ignite.internal.table.AbstractTableView.doOperation(AbstractTableView.java:147)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.putAsync(KeyValueViewImpl.java:224)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.lambda$put$15(KeyValueViewImpl.java:216)
        at 
org.apache.ignite.internal.table.AbstractTableView.sync(AbstractTableView.java:124)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.put(KeyValueViewImpl.java:216)
        at 
org.apache.ignite.internal.sql.api.ItKevtest.testGetNullable(ItKevtest.java:24)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: org.apache.ignite.internal.marshaller.MarshallerException: 
IGN-CMN-65535 TraceId:ef2d9c71-8f2d-4279-99fc-25e8e14ede40 Failed to write 
field [id=0]
        at 
org.apache.ignite.internal.marshaller.FieldAccessor.write(FieldAccessor.java:401)
        at 
org.apache.ignite.internal.marshaller.Marshaller$PojoMarshaller.writeObject(Marshaller.java:274)
        at 
org.apache.ignite.internal.schema.marshaller.reflection.KvMarshallerImpl.marshal(KvMarshallerImpl.java:102)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.marshal(KeyValueViewImpl.java:522)
        ... 15 more
Caused by: java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:233)
        at 
java.base/java.lang.invoke.VarHandleBooleans$FieldInstanceReadOnly.get(VarHandleBooleans.java:90)
        at 
org.apache.ignite.internal.marshaller.FieldAccessor$VarHandleAccessor.get(FieldAccessor.java:552)
        at 
org.apache.ignite.internal.marshaller.FieldAccessor$BooleanPrimitiveAccessor.write0(FieldAccessor.java:581)
        at 
org.apache.ignite.internal.marshaller.FieldAccessor.write(FieldAccessor.java:399)
        ... 18 more
{code}




> KeyValueView. GetNullable produces confusing error for a PoJo with primitive 
> fields when column is nullable
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-21836
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21836
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Minor
>              Labels: ignite-3
>
> GetNullable method of KeyValueView produces a confusing error for a PoJo when 
> a field is primitive but underlying column is nullable:
> {code:java}
> public class ItKvTest extends BaseSqlIntegrationTest {
>     public static class BoolStr {
>         boolean boolCol;
>         String strCol;
>     }
>     @Test
>     public void testGetNullable() {
>         sql("CREATE TABLE t0 (ID INTEGER PRIMARY KEY, boolCol BOOLEAN, strCol 
> VARCHAR)");
>         Table table = CLUSTER.aliveNode().tables().table("T0");
>         KeyValueView<Integer, BoolStr> view = 
> table.keyValueView(Mapper.of(Integer.class), Mapper.of(BoolStr.class));
>         view.put(null, 1, null);
>         view.getNullable(null, 1);
>     }
> }
> {code}
> {code:java}
> org.apache.ignite.lang.MarshallerException: IGN-CMN-65535 
> TraceId:ef2d9c71-8f2d-4279-99fc-25e8e14ede40 Failed to write field [id=0]
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.marshal(KeyValueViewImpl.java:524)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.lambda$putAsync$16(KeyValueViewImpl.java:225)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.lambda$withSchemaSync$1(AbstractTableView.java:180)
>       at 
> java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
>       at 
> java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2341)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:180)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:171)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.doOperation(AbstractTableView.java:147)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.putAsync(KeyValueViewImpl.java:224)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.lambda$put$15(KeyValueViewImpl.java:216)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.sync(AbstractTableView.java:124)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.put(KeyValueViewImpl.java:216)
>       at 
> org.apache.ignite.internal.sql.api.ItKevtest.testGetNullable(ItKevtest.java:24)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> Caused by: org.apache.ignite.internal.marshaller.MarshallerException: 
> IGN-CMN-65535 TraceId:ef2d9c71-8f2d-4279-99fc-25e8e14ede40 Failed to write 
> field [id=0]
>       at 
> org.apache.ignite.internal.marshaller.FieldAccessor.write(FieldAccessor.java:401)
>       at 
> org.apache.ignite.internal.marshaller.Marshaller$PojoMarshaller.writeObject(Marshaller.java:274)
>       at 
> org.apache.ignite.internal.schema.marshaller.reflection.KvMarshallerImpl.marshal(KvMarshallerImpl.java:102)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.marshal(KeyValueViewImpl.java:522)
>       ... 15 more
> Caused by: java.lang.NullPointerException
>       at java.base/java.util.Objects.requireNonNull(Objects.java:233)
>       at 
> java.base/java.lang.invoke.VarHandleBooleans$FieldInstanceReadOnly.get(VarHandleBooleans.java:90)
>       at 
> org.apache.ignite.internal.marshaller.FieldAccessor$VarHandleAccessor.get(FieldAccessor.java:552)
>       at 
> org.apache.ignite.internal.marshaller.FieldAccessor$BooleanPrimitiveAccessor.write0(FieldAccessor.java:581)
>       at 
> org.apache.ignite.internal.marshaller.FieldAccessor.write(FieldAccessor.java:399)
>       ... 18 more
> {code}
> This error message can be improved to say exactly what is wrong and how to 
> fix user code.



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

Reply via email to