摘要: 阅读全文
posted @ 2020-04-10 15:21 singsong~ 阅读(121) 评论(0) 推荐(0) 编辑
摘要: select distinct trim(user_id),create_time from ods_logs_to_hive_orc.ecd_app_main_1; 多字段去重,与单字段去重一样,在后面追加就行。 distinct user_id,create_time sql语法中直接去除两头空 阅读全文
posted @ 2020-04-08 18:05 singsong~ 阅读(1634) 评论(0) 推荐(0) 编辑
摘要: 存储过程代码: CREATE OR REPLACE PROCEDURE dm_rpt.rpt_consultation_community (tt1 in timestamp) /* * 作者:sunsong * 时间:2020-04-02 * 数据来源:ods_evonesns_orc.sgcc_ 阅读全文
posted @ 2020-04-02 17:59 singsong~ 阅读(612) 评论(0) 推荐(0) 编辑
摘要: 通过 88.88.20.15 的 3300 端口访问 80.80.99.3 的 3306 端口,在 88.88.20.15 上设置: sysctl -w net.ipv4.ip_forward=1 iptables -t nat -A PREROUTING -p tcp --dport 3300 - 阅读全文
posted @ 2020-04-02 17:43 singsong~ 阅读(580) 评论(0) 推荐(0) 编辑
摘要: #判断json中是否有值这个key,有就返回value。没有就返回NULL。 #传入两个参数,$1是key名,$2是整个一行json。 fun_col(){ echo $2 > col1 col=`cat col1|grep $1 |wc -l` if [ $col != 0 ];then valu 阅读全文
posted @ 2020-03-21 02:55 singsong~ 阅读(340) 评论(0) 推荐(0) 编辑
摘要: hive导出一份.csv格式的文件导linux没有问题,但是拿取导windows打开就乱码了。 乱码肯定是编码的问题, 原因:linux文件是UTF8的,百度才知道,windows下打开 csv 是 GBK 格式的。 linux下shell命令 #cp一份UTF-8的file.csv改名为 GBK格 阅读全文
posted @ 2019-12-28 12:47 singsong~ 阅读(1176) 评论(0) 推荐(0) 编辑
摘要: 1.用insert,写到hdfs目录下,但是目录好像要由hive用户创建才可以,否则会报错 INSERT OVERWRITE DIRECTORY '/tmp/test1029_tmp' ROW FORMAT DELIMITED FIELDS TERMINATED by ',' select * fr 阅读全文
posted @ 2019-12-27 15:29 singsong~ 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 1、count distinct 优化 --优化前 select count(distinct id )from tablename --优化后 select count(1) from (select distinct id from tablename)tmp; select count(1) 阅读全文
posted @ 2019-12-24 18:14 singsong~ 阅读(517) 评论(0) 推荐(0) 编辑
摘要: 报错原因:直接能看出来是需要配置ecure-file-priv参数。 2019-12-13 1.参数值对应限制。 mysql>SHOW VARIABLES LIKE "secure_file_priv"; secure_file_prive=null -- 限制mysqld 不允许导入导出 secu 阅读全文
posted @ 2019-12-13 19:02 singsong~ 阅读(2711) 评论(1) 推荐(1) 编辑
摘要: linux移动当前目录下的所有目录到其他目录 #/mnt/disk1是最后被移动到的目录ls -d ./*/ |xargs -I {} mv {} /mnt/disk1/ ./*/ 表示的是查看当前目录所有目录。如果选择其他目录,自己换其他目录。eg: /mnt/disk2/*/ 阅读全文
posted @ 2019-12-12 22:39 singsong~ 阅读(1061) 评论(0) 推荐(0) 编辑