
Hive
文章平均质量分 54
young-ming
路漫漫其修远兮 吾将上下而求索
个人QQ:284407890
个人github:https://github.com/xmingyang
展开
-
hive优化要点总结
个人认为总体两种思想:1、让服务器尽可能的多做事情,榨干服务器资源,以最高系统吞吐量为目标再好的硬件没有充分利用起来,都是白扯淡。比如:(1) 启动一次job尽可能的多做事情,一个job能完成的事情,不要两个job来做 通常来说前面的任务启动可以稍带一起做的事情就一起做了,以便后续的多个任务重用,与此紧密相连的是模型设计,好的模型特别重要.(2) 合理设置reduce个数reduce个数过少没有...原创 2013-09-26 22:46:21 · 2398 阅读 · 0 评论 -
Spark/Hive采样
Hive数据块取样hive数据块采样SELECT * FROM T TABLESAMPLE (50 PERCENT);SELECT * FROM T TABLESAMPLE (30M);分桶表取样SELECT *FROM T TABLESAMPLE (BUCKET 1 OUT OF 10 ON rand());SELECT * FROM T TABLESAMPLE(BUCK...原创 2018-08-28 11:18:42 · 1396 阅读 · 0 评论 -
等待hive上游数据公用函数
function wait_table(){ database=$1 table_name=$2 table_partition=$3 if [ $# -ge 4 ] then ((minute=$4*2)) else # 5 hours minute=600 fi set +e for ((i=0;i<=$minute;i=i+1)原创 2017-07-14 10:44:14 · 356 阅读 · 0 评论 -
Hive Runtime Error: Unable to deserialize reduce input key from
hive动态分区set hive.exec.dynamic.partition=true;set hive.exec.dynamic.partition.mode=nonstrict;插入报错:Hive Runtime Error: Unable to deserialize reduce input key from x1x49x0x1x49x0x1x104x116x116x原创 2016-04-16 15:21:50 · 1582 阅读 · 0 评论 -
hive UDAF行列转换
目标实现1 a1 b2 a2 c转换为1 a,b2 a,cpackage com.hive.udf;//用法 select a,concat1(b,',') from concat_test group by a;import org.apache.hadoop.hive.ql.exec.UDAF;import org.apache.hadoop.hive.原创 2015-12-03 15:22:15 · 882 阅读 · 0 评论 -
hive udf使用间隔
计算用户使用app间隔,预先排重排好序得到 cookie 日期 当前日期,倒排序后作为参数传入。里面逻辑根据具体需求再调整。package com.hive.udf;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Calendar;import java.ut原创 2015-12-03 15:17:13 · 756 阅读 · 0 评论 -
hive udf获取当前月最后一天
package com.hive.udf;import org.apache.hadoop.hive.ql.exec.UDF;import java.net.URLDecoder;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Calendar;import ja原创 2015-12-03 15:07:18 · 9539 阅读 · 0 评论 -
hive udf urldecode
package com.hive.udf;import org.apache.hadoop.hive.ql.exec.UDF;import java.net.URLDecoder;public class UDFDecoderUrl extends UDF { private String url = null; private int times = 2;原创 2015-12-03 15:04:12 · 6134 阅读 · 0 评论 -
hive使用orcfile parquet sequencefile
1、orcfile的使用创建orcfile表,不压缩 create table d_op_behavior_host_orc_none(thedate string, id string,原创 2015-11-26 15:01:25 · 5411 阅读 · 0 评论 -
hive join顺序影响的性能一例子
调整前跑完需要两个小时,调整后5分钟跑完调整前HSQL:insert overwrite table dwd.game_cid_new partition(thisdate,ckey)selectb.cookie_key,b.cookie_value,count(*) views,a.thisdate,b.cookie_keyfrom dwd.d_op_behavior_ho原创 2015-09-22 10:42:56 · 3572 阅读 · 0 评论 -
hive行列转换总结
1、单列转换成多行比如:pageid pagedpage1 a,b,c要转换成page1 apage1 bpage1 cselect pageid,p from test lateral view explode(split(paged,',')) adtable as p;通过split拆成多个元素的集合,再通过split打散成多行,lateral原创 2013-10-12 16:22:22 · 6770 阅读 · 0 评论 -
hive transform列转行
hive -e " add file split_sjku_domain.py;select transform(company_name,regexp_replace(corporate_website,'www.','') ) using 'split_sjku_domain.py' as (company_name,domain) from T limit 20"...原创 2019-03-01 16:04:04 · 544 阅读 · 0 评论