[
https://issues.apache.org/jira/browse/IGNITE-21793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884281#comment-17884281
]
Pavel Pereslegin edited comment on IGNITE-21793 at 9/22/25 4:29 PM:
--------------------------------------------------------------------
Separate issue IGNITE-26491 has been created for the following case.
The behavior of the embedded client is inconsistent (and looks incorrect) with
the thin client when trying to read a narrower integer type from tuple.
For example, when we have table with bigint column val.
{code:sql}
create table test_int (id bigint primary key, val bigint not null)
{code}
Getting existing row from view
{code:java}
tuple = kvVIew.get(null, key);
{code}
the next
{code:java}
tuple.intValue("VAL")
{code}
in thin client produces
{noformat}
ClassCastException: Column with name 'VAL' has type INT64 but INT32 was
requested
{noformat}
but does not produces any errors in embedded client.
(need to check the same case with record view also)
Full reproducer
{code:java}
sql("create table test_int (id bigint primary key, val bigint)");
KeyValueView<Tuple, Tuple> kvVIew =
client.tables().table("test_int").keyValueView();
KeyValueView<Tuple, Tuple> kvVIewEmbedded =
CLUSTER.aliveNode().tables().table("test_int").keyValueView();
Tuple key = Tuple.create().set("id", 1L);
Tuple val = Tuple.create().set("val", 1L);
kvVIew.put(null, key, val);
Tuple thinReturnedVal = kvVIew.get(null, key);
Tuple embeddedReturnedVal = kvVIewEmbedded.get(null, key);
assertEquals(1, embeddedReturnedVal.longValue(0));
assertEquals(1, thinReturnedVal.longValue(0));
// The following statement should fail, but does not fail.
assertEquals(1, embeddedReturnedVal.intValue("VAL"));
// The following statement fails with ClassCastException.
assertEquals(1, thinReturnedVal.intValue("VAL"));
{code}
was (Author: xtern):
The behavior of the embedded client is inconsistent (and looks incorrect) with
the thin client when trying to read a narrower integer type from tuple.
For example, when we have table with bigint column val.
{code:sql}
create table test_int (id bigint primary key, val bigint not null)
{code}
Getting existing row from view
{code:java}
tuple = kvVIew.get(null, key);
{code}
the next
{code:java}
tuple.intValue("VAL")
{code}
in thin client produces
{noformat}
ClassCastException: Column with name 'VAL' has type INT64 but INT32 was
requested
{noformat}
but does not produces any errors in embedded client.
(need to check the same case with record view also)
Full reproducer
{code:java}
sql("create table test_int (id bigint primary key, val bigint)");
KeyValueView<Tuple, Tuple> kvVIew =
client.tables().table("test_int").keyValueView();
KeyValueView<Tuple, Tuple> kvVIewEmbedded =
CLUSTER.aliveNode().tables().table("test_int").keyValueView();
Tuple key = Tuple.create().set("id", 1L);
Tuple val = Tuple.create().set("val", 1L);
kvVIew.put(null, key, val);
Tuple thinReturnedVal = kvVIew.get(null, key);
Tuple embeddedReturnedVal = kvVIewEmbedded.get(null, key);
assertEquals(1, embeddedReturnedVal.longValue(0));
assertEquals(1, thinReturnedVal.longValue(0));
// The following statement should fail, but does not fail.
assertEquals(1, embeddedReturnedVal.intValue("VAL"));
// The following statement fails with ClassCastException.
assertEquals(1, thinReturnedVal.intValue("VAL"));
{code}
> 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.- (fixed in
> IGNITE-23003)
> # *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)