Skip to content

Instantly share code, notes, and snippets.

@sankars
Last active December 11, 2015 11:48
Show Gist options
  • Save sankars/4596115 to your computer and use it in GitHub Desktop.
Save sankars/4596115 to your computer and use it in GitHub Desktop.
Hbase Get command in Jruby that can be used in Hbase shell
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.client.HTable
import org.apache.hadoop.hbase.client.Get
import org.apache.hadoop.io.Text
conf = HBaseConfiguration.new
tablename = "Customer"
table = HTable.new(conf, tablename)
get = Get.new(Bytes.toBytes('0001'))
data = table.get(get)
v = Bytes.toString(data.getValue(Bytes.toBytes('D'),Bytes.toBytes('N')))
print data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment