I am looking at the official example of how to write data and I do not
see where is
table created.

Text rowID = new Text("row1");
Text colFam = new Text("myColFam");
Text colQual = new Text("myColQual");
ColumnVisibility colVis = new ColumnVisibility("public");
long timestamp = System.currentTimeMillis();
Value value = new Value("myValue".getBytes());
Mutation mutation = new Mutation(rowID);
mutation.put(colFam, colQual, colVis, timestamp, value);

Would someone please suggest a snippet of code that would augment the
one above and show how to create a table on the fly as well as to use
the existing one (e.g. named "claim")

I am guessing I would do something like:

      SortedSet<Text> partitionKeys = new TreeSet<Text>();
      for (int i = Byte.MIN_VALUE; i < Byte.MAX_VALUE; i++)
        partitionKeys.add(new Text(new byte[] {(byte) i}));
      conn.tableOperations().create(  "claim", DEFAULT_TABLE_NAME));
      conn.tableOperations().addSplits( "claim",DEFAULT_TABLE_NAME),
partitionKeys);

Reply via email to