scala - HBase 多个 PrefixFilters + setLimit
问题描述
我有一个行前缀列表。我想为每个前缀查询 N 行。
我不能使用 MultiRowRangeFilter 因为我不知道该范围的结尾行键前缀是什么。我也不能使用 scan.setLimit(N) 因为我认为它会将查询的总行数限制为 N (我想要的是每个前缀都有 N 行)。
我目前的设置:
val hbaseConf = HBaseConfiguration.create()
// set zookeeper quorum properties in hbaseConf
val hbaseContext = new HBaseContext(sc, hbaseConf)
val rowPrefixes = Array("a", "b", "c")
val filterList = new FilterList()
rowPrefixes.foreach { x => filterList.addFilter(new PrefixFilter(Bytes.toBytes(x))) }
var scan = new Scan()
scan.setFilter(filterList)
scan.addFamily(Bytes.toBytes("myCF"));
val rdd = hbaseContext.hbaseRDD(TableName.valueOf("tableName"), scan)
rdd.mapPartitions(populateCaseClass)
我不确定我应该使用哪个过滤器来实现这个多个行键前缀 + 每个行键的 setLimit ...
解决方案
推荐阅读
- angular - 为什么 ngFor 循环遍历 JSON 数组但返回空属性值?
- r - 在 R 中读取 xlsx 文件时,路径必须是字符串错误
- javascript - javascript window.close() 不起作用
- r - 重复序列 R
- c - 在 C 中使用 str_tok 嵌套拆分
- bootstrap-4 - 多个模态在一个 div 下覆盖两个模态
- c# - 多个应用程序的运行问题 - System.InvalidOperationException
- javascript - Puppeteer:如何监听 http 响应,直到找到正确的响应?
- c# - 如果我使用对象的属性作为内存缓存中的键,该对象是否仍会被垃圾回收?
- cassandra - 当一个节点关闭时,Cassandra 中的超时问题