AnsweredAssumed Answered

MapR DB Document Exsists Exception

Question asked by Velumani on Apr 15, 2016
Latest reply on Apr 15, 2016 by maprcommunity


Hi,

     I am getting document existing exception when I try to insert a simple document in MapR DB table using OJAI. There are no entries in that table. Below is the code snippet.

 

          MapRDB.deleteTable("/tables/MasterDataMapping");

          MapRDB.createTable("/tables/MasterDataMapping");

          Table table = MapRDB.getTable("/tables/MasterDataMapping"); // get the table  

          System.out.println(" Table Name : " + table.getName());

          System.out.println(" Table Path : " + table.getPath());

          System.out.println(" Table Infos : " + Arrays.toString(table.getTabletInfos()));

  

          DBDocument doc = MapRDB.newDocument().set("key", "value").set("_id", "1");

          table.insert(doc);

 

And the console output is

 

 

=============== TABLE INFO ===============

Table Name : MasterDataMapping

Table Path : /tables/MasterDataMapping

Table Infos : [TabletInfoImpl [condition=[RowkeyRange [startRow=, stopRow=]], locations=[maprdemo], estimatedSize=0, estimatedNumRows=0]]

==========================================

 

Exception in thread "main" com.mapr.db.exceptions.DocumentExistsException: A row with key "\x031" already exist in the table

  at com.mapr.db.impl.MapRDBTableImpl._insert(MapRDBTableImpl.java:1285)

  at com.mapr.db.impl.MapRDBTableImpl.insert(MapRDBTableImpl.java:1261)

  at com.mapr.db.impl.MapRDBTableImpl.insert(MapRDBTableImpl.java:1278)

  at com.mapr.db.importer.streamParser.<init>(streamParser.java:29)

  at com.mapr.db.importer.ojaiImport.main(ojaiImport.java:41)

 

Any help is highly appreciable. Thanks in Advace

Outcomes