[ 
https://issues.apache.org/jira/browse/IGNITE-21793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17883824#comment-17883824
 ] 

Pavel Pereslegin commented on IGNITE-21793:
-------------------------------------------

*getOrDefault* (in ClientKeyValueView) for simple type mapped null-value must 
return default value instead of exception.

For example, we have a table with primary key "id long" and a single column 
"val long"
And this table contains single row with id = 1 and val = null

{code:java}
KeyValueView<Long, Long> tbl = view();

long val = tbl.getOrDefault(null, 1L, Long.MAX_VALUE));
{code}

Embedded client gets {{Long.MAX_VALUE}}
Thin client throws UnexpectedNullValueException



> Fix inconsistencies in table view APIs
> --------------------------------------
>
>                 Key: IGNITE-21793
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21793
>             Project: Ignite
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Alexey Scherbakov
>            Assignee: Pavel Tupitsyn
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.1
>
>
> # *getOrDefault* accepts nullables after IGNITE-20524, but its semantics is 
> to ensure null safety. It should not accept or nulls (*getNullable* methods 
> exist to deal with nulls)
> # *getNullable* family of methods throws exceptions from tuple-based views 
> (*ClientKeyValueBinaryView*, *KeyValueBinaryViewImpl*), but it should work 
> same as equivalent getters to ensure view equivalence.
> # *getAndReplaceAsync* has nullable key and value, but actual implementations 
> (client and embedded) disallow nulls.
> # *getNullableAndPut* throws *MarshallerException* when value is null, unlike 
> *getAndPut* which correctly throws *NullPointerException*



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

Reply via email to