Skip to content

Instantly share code, notes, and snippets.

@sankars
Created January 8, 2014 15:54
Show Gist options
  • Select an option

  • Save sankars/8318979 to your computer and use it in GitHub Desktop.

Select an option

Save sankars/8318979 to your computer and use it in GitHub Desktop.
JRuby code to scan a hbase table
import org.apache.hadoop.hbase.client.Scan
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.client.HTable
import org.apache.hadoop.hbase.HBaseConfiguration
config = HBaseConfiguration.create()
family = Bytes.toBytes("family-name")
qual = Bytes.toBytes("qualifier")
scan = Scan.new()
table = HTable.new(config, "table-name")
scanner = table.getScanner(scan)
scanner.each do |result|
puts "#{Bytes.toString(result.getRow())}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment