Reply
Highlighted
HJ
Explorer
Posts: 12
Registered: ‎07-05-2018

APACHE kudu java API

I am trying to update the kudu table using java api.

i ahve table named users and it has two columns username and age,primary key is set when creating the table 

when i try to update the age from 26 whicc is already been inserted to 29.

 i get the following exception

org.apache.kudu.client.NonRecoverableException: Primary key column usernameis not set
at org.apache.kudu.client.KuduException.transformException(KuduException.java:107)
at org.apache.kudu.client.KuduSession.apply(KuduSession.java:94)
at java_app.Update_kudu.main(Update_kudu.java:91)
Caused by: java.lang.IllegalStateException: Primary key column username is not set

 

code goes like this 

Update update = table.newUpdate();
PartialRow row = update.getRow();
row.addInt("age", Integer.parseInt("27"));
session.apply(update);

please help me with this .ASAP

Announcements