hive 中使用shell/python
来源:互联网 发布:数据挖掘常用软件 编辑:程序博客网 时间:2024/06/05 01:51
官方参考
国内参考
使用的技巧:TRANSFORM
在hive中使用shell或python,主要优点是减少用java编写udf的工作。这样就十分方便与字段一些处理。
官方参考对python的说明比较详细,shell较少,先上传一个shell的示例;
SHELL
#!/bin/bash# file name : convertDate.sh# function : convert date to a custom format date,i.e. 2015-12-10 15:23:23 to 2015-12-10 15:23:15, map seconds to 00,15,30,45;while read line; do dt=`echo $line|awk -F'[:]' {s=$3-$3%15;if(s==0)s="00";print $1":"$2":"s}` echo $dtdone
hive shell
hive << EOFadd file convertDate.shfrom( from online_behavior select transform(online_behavior.time) using 'convertDate.sh' as (ntime) where online_behavior.dt='2015-06-22')obinsert overwrite local directory '/home/user/etlProj/flowProj/t1.log'select ntime,count(*) group by ntime;EOF
注意:如果hive是按装在window上,using 之后要加上 cmd cmd.sh
,linux上可以只写cmd.sh
0 0
- hive 中使用shell/python
- #hive#HIVE中使用python实现UDF
- HIVE中使用python实现UDAF
- hive 使用python脚本
- 如何在hive的shell中使用hadoop shell 和linux的命令
- Spark(Hive) SQL中UDF的使用(Python)
- hive中使用lzo
- hive中使用rcfile
- python和hive结合使用
- 使用python客户端访问hive
- 使用shell将hdfs上的数据导入到hive表中
- shell中循环调用hive sql 脚本
- 使用shell脚本执行hive、sqoop命令
- python中调用shell
- python中执行shell
- Hive SHELL
- python 使用shell 命令
- shell export的变量在python中使用
- django 的数据库操作
- 识别单击、双击
- ZOJ 3057 Beans Game (博弈入门)
- css常用技巧
- GIT(分布式管理工具)
- hive 中使用shell/python
- AKKA笔记
- 探索 OpenStack 之:计量模块 Ceilometer 介绍及优化
- 多模板layout
- HDU/HDOJ 1232 超详细题解(并查集入门教程)
- 数独100*100 sudoku 100*100 的第一个结果
- 数据库中的char类型的字段与number,varchar类型字段查询
- alibaba dexposed初步解析
- android webview 自定义404错误页面!