Skip to content

Instantly share code, notes, and snippets.

@busbey
Created October 12, 2017 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save busbey/c4f62d91663067b648a9c44cd4657773 to your computer and use it in GitHub Desktop.
Save busbey/c4f62d91663067b648a9c44cd4657773 to your computer and use it in GitHub Desktop.
hbase(main):002:0> create 't1', 'family', 'access'
hbase(main):006:0> put = org.apache.hadoop.hbase.client.Put.new("row1".to_java_bytes)
hbase(main):008:0> put.add_column("family".to_java_bytes, "column1".to_java_bytes, "a value".to_java_bytes)
=> #<Java::OrgApacheHadoopHbaseClient::Put:0x648855fd>
hbase(main):009:0> put.add_column("family".to_java_bytes, "column2".to_java_bytes, "another value".to_java_bytes)
=> #<Java::OrgApacheHadoopHbaseClient::Put:0x648855fd>
hbase(main):010:0> put.add_column("access".to_java_bytes, nil, "@group1".to_java_bytes)
=> #<Java::OrgApacheHadoopHbaseClient::Put:0x648855fd>
hbase(main):012:0> get_table("t1").table.put(put)
0 row(s) in 0.0010 seconds
hbase(main):013:0> scan 't1'
ROW COLUMN+CELL
row1 column=access:, timestamp=1507844083361, value=@group1
row1 column=family:column1, timestamp=1507844083361, value=a value
row1 column=family:column2, timestamp=1507844083361, value=another value
1 row(s) in 0.0720 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment