-2

When i run my code in the test environment to test my new code about kudu insert,it reports to me:

This row was already applied and cannot be modified.

I have already tried to debug my code and to see what is the problem in my code , but it is useless

if((map.get(list.get(i))) instanceof Double){
    row.addDouble(list.get(i), (Double) map.get(list.get(i)));
    //System.out.println("Double type insert succeed : " + list.get(i) + "  :  " + map.get(list.get(i)));
    continue;
}

I want to know what's wrong in my code because in my previous code i can run correct but know it cannot

Jelly
  • 1
  • 2

2 Answers2

0

In the source code ,The class was that PartialRow has a private propertiy:frozen, It's default value was false,but in my code,when i debug in it,i found that value was true,I think this is the reason that cause the program reports to my : This row was alredy applied and cannot be modified ! asking for help .please

Jelly
  • 1
  • 2
0

Without full stacktrace and the rest of code I can only guess why this is happening.

My guess is because the Insert object on which this row object is created has already inserted to Kudu (using KuduSession.apply) and then you tried to update it using row.addDouble.

If you are unsure about why please see this example of how to insert into Kudu. KuduSession.apply method is invoked on Insert object on which PartialRow object is created, this will insert the data from all the PartialRow objects created from the Insert object. This can be done only once on one Insert object. After that you create a new Insert object using KuduTable.newInsert()

In your case you should probably create new object of Insert using KuduTable.newInsert() and create a row object on this.

shanmuga
  • 4,329
  • 2
  • 21
  • 35