• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






江枫1

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  hadoop\hive

 
hive 解jason字符串
摘要:json 字符串为: 字段名为: json {"appId":36222,"deviceId":"12536521-7b3d-41f6-9c09-fdb94b1098a6","md":"{\"os\":\"Android\",\"imei\":\"351834334\",\"nt\":\"wifi\ 阅读全文
posted @ 2018-01-03 18:08 江枫1 阅读(412) 评论(0) 推荐(0)
hive 抽样方法
摘要:select * from (select *from advert.dws_advert_order_model_sample_pcvr_v2_diwhere dt>= date_sub('${date}',7) and dt< '${date}'and ((label >=0.5 and ran 阅读全文
posted @ 2017-08-03 10:31 江枫1 阅读(461) 评论(0) 推荐(0)
hive 显示分区
摘要:显示某一张表的分区值 show partitions table_name; 阅读全文
posted @ 2017-02-07 15:11 江枫1 阅读(580) 评论(0) 推荐(0)
hive中分号问题
摘要:分号是sql的结束符,在hql中亦如此,但是hive对分号的识别没有那么智能,如下: select concat(';','aa') from lhc limit 1; FAILED: Parse Error: line 1:13 cannot recognize input near '<EOF> 阅读全文
posted @ 2016-12-14 18:52 江枫1 阅读(1398) 评论(0) 推荐(0)
建分区外表 自动导入数据
摘要:建表后增加分区,数据自动导入 create external table gid_tag_1114 (a1 string ,b1 string,c1 string ) partitioned by (day int) row format delimited fields terminated by 阅读全文
posted @ 2016-12-13 15:02 江枫1 阅读(324) 评论(0) 推荐(0)
hive字符串函数
摘要:https://zhidao.baidu.com/question/136812310131554325.html 阅读全文
posted @ 2016-11-25 16:19 江枫1 阅读(249) 评论(0) 推荐(0)
hive sql split 分隔符
摘要:Hive字符串分割函数 split(str, regex) - Splits str around occurances that match regexTime taken: 0.769 seconds, Fetched: 1 row(s) 返回值为一个数组 a.基本用法: 例1: split(' 阅读全文
posted @ 2016-11-23 21:21 江枫1 阅读(17390) 评论(0) 推荐(0)
hivepython 实现一行转多行
摘要:案例1: ==效果等同于一行转多行 数据表名称:zhangb.gid_tags 数据格式,每行是2个字段,(gid,tags) ,可能有脏数据,分隔符为“\t”, ANDROID-9de77225cadb4319adfc1b1fe51c54f0 h65010000,014200,018100,011 阅读全文
posted @ 2016-11-18 15:44 江枫1 阅读(1758) 评论(0) 推荐(0)
一行转多行 及多行转一行的 hive语句
摘要:注意 :|,; 是特殊符号,要用 "\\|", "\\;"来表示。 一行转多行 usertags 里面有很多项,每项之间以逗号分隔 create table tag_count2 as select tag,count(gid) from ( select gid,tag from (select 阅读全文
posted @ 2016-11-18 13:08 江枫1 阅读(12684) 评论(0) 推荐(0)
hive sql 随机抽样
摘要:create table daizk.IOS_matrix_sex asselect *from zhujx.1029_IOS_features_replce_nullwhere sex = 'M'union allselect *from zhujx.1029_IOS_features_replc 阅读全文
posted @ 2016-10-31 15:18 江枫1 阅读(1135) 评论(0) 推荐(0)
hive sql 效率提升
摘要:转 : http://www.cnblogs.com/xd502djj/p/3799432.html hive的查询注意事项以及优化总结 . Hive是将符合SQL语法的字符串解析生成可以在Hadoop上执行的MapReduce的工具。使用Hive尽量按照分布式计算的一些特点来设计sql,和传统关系 阅读全文
posted @ 2016-10-22 19:24 江枫1 阅读(2264) 评论(0) 推荐(0)
hive 排序 分组计数后排序 几种不同函数的效果
摘要:【转至:http://blackproof.iteye.com/blog/2164260】 总结: 三个分析函数都是按照col1分组内从1开始排序 (假设4个数,第2和第3个数据相同) row_number() 是没有重复值的排序(即使两天记录相等也是不重复的),可以利用它来实现分页 比如:1、2、 阅读全文
posted @ 2016-10-15 17:38 江枫1 阅读(2842) 评论(0) 推荐(0)
hive\hadoop 常用命令
摘要:—1—————— 后台跑程序语句: 在shell下输入: nohup hive -f aaa.sql >bbb.log 2>&1 & 然后把sql 的脚本导入服务器上:Transfer—Zmodem upload List 相关命令:jobs:可以看到运行的任务,;cat bbb.log 可以看到这 阅读全文
posted @ 2016-10-14 20:38 江枫1 阅读(1218) 评论(0) 推荐(0)