You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Konstantin Orlov (Jira)" <ji...@apache.org> on 2024/03/19 10:01:00 UTC
[jira] [Created] (IGNITE-21797) Column's type mismatch during marshalling of pojo
Konstantin Orlov created IGNITE-21797:
-----------------------------------------
Summary: Column's type mismatch during marshalling of pojo
Key: IGNITE-21797
URL: https://issues.apache.org/jira/browse/IGNITE-21797
Project: Ignite
Issue Type: Bug
Reporter: Konstantin Orlov
Take a look at the scenario below:
{code:java}
static class Key {
int int_col;
String str_col;
}
static class Val {
boolean bool_col;
LocalDate date_col;
}
sql("CREATE TABLE test (int_col INT, bool_col BOOLEAN, date_col DATE, str_col VARCHAR, PRIMARY KEY (int_col, str_col))");
KeyValueView<Key, Val> kvView = CLUSTER.aliveNode().tables()
.table("test")
.keyValueView(Key.class, Val.class);
var key = new Key();
key.int_col = 1;
key.str_col = "1";
var val = new Val();
val.bool_col = true;
val.date_col = LocalDate.now();
kvView.put(null, key, val);
{code}
Mind the order of primary key fields: the first and the last columns in table declaration. In that case, {{InvalidTypeException}} is thrown, because after IGNITE-19744 key columns are not grouped in the very beginning of the row anymore, but marshaller of embedded client still appends key columns first (see {{org.apache.ignite.internal.schema.marshaller.reflection.KvMarshallerImpl#marshal(K, V)}}).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)