package com.blm.util
import javax.ws.rs.core.Response.Status.Family
import org.apache.hadoop.h .{CellUtil, H Configuration, TableName}
import org.apache.hadoop.h .client._
import org.apache.hadoop.h .util.Bytes
class H Util {
var conf = H Configuration.create()
conf.set(\"h .zookeeper.quorum\", \"aiszk2.boloomo.com,aiszk1.boloomo.com,aiszk3.boloomo.com\")
var connection = ConnectionFactory.createConnection(conf)
def getH Table( tableName: String): Table = {
val table = connection.getTable(TableName.valueOf(tableName))
table
}
def getResultList(tableName:String,family: String,column:String): Unit =
{
val table = connection.getTable(TableName.valueOf(tableName))
val scan = new Scan()
scan.addFamily(family.getBytes())
scan.addColumn(family.getBytes(),column.getBytes())
val scanner = table.getScanner(scan).iterator()
while (scanner.hasNext)
{
val result:Result = scanner.next()
val row = result.rawCells()
for(cell<-row)
{
val key = Bytes.toString(CellUtil.cloneRow(cell))
val fam = Bytes.toString(CellUtil.cloneFamily(cell))
val clumn = Bytes.toString(CellUtil.cloneQualifier(cell))
val value = Bytes.toString(CellUtil.cloneValue(cell))
println(key+\":\"+fam+\":\"+clumn+\":\"+value)
}
}
}
}