摘要: (1) create table 表A as select 字段 from 表B; (2) create table 表A stored as parquet as select 字段 from 表B; 阅读全文
posted @ 2022-11-04 17:56 冉溪 阅读(302) 评论(0) 推荐(0) 编辑
摘要: regexp_extract(filed,('aaa|bbb|ccc|ddd'),0) 从字段filed中提取含有aaa或bbb或ccc或ddd的string信息 阅读全文
posted @ 2022-11-03 18:02 冉溪 阅读(120) 评论(0) 推荐(0) 编辑
摘要: SET hive.execution.engine = tez;SET hive.tez.auto.reducer.parallelism = true;SET hive.auto.convert.join = true;set hive.exec.compress.output = true;se 阅读全文
posted @ 2022-11-03 17:59 冉溪 阅读(79) 评论(0) 推荐(0) 编辑
摘要: select from_unixtime(unix_timestamp(), 'yyyyMMdd') --今天,格式是20220101 阅读全文
posted @ 2022-04-18 17:58 冉溪 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 删除分区: ALTER TABLE table_name DROP PARTITION (partition_name='20220101'); 阅读全文
posted @ 2022-02-25 10:24 冉溪 阅读(37) 评论(0) 推荐(0) 编辑
摘要: (1)concat_ws() select user ,concat_ws(';' , collect_set(cast(amt as string))) as amt from table group by user (2)concat() select concat('202211','04') 阅读全文
posted @ 2022-02-25 10:21 冉溪 阅读(265) 评论(0) 推荐(0) 编辑
摘要: select date_flag,category_flag,field,LAG(filed, 1) OVER (PARTITION BY category_flag ORDER BY date_flag) --同组前一个,LEAD(filed, 1) OVER (PARTITION BY cate 阅读全文
posted @ 2022-02-17 17:48 冉溪 阅读(86) 评论(0) 推荐(0) 编辑
摘要: select year_flag,month_flag,field,SUM(field) OVER (PARTITION BY year_flag ORDER BY month_flag)from table ; 阅读全文
posted @ 2022-02-17 17:41 冉溪 阅读(455) 评论(0) 推荐(0) 编辑
摘要: (1) INSERT INTOINSERT INTO tableVALUES ('aaa' , 111),('bbb' , 222); (2) insert overwrite insert overwrite table table(partition = '202301')select fiel 阅读全文
posted @ 2022-02-17 17:34 冉溪 阅读(472) 评论(0) 推荐(0) 编辑
摘要: 1.随机小数0-1之间 =RAND() 2.随机整数1-100之间 =RANDBETWEEN(1,100) 3.生成一定比例的随机数0或1 =IF(RAND()>=0.8,1,0) 4.生成一定比例的0以及其他N个随机数 =IF(RAND()>0.8,RANDBETWEEN(1,3),0) 5.随机 阅读全文
posted @ 2021-12-15 17:21 冉溪 阅读(509) 评论(0) 推荐(0) 编辑