
Hive
lin502
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
备份hive表结构
#!/bin/bash#导出指定数据库下所有的表hive -e “use cd; show tables;” > hive_tables.txtsleep 3#导出指定数据库下所有的表的表结构cat hive_tables.txt |while read eachlinedohive -e “use cd; show create table $eachline” >>hive_tableDDL.txtdone...原创 2022-02-14 11:40:59 · 1236 阅读 · 0 评论 -
记录建hbase对应hive外表坑
建hbase对应hive外表时,把hbase对应字段写成小写时,hive外表用select count(*) fromhive外表名,统计有条数;但是用select * fromhive表时显示0记录;解决问题:建hbase对应hive外表时,把hbase的字段全改为大小,问题解决。...原创 2020-03-31 12:16:13 · 969 阅读 · 0 评论 -
hive 计算年龄
if(datediff(b.admission_time, CONCAT(substring(b.admission_time, 0, 4), substring(b.date_of_birth, 5, 7)))>= 0, (substring(b.admission_time, 0, 4) - substring(b.date_of_bir...原创 2020-03-14 21:28:10 · 3802 阅读 · 0 评论 -
【hive】String to Date 转化大全
Input column name: dt (String).Replace dt with your column name.Input Format Code Output Format ddMMyyyy to_date(from_unixtime(UNIX_TIMESTAMP(dt,’ddMMyyyy’))) yyyy-MM-dd dd-MM-yyyy ...转载 2019-10-30 18:13:55 · 10658 阅读 · 0 评论 -
我司Spark迁移Hive数据到MongoDB生产案例代码
github地址:https://github.com/yanglin502/sparkhivetomg/tree/master/sparkhivetomg文章转自 若泽大数据:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc8cfdff818e686b9&redi...转载 2018-12-28 09:58:18 · 428 阅读 · 0 评论 -
centos安装mysql 在线安装
yum install mysql-server -yservice mysqld startchkconfig mysqld onchkconfig --list mysqldmysql 进入mysql命令行接口mysql -u root;use mysql;select user, host, password from user;CREATE USER 'yishikeji...原创 2018-12-25 16:07:12 · 143 阅读 · 0 评论 -
hive按年月实现动态分区
set hive.exec.dynamic.partition=true;set hive.exec.dynamic.partition.mode=nonstrict创建动态分区表:testtable1CREATE TABLE testtable1( id string, date string)partitioned by (month string)row...原创 2019-07-10 14:28:39 · 3998 阅读 · 0 评论 -
hive计算时间差
参考:https://blog.youkuaiyun.com/sinat_40431164/article/details/808139781、首先String to Date格式yyyy-MM-dd to_date(from_unixtime(UNIX_TIMESTAMP(dt,’yyyy-MM-dd’))) yyyy-MM-dd 2、再次使用函数datediff(...原创 2019-08-05 08:34:49 · 7502 阅读 · 0 评论 -
hive 两列字符串拼接成一列和空字符串处理
使用函数CONCAT(a,b)可以把两列字符串拼接空字符串处理:在mysql中,ifnull函数的用法,其表达式如下IFNULL(expr1,expr2) 如果 expr1 不是 NULL,IFNULL() 返回 expr1,否则它返回 expr2。IFNULL()返回一个数字或字符串值,取决于它被使用的上下文环境。然而,在hive写HQL的时候,ifnull函数...原创 2019-08-12 10:45:24 · 3885 阅读 · 0 评论