python thrift 进行filter

介于我百度的时候发现文档比较少 就写一下防止忘记

SingleColumnValueFilter(‘<family>‘, ‘<qualifier>‘, <compare operator>, ‘<comparator>‘, <filterIfColumnMissing_boolean>, <latest_version_boolean>)
filterStr = "SingleColumnValueFilter(‘entry‘, ‘num‘, =, ‘substring:25‘, true, false)";

note:
comparator需要加binary, 否则可能会抛错误, 我也想想是为什么rownumber 可以把符合条件的 rownumber 个选出来 而不是选rownumber再进行filter
filter = "SingleColumnValueFilter(‘f1‘, ‘ax‘, =, ‘binary:-1‘, true, false)"s = t.scannerListWithFilter(table = ‘M_SEED_USER‘,filter = filter, numRows=500)


scan = Hbase.TScan()#scan = Hbase.TScan()scan.filterString = filterscan.startRow = startRowscan.stopRow = stopRowscannerId = self.client.scannerOpenWithScan(table, scan, {})

这样就可以把columnfamily为f1的column ax  = -1 的值取出来
 


 

时间: 2025-01-09 08:06:55

python thrift 进行filter的相关文章

Python -- lambda, map, filter

lambda f = lambda x : x * 2 f(5) map list(map(lambda x:x[0].upper()+x[1:].lower(), ['sQd', 'ZORO'])) #传入列表,首字母变大写,其余变小写 filter list(filter(lambda n: n%2 == 1, [1,2,3,4,5])) #保留奇数,舍弃偶数 list(filter(lambda s: s and s.strip(), ['S', '', None, 'b'])) #删除一

Demo of Python &quot;Map Reduce Filter&quot;

Here I share with you a demo for python map, reduce and filter functional programming thatowned by me(Xiaoqiang). I assume there are two DB tables, that `file_logs` and `expanded_attrs` which records more columns to expand table `file_logs`. For demo

Python中map,filter,reduce的应用

事例1: l=[('main', 'router_115.236.xx.xx', [{'abc': 1}, {'dfg': 1}]), ('main', 'router_183.61.xx.xx', [{'abc': 0}, {'dfg': 1}]), ('main', 'router_52.11.xx.xx', [{'abc': 0}, {'dfg': 1}]), ('main', 'router_183.17.xx.xx', [{'abc': 1}, {'dfg': 1}]) ] 检查参数l

python map、filter、reduce

Python has a few functions that are useful for this sort of “functional programming”: map, filter, and reduce. 4 (In Python 3.0, these are moved to the functools module.) The map and filter functions are not really all that useful in current versions

Python中的filter()函数的用法

转载自:脚本之家 Python内建的filter()函数用于过滤序列. 和map()类似,filter()也接收一个函数和一个序列.和map()不同的时,filter()把传入的函数依次作用于每个元素,然后根据返回值是True还是False决定保留还是丢弃该元素. 例如,在一个list中,删掉偶数,只保留奇数,可以这么写: def is_odd(n): return n % 2 == 1 filter(is_odd, [1, 2, 4, 5, 6, 9, 10, 15]) # 结果: [1, 5

Python的lambda, filter, reduce 和 map简介

Lambda 操作 Lambda操作——有些人喜欢,有些人讨厌,还有很多人害怕.当你看完了我们这章的介绍后,我们很自信你会喜欢上它.要不然,你可以去学习Guido van Rossums更喜欢去用的“list comprehensions”(递推式构造列表)了,因为他也不喜欢Lambda, map filter 和reduce. Lambda操作或者lambda函数是一种创建小型匿名函数的方式,即:函数都没有函数名.这些函数都是投掷(throw-away)函数,即:它们只会在我们需要的地方创建,

python之lambda,filter,map,reduce函数

g = lambda x:x+1 看一下执行的结果: g(1) >>>2 g(2) >>>3 当然,你也可以这样使用: lambda x:x+1(1) >>>2 可以这样认为,lambda作为一个表达式,定义了一个匿名函数,上例的代码x为入口参数,x+1为函数体,用函数来表示为: def g(x): return x+1 非常容易理解,在这里lambda简化了函数定义的书写形式.是代码更为简洁,但是使用函数的定义方式更为直观,易理解. Python中,

3.python中map,filter,reduce以及内部实现原理剖析

一.map函数,对任何可迭代序列中的每一个元素应用对应的函数.(不管处理的是什么类型的序列,最后返回的都是列表.) 作用已经在标题中介绍过了,那么先来说说map函数的用法吧. map(处理逻辑可以是函数也可以是lambda表达式,可迭代的序列) 现在有一个列表. l1 = [1,2,3,4,5] 现在需要给这个列表里的每一个元素都+1.(当然,使用for循环可以做到对序列中的每个元素进行处理,但使用map函数会更加方便.) 首先,定义一个逻辑函数,要如何对序列中的每一个元素进行处理. def p

python thrift 服务端与客户端使用

一.简介 thrift是一个软件框架,用来进行可扩展且跨语言的服务的开发.它结合了功能强大的软件堆栈和代码生成引擎,以构建在 C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml 这些编程语言间无缝结合的.高效的服务. 二.安装 1.下载地址 http://www.apache.org/dyn/closer.cgi?path=/thrift