![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hive
一方诸侯
这个作者很懒,什么都没留下…
展开
-
hive乱码修改mysql元数据字符集
alter database hive character set latin1;#修改表字段注解和表注解alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;alter table TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;#修改分区字段注解alter table PARTITION_KEYS m原创 2021-04-09 17:38:31 · 159 阅读 · 0 评论 -
解决hive表被锁的参数设置
set hive.support.concurrency=false;set hive.txn.manager = org.apache.hadoop.hive.ql.lockmgr.DummyTxnManager;原创 2021-04-08 18:10:40 · 555 阅读 · 0 评论 -
hive将某一列拼接成json数组
刚才是用的collect_list(concat(’{’,concat(’“id_penyelenggara”:’,’“810114”’,’,’), concat('"id_pengguna":','"',a.id_pengguna,'",'), concat('"no_identitas_perwakilan":','"',no_identitas_perwakilan),'"}')) as values但是得到的结果这原创 2021-02-03 17:34:40 · 2169 阅读 · 0 评论 -
mysql中decimal、double和float的进位
mysql数据库的舍入模式,decimal是四舍五入,float是四舍六入五成双四舍,小于等于四舍去,六入,大于等于六则加一五成双,是五的话看前一位是双数还是单数,单则加一,双的则看5后面的大于0则进位,等于0则舍去create table testRound(num1 decimal(10,2),num2 float(10,2),num3 double(10,2));1.小数点后第二位是偶数,第三位小于5sql: INSERT INTO testRound (decimal, floa原创 2021-01-23 17:21:46 · 1115 阅读 · 0 评论 -
hive隐式转化的问题
hive在表关联时尽量避免隐式转化,可以使用cast强转,下面例子中tableA表的order_no是bigint类型,tableB的order_no是string类型selecta.order_no,c.order_no as c_order_no,a.order_no=c.order_nofrom tableA aleft join tableB bon a.order_no=b.order_noleft join(selectt1.order_nofrom tableA t1j原创 2021-01-06 18:21:33 · 354 阅读 · 0 评论 -
hive连续登陆问题
问题描述在数据仓库中存在这样一张表,记录了2019年所有用户在哪天登录了我司的网站或者app。数据如下:表名:test2字段:id string,pday string需求:统计用户在本年中连续登录天数最大是几天?如:用户A在7月1、2、3、4日连续登录了4天;6、7、8日连续3天;11、12连续2天。用户A的当年最大连续登录天数是4天用户B在6月29日,6月30日,7月1日连续登录3天。用户B的当年最大连续登录天数是3天需要的到的结果是这样的:题目刨析此题需要将连续的天数打上相同的标转载 2020-12-24 22:31:07 · 579 阅读 · 0 评论 -
加载udf函数
create function array_us AS ‘udf.HiveUnserializable’ USING JAR ‘hdfs://indiaAWS/user/hive/udf/udf.jar’;原创 2020-12-23 14:25:21 · 298 阅读 · 0 评论 -
大表join小表之mapjoin详解
在Hive调优里面,经常会问到一个很小的表和一个大表进行join,如何优化。 Shuffle 阶段代价非常昂贵,因为它需要排序和合并。减少 Shuffle 和 Reduce 阶段的代价可以提高任务性能。 MapJoin通常用于一个很小的表和一个大表进行join的场景,具体小表有多小,由参数hive.mapjoin.smalltable.filesize来决定,该参数表示小表的总大小,默认值为25000000字节,即25M。 Hive0.7之前,需要使用hint提示 /*+ mapjoin(转载 2020-12-23 09:45:50 · 2483 阅读 · 0 评论 -
hive参数设置
–动态分区set mapreduce.job.queuename=root.risk;set hive.exec.dynamici.partition=true;set hive.exec.dynamic.partition.mode=nonstrict;set hive.exec.max.dynamic.partitions.pernode=100000;set hive.exec.max.dynamic.partitions =100000;set hive.exec.max.create原创 2020-12-11 17:38:09 · 894 阅读 · 1 评论