日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用hbase小结

發布時間:2025/4/5 编程问答 14 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用hbase小结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

背景

hbase中一張表的rowkey定義為時間戳+字符串

需求

根據時間戳和列簇中某列的值為"abc",導出一天內的數據到excel中。

使用FilterList

     FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);SingleColumnValueFilter filter=new SingleColumnValueFilter("info".getBytes(),"supplier".getBytes(), CompareFilter.CompareOp.EQUAL,"abc".getBytes());filter.setFilterIfMissing(true);filterList.addFilter(filter);List<String> list = new ArrayList<String>();List<ResultDTO> listSpider = new ArrayList<ResultDTO>();Scan scan = new Scan(); scan.setStartRow(Bytes.toBytes(startKey));scan.setStopRow(Bytes.toBytes(endtKey));scan.setFilter(filterList);Connection conn = null;HTable table = null;try {conn = getConnection();table = (HTable) conn.getTable(TableName.valueOf(tableName));ResultScanner rs = table.getScanner(scan);

1.rowkey的range,設置startrow和StopRow值

2.列值過濾,使用

SingleColumnValueFilter

默認情況下,列值為空時把此行結果算入

filter.setFilterIfMissing(true);//排除列值為空的

官方說明:To prevent the entire row from being emitted if the column is not found on a row, use?setFilterIfMissing(boolean). Otherwise, if the column is found, the entire row will be emitted only if the value passes. If the value fails, the row will be filtered out.

轉載于:https://www.cnblogs.com/davidwang456/p/8303152.html

總結

以上是生活随笔為你收集整理的使用hbase小结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。