Pavel Pereslegin created IGNITE-27243:
-----------------------------------------
Summary: Reading a null value as a primitive from a binary tuple
should throw an NPE exception instead of a BinaryTupleFormatException.
Key: IGNITE-27243
URL: https://issues.apache.org/jira/browse/IGNITE-27243
Project: Ignite
Issue Type: Improvement
Components: sql ai3
Reporter: Pavel Pereslegin
Currently, reading a primitive field that contains a null value throws a
confusing internal {{BinaryTupleFormatException}}.
In this case, we should throw {{NullPointerException}} instead of
{{BinaryTupleFormatException}}.
Reproducer:
{code:java}
sql("CREATE TABLE t(id INT PRIMARY KEY, v1 INT, v2 INT)");
sql("INSERT INTO t VALUES (0, 1, NULL)");
RecordView<Tuple> view =
CLUSTER.aliveNode().tables().table("T").recordView();
Tuple tuple = view.get(null, Tuple.create().set("id", 0));
IgniteTestUtils.assertThrows(
NullPointerException.class,
() -> tuple.intValue("v2"),
null
);
{code}
{noformat}
org.opentest4j.AssertionFailedError: Unexpected exception type thrown,
Expected :class java.lang.NullPointerException
Actual :class
org.apache.ignite.internal.binarytuple.BinaryTupleFormatException
<Click to see difference>
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)