摘要: show databases; show tables; 系统自带的函数 1)查看系统自带的函数 hive> show functions; 2)显示自带的函数的用法 hive> desc function upper; 3)详细显示自带的函数的用法 hive> desc function exte 阅读全文
posted @ 2021-08-19 12:29 star521 阅读(2740) 评论(1) 推荐(0) 编辑
摘要: spark下 [root@s101 /soft/spark/bin]#./beeline Beeline version 1.2.1.spark2 by Apache Hive beeline> !connect jdbc:hive2://s101:10000/mydb 0: jdbc:hive2: 阅读全文
posted @ 2021-08-19 10:42 star521 阅读(153) 评论(0) 推荐(0) 编辑
摘要: hive--lead()上浮、lag()下沉--求同比 select occur_period ,occur_period_year ,occur_period_month ,org_name ,people_num ,people_num_2 -- (今年这个月人数 - 去年这个月人数)/去年这个 阅读全文
posted @ 2021-08-19 10:24 star521 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 修改表的文件存储格式组织方式: ALTER TABLE table_name SET FILEFORMAT file_format alter table table_name set fileformat rcfile ALTER TABLE table_name CLUSTERED BY (co 阅读全文
posted @ 2021-08-19 10:23 star521 阅读(1010) 评论(0) 推荐(0) 编辑
摘要: 4 主意:collect_set 只能返回不重复的集合 若要返回带重复的要用collect_list 组内拼接排序 select occur_period , sort_array(collect_list(num_jdz_2)) from qhtest.num_zws_update_test gr 阅读全文
posted @ 2021-08-19 10:20 star521 阅读(1629) 评论(0) 推荐(0) 编辑
摘要: hive递增 insert into table user_tables select ( concat ('sz000',row_number() over() ) ) 左填充 lpad() 右填充 rpad() 阅读全文
posted @ 2021-08-19 10:18 star521 阅读(126) 评论(0) 推荐(0) 编辑
摘要: select occur_period ,arr_1 ,case when size(arr_1)%2=1 then arr_1[cast((size(arr_1)-1)/2 as int )] else (arr_1[cast(size(arr_1)/2 as int) ]+arr_1[cast( 阅读全文
posted @ 2021-08-19 10:17 star521 阅读(509) 评论(0) 推荐(0) 编辑
摘要: hive 里的向上取整、向下取整、四舍五入取整的实例.以及精确保留小数位数。 【四舍五入取整截取】 select round(54.56,0) round至少保留一位小数。 55.0 【向下取整截取】 SELECT FLOOR(54.56) 54 【向上取整截取】 SELECT CEILING(13 阅读全文
posted @ 2021-08-19 10:11 star521 阅读(2775) 评论(0) 推荐(0) 编辑
摘要: 选择tableName表中除了name、id、pwd之外的所有字段: set hive.support.quoted.identifiers=None; select `(name|id|pwd)?+.+` from tableName; 阅读全文
posted @ 2021-08-19 10:10 star521 阅读(114) 评论(0) 推荐(0) 编辑