zoukankan      html  css  js  c++  java
  • hbase 得到一行的数据详情

    • 列的详细信息
    得到某一行所有数据

    public
    static void getRow(String tableName, String rowKey) throws IOException{
    HTable table = new HTable(conf, tableName); Get get = new Get(Bytes.toBytes(rowKey)); //get.setMaxVersions();显示所有版本 //get.setTimeStamp();显示指定时间戳的版本Result result = table.get(get); for(Cell cell : result.rawCells()){ System.out.println("行键:" + Bytes.toString(result.getRow())); System.out.println("列族" + Bytes.toString(CellUtil.cloneFamily(cell))); System.out.println("列:" + Bytes.toString(CellUtil.cloneQualifier(cell))); System.out.println("值:" + Bytes.toString(CellUtil.cloneValue(cell))); System.out.println("时间戳:" + cell.getTimestamp()); } }

    获取某一行指定“列族:列”的数据
    public static void getRowQualifier(String tableName, String rowKey, String family, String qualifier) throws IOException{
    HTable table = new HTable(conf, tableName); Get get = new Get(Bytes.toBytes(rowKey)); get.addColumn(Bytes.toBytes(family), Bytes.toBytes(qualifier));
    Result result = table.get(get); for(Cell cell : result.rawCells()){ System.out.println("行键:" + Bytes.toString(result.getRow())); System.out.println("列族" + Bytes.toString(CellUtil.cloneFamily(cell)));
    System.out.println("列:" + Bytes.toString(CellUtil.cloneQualifier(cell))); System.out.println("值:" + Bytes.toString(CellUtil.cloneValue(cell))); } }
    故乡明
  • 相关阅读:
    ASP.NET Core 中间件 中间件(Middleware)和过滤器(Filter)的区别
    ASP.NET Core 中间件详解及项目实战
    开源项目1:某大学校友管理系统
    web安全浅析
    p2p网贷平台设计简析
    一些常见的并且比较难解决的设计问题
    CentOS 新增swap交换空间
    策略模式
    Centos6.4 本地yum源配置
    Linux(CentOs6.4)安装Git
  • 原文地址:https://www.cnblogs.com/luweiweicode/p/14075027.html
Copyright © 2011-2022 走看看