
hive
lcl_bigdata
这个作者很懒,什么都没留下…
展开
-
java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from
java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. ORC split generation failed with exception: java.lang.ArrayIndexOutOfBoundsException: 2这个错误,在网上查了很多,都不能解决。.原创 2022-04-18 15:40:52 · 6040 阅读 · 0 评论 -
Hive count 计数时统计null值
Hive count 函数的大坑!select count(distinct member) from student t如果member是string类型的,count计数的时候会吧null值单独计数为1,所有的分组统计都会这样计数,数量莫名的多出好多表中member字段是string类型,空值是NULL,用isnull可以查出来,用=‘null’查不出来的那种。...原创 2022-04-14 17:52:27 · 4903 阅读 · 0 评论 -
Hive regexp_extract |或 误区
select url,regexp_extract(k.url,'(.*?)(/$|[^/]$)',1)url_new from table_2022 k错误写法:select url,regexp_extract(k.url,'((.*?)/$)|((.*?)[^/]$)',1)url_new from table_2022 k注意:hiveregexp_extract(string subject,string pattern,int index)方法中,index是以小括号为标准...原创 2022-02-18 13:51:03 · 1231 阅读 · 0 评论 -
hivesink 文档翻译
Name Default Description channel – type – The component type name, needs to behive hive.metastore – Hive metastore URI (eg thrift://a.b.com:9083 ) hive.database – Hive database name hive.table – Hive table n..翻译 2021-05-29 18:05:31 · 257 阅读 · 0 评论 -
hive锁 导致 hive select、alter、sqoop表异常
环境:CDH6.2.1,Java8HDFS 3.0.0+cdh6.2.1 Hive 2.1.1+cdh6.2.1 ZooKeeper 3.4.5+cdh6.2.1 Sqoop 1.4.7+cdh6.2.1 Flume NG 1.9.0+cdh6.2.1 问题:假期服务器突然断电,导致正在查询的hive进程异常,重启系统之后,发现hive表不能执行,select、alter都不行,不过是部分表这样。解决:查看日志并在网上查询后,发现是hive锁的问题,原创 2021-04-12 10:53:47 · 328 阅读 · 0 评论 -
hive load data inpath ‘‘ overwrite into 坑
load data inpath 'dataDir/dim_url.csv' overwrite into table dim_url partition(day='2021-03')注意:1,以前都是加载本地数据,写法:load data local inpath '' ...2,如果加载hdfs上的数据,要去掉local上传hdfs:hdfs dfs -put /dataDir/dim_urlAnalysisType.csv /user/root/dataDir 报错: ..原创 2021-03-26 11:38:26 · 2742 阅读 · 0 评论 -
hive 日期函数 官网摘录、整理
日期功能 Hive支持以下内置日期功能: 返回类型 姓名(签名) 描述 string from_unixtime(bigint unixtime[, string format]) 将unix纪元(1970-01-01 00:00:00 UTC)的秒数转换为一个字符串,该字符...翻译 2020-12-31 15:02:37 · 414 阅读 · 0 评论 -
hive建表语句comment 中文描述乱码
使用Hive创建有中文注释的表时,使用以下建表语句: create table if not exists dwd_user ( cookie string COMMENT 'cookie', country string COMMENT '国家', province string COMMENT '省', city string COMMENT '城市' ) COMMENT '埋点中用户信息筛选' partitioned by (everyday strin.原创 2020-12-29 17:04:05 · 4311 阅读 · 0 评论 -
flume读取json格式的log文件写入hive表,趟坑记录
flume读取log日志文件,写hive表注意:hive创建桶表;flume读取文件,按行读取,默认行最大值为2048个长度,过长会截取。如果不是桶表:异常报错如下Unexpected end-of-input in VALUE_STRING由于log日志每条记录是以json形式存储,然后Agent.sink.hive.serializer = JSON解析json,写入hive表。最开始找到的报错信息是json解析异常:[DEBUG - org....原创 2020-11-03 17:16:33 · 1823 阅读 · 0 评论 -
hive 桶表 插入数据方式 insert into overwrite
因为数据异常,需要在hive桶表中插入历史分区数据,一开始的SQL:insert overwrite table桶表partition(partition='2020-10-30')select * from分区表twhere t.partition='2020-10-30'报错:org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticExce...原创 2020-11-01 14:56:50 · 2067 阅读 · 0 评论 -
hive 语句整理
hive复制表结构 CREATE TABLE new_table LIKE old_table;原创 2020-09-22 17:31:39 · 129 阅读 · 0 评论 -
shell常用小命令整理
if判断 if [ ! -n "$1" ]; then everyday1=`date '+%Y-%m-%d'`else everyday1=$1fi exp1: 如果a>b且aif (( a > b )) && (( a < c ))或者if [[ $a > $b ]] && [[ $a < $c ]]或者if [ $a -gt $b -a $a -lt $c ]ex...原创 2020-08-21 09:53:53 · 185 阅读 · 0 评论 -
hive的case when then和cast
记录一个因为本人弱智脑子不清醒导致搞了很长时间的bug:写hivesql的时候,把cast写成了case,还神奇的一直没有发现,在积极百度查报错原因╮(╯▽╰)╭这里记录下两个方法的用法,来涨涨记性!cast 用法 CAST(<timestamp/date> AS <varchar/char/string> [FORMAT <template>])CAST(<varchar/char/string> AS <tim.原创 2020-08-13 14:35:25 · 584 阅读 · 0 评论 -
hive官网函数-说明文档(原文)
Built-in OperatorsOperators Precedences Example Operators Description A[B] , A.identifier bracket_op([]), dot(.) element selector, dot -A unary(+), unary(-), unary(~) unary prefix operato转载 2020-06-19 16:51:23 · 3875 阅读 · 0 评论 -
flume读取kafka写入hive异常解决-Unable to deliver event. Exception follows.
用flume访问kafka,写入hive数据库时,启动命令:bin/flume-ng agent -n agent -c conf -f conf/flume.properties -Dflume.root.logger=DEBUG,console配置文件是安装flume官方文档配置的,很全,地址:http://flume.apache.org/FlumeUserGuide.html#kafka-sink启动flume之后,报错:ERROR flume.SinkRunner: Unable t原创 2020-05-18 15:18:44 · 2600 阅读 · 0 评论 -
hive官网函数-中文说明文档
关系运算符以下运算符比较传递的操作数,并根据操作数之间的比较是否成立来生成TRUE或FALSE值。 操作员 操作数类型 描述 A = B 所有原始类型 如果表达式A等于表达式B,则为TRUE,否则为FALSE。 A == B 所有原始类型 =运算符的同义词。 A <=> B转载 2020-06-11 15:36:16 · 13762 阅读 · 1 评论 -
hive 函数总结--更新中
row_number() over 语法:ROW_NUMBER() OVER(PARTITION BY COLUMNORDER BY COLUMN) row_number() OVER (PARTITION BYCOL1ORDERBYCOL2)表示根据COL1分组,在分组内部根据COL2排序,而此函数计算的值就表示每组内部排序后的顺序编号(该编号在组内是连续并且唯一的)。 分组统计排序: ROW_NUMBER() OVER (PARTITION BY video_...原创 2020-06-11 15:14:41 · 293 阅读 · 0 评论