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))); } }
    故乡明
  • 相关阅读:
    Ext学习-HelloWorld以及基础环境搭建
    简易复选框样式设置
    浏览器加载js文件顺序
    handsontable前端excel学习笔记
    前端构建工具里babel-polyfill的使用问题
    前端后端分离,怎么解决SEO优化的问题呢?
    关于babel和babel-polyfill
    一段node代码的解读
    express笔记
    mac下通过brew安装的Nginx在哪
  • 原文地址:https://www.cnblogs.com/luweiweicode/p/14075027.html
Copyright © 2011-2022 走看看