hive 使用相关问题

来源:互联网 发布:php最简单代码 编辑:程序博客网 时间:2024/06/07 22:46

hive中字符串转换成整数  可以用round(xxx) 或者cast(xx as bigint)



上面两种方法都可以!




linux 可以fc在命令行下编辑较长的命令行


hive 调用python脚本


test.py根据路径文件名获得文件名(比如/dir1/dir2/dir3/dir4/xxxx.txt  得到 xxxx.txt) 

#!/user/bin/python
import sys
for line in sys.stdin:
    print "%s"%(line.split("/")[-1].replace(" ","").replace("\n","").repalce("\r",""))


在hql是

add file test.py; select transform(path) using 'python test.py' as (path_1 string ) from tb1;


collet_set()可以用在group by的时候来聚合对应的字符串



原创粉丝点击