Advertisement
Guest User

Accumulo BatchWriter Ingestion Error

a guest
Apr 26th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1.   @Test
  2.   public void AccumuloError() throws Throwable{
  3.  
  4.     String instanceName = "someInstance";
  5.     String zooServers = "localhost";
  6.     Instance inst = new ZooKeeperInstance(instanceName, zooServers);
  7.     Connector connector = inst.getConnector("someUserName", "somePassword");
  8.  
  9.     CharSequence rowID = "row1";
  10.     CharSequence colFam = "myColFam";
  11.     CharSequence colQual = "myColQual";
  12.     ColumnVisibility colVis = new ColumnVisibility("");
  13.     long timestamp = System.currentTimeMillis();
  14.  
  15.     //path to 2005natav3_ei_ca.mdb
  16.     String filePath = "PATH TO FILE";
  17.  
  18.     File file = new File(filePath);
  19.     ByteBuffer byteBuffer = ByteBuffer.wrap(FileUtils.readFileToByteArray(file));
  20.     Value value = new Value(byteBuffer);
  21.  
  22.     Mutation mutation = new Mutation(rowID);
  23.     mutation.put(colFam, colQual, colVis, timestamp, value);
  24.  
  25.     BatchWriter writer = null;
  26.     long memBuf = 1000000L;
  27.     long timeout = 1000L;
  28.     int numThreads = 10;
  29.     String tableName = "someTableName";
  30.     try {
  31.       writer = connector.createBatchWriter(tableName, memBuf, timeout, numThreads);
  32.     } catch (Exception e) {
  33.       e.printStackTrace();
  34.     }
  35.  
  36.     writer.addMutation(mutation);
  37.     writer.flush();
  38.  
  39.     writer.close();
  40.  
  41.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement