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

Pavel Tupitsyn updated IGNITE-21009:
------------------------------------
    Description: 
The following test fails:

{code}
    [Test]
    public async Task TestPutGetNullable()
    {
        await Client.Sql.ExecuteAsync(null, "CREATE TABLE TestPutGetNullable 
(ID BIGINT PRIMARY KEY, VAL BIGINT)");
        await Client.Sql.ExecuteAsync(null, "INSERT INTO TestPutGetNullable 
VALUES (1, 1), (2, NULL)");

        var table = await Client.Tables.GetTableAsync("TestPutGetNullable");
        var view = table!.GetKeyValueView<long, long>();

        var res1 = await view.GetAsync(null, 1);
        var res2 = await view.GetAsync(null, 2);
    }
{code}

Result:

{code}
System.InvalidOperationException : Binary tuple element with index 1 is null.
   at 
Apache.Ignite.Internal.Proto.BinaryTuple.BinaryTupleReader.ThrowNullElementException[T](Int32
 index) in 
/home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs:line
 572
   at Apache.Ignite.Internal.Proto.BinaryTuple.BinaryTupleReader.GetLong(Int32 
index) in 
/home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs:line
 155
   at 
ReadApache.Ignite.Internal.Table.Serialization.KvPair`2[System.Int64,System.Int64](BinaryTupleReader&
 )
   at 
Apache.Ignite.Internal.Table.Serialization.ObjectSerializerHandler`1.Read(MsgPackReader&
 reader, Schema schema, Boolean keyOnly)
   at 
Apache.Ignite.Internal.Table.Serialization.RecordSerializer`1.ReadValue(PooledBuffer
 buf, Schema schema)
   at Apache.Ignite.Internal.Table.RecordView`1.GetAsync(ITransaction 
transaction, T key)
   at Apache.Ignite.Internal.Table.KeyValueView`2.GetAsync(ITransaction 
transaction, TK key)
   at Apache.Ignite.Tests.Table.KeyValueViewPrimitiveTests.TestPutGetNullable()
{code}

*ITable.GetKeyValueView* does not allow nullable types ("where TV : notnull") - 
so we don't have a way to work with nullable columns in this case.
See how Java handles this with additional nullable methods: IGNITE-16115

  was:
The following test fails:

{code}
    [Test]
    public async Task TestPutGetNullable()
    {
        await Client.Sql.ExecuteAsync(null, "CREATE TABLE TestPutGetNullable 
(ID BIGINT PRIMARY KEY, VAL BIGINT)");
        await Client.Sql.ExecuteAsync(null, "INSERT INTO TestPutGetNullable 
VALUES (1, 1), (2, NULL)");

        var table = await Client.Tables.GetTableAsync("TestPutGetNullable");
        var view = table!.GetKeyValueView<long, long>();

        var res1 = await view.GetAsync(null, 1);
        var res2 = await view.GetAsync(null, 2);
    }
{code}

Result:

{code}
System.InvalidOperationException : Binary tuple element with index 1 is null.
   at 
Apache.Ignite.Internal.Proto.BinaryTuple.BinaryTupleReader.ThrowNullElementException[T](Int32
 index) in 
/home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs:line
 572
   at Apache.Ignite.Internal.Proto.BinaryTuple.BinaryTupleReader.GetLong(Int32 
index) in 
/home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs:line
 155
   at 
ReadApache.Ignite.Internal.Table.Serialization.KvPair`2[System.Int64,System.Int64](BinaryTupleReader&
 )
   at 
Apache.Ignite.Internal.Table.Serialization.ObjectSerializerHandler`1.Read(MsgPackReader&
 reader, Schema schema, Boolean keyOnly)
   at 
Apache.Ignite.Internal.Table.Serialization.RecordSerializer`1.ReadValue(PooledBuffer
 buf, Schema schema)
   at Apache.Ignite.Internal.Table.RecordView`1.GetAsync(ITransaction 
transaction, T key)
   at Apache.Ignite.Internal.Table.KeyValueView`2.GetAsync(ITransaction 
transaction, TK key)
   at Apache.Ignite.Tests.Table.KeyValueViewPrimitiveTests.TestPutGetNullable()
{code}

*ITable.GetKeyValueView* does not allow nullable types ("where TV : notnull") - 
so we don't have a way to work with nullable columns in this case.


> .NET: Thin 3.0: Nullable columns are not supported in KeyValueView with 
> primitive mapping
> -----------------------------------------------------------------------------------------
>
>                 Key: IGNITE-21009
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21009
>             Project: Ignite
>          Issue Type: Bug
>          Components: platforms, thin client
>    Affects Versions: 3.0.0-beta1
>            Reporter: Pavel Tupitsyn
>            Assignee: Pavel Tupitsyn
>            Priority: Major
>             Fix For: 3.0.0-beta2
>
>
> The following test fails:
> {code}
>     [Test]
>     public async Task TestPutGetNullable()
>     {
>         await Client.Sql.ExecuteAsync(null, "CREATE TABLE TestPutGetNullable 
> (ID BIGINT PRIMARY KEY, VAL BIGINT)");
>         await Client.Sql.ExecuteAsync(null, "INSERT INTO TestPutGetNullable 
> VALUES (1, 1), (2, NULL)");
>         var table = await Client.Tables.GetTableAsync("TestPutGetNullable");
>         var view = table!.GetKeyValueView<long, long>();
>         var res1 = await view.GetAsync(null, 1);
>         var res2 = await view.GetAsync(null, 2);
>     }
> {code}
> Result:
> {code}
> System.InvalidOperationException : Binary tuple element with index 1 is null.
>    at 
> Apache.Ignite.Internal.Proto.BinaryTuple.BinaryTupleReader.ThrowNullElementException[T](Int32
>  index) in 
> /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs:line
>  572
>    at 
> Apache.Ignite.Internal.Proto.BinaryTuple.BinaryTupleReader.GetLong(Int32 
> index) in 
> /home/pavel/w/ignite-3/modules/platforms/dotnet/Apache.Ignite/Internal/Proto/BinaryTuple/BinaryTupleReader.cs:line
>  155
>    at 
> ReadApache.Ignite.Internal.Table.Serialization.KvPair`2[System.Int64,System.Int64](BinaryTupleReader&
>  )
>    at 
> Apache.Ignite.Internal.Table.Serialization.ObjectSerializerHandler`1.Read(MsgPackReader&
>  reader, Schema schema, Boolean keyOnly)
>    at 
> Apache.Ignite.Internal.Table.Serialization.RecordSerializer`1.ReadValue(PooledBuffer
>  buf, Schema schema)
>    at Apache.Ignite.Internal.Table.RecordView`1.GetAsync(ITransaction 
> transaction, T key)
>    at Apache.Ignite.Internal.Table.KeyValueView`2.GetAsync(ITransaction 
> transaction, TK key)
>    at 
> Apache.Ignite.Tests.Table.KeyValueViewPrimitiveTests.TestPutGetNullable()
> {code}
> *ITable.GetKeyValueView* does not allow nullable types ("where TV : notnull") 
> - so we don't have a way to work with nullable columns in this case.
> See how Java handles this with additional nullable methods: IGNITE-16115



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

Reply via email to