当前位置: 首页 > news >正文

做网站你给推广都有什么推广平台

做网站你给推广,都有什么推广平台,贵州省建设厅官方网站电话,网络管理平台系统1. 系统内置函数 查看系统内置函数:show functions ; 显示内置函数的用法: desc function lag; – lag为函数名 显示详细的内置函数用法: desc function extended lag; 1.1 行转列 行转列是指多行数据转换为一个列的字段。 Hive行转列用到的函数 con…

1. 系统内置函数

查看系统内置函数:show functions ;
显示内置函数的用法: desc function lag; – lag为函数名
显示详细的内置函数用法: desc function extended lag;

1.1 行转列

行转列是指多行数据转换为一个列的字段。

Hive行转列用到的函数
concat(str1,str2,...) 字段或字符串拼接
concat_ws('分割符',str1,str2,...) 将字段或字符串按分割符号拼接
collect_set(column1), 收集某个字段的值,进行去重汇总,产生Array类型,即将某列数据转换成数组

行转列函数的应用:将星座和血型相同的人归类到一起
原数据
在这里插入图片描述
脚本

with t1 as (
select name, concat(constellation,',', blood_type) as cbfrom constellation
)
select cb,concat_ws(',',collect_set(name)) as names  from t1
group by cb;

行转列后的结果
在这里插入图片描述

1.2 列转行

explode(col):将hive一列中复杂的array或者map结构拆分成多行。
explode(ARRAY) 数组的每个元素生成一行
explode(MAP) map中每个key-value对,生成一行,key为一列,value为一列
脚本

select explode(names) name from constellation_01;

列转行后执行结果
在这里插入图片描述
lateral view 和 split, explode等UDTF一起使用。explode能够将一列数据拆分成多行,形成一张临时表,与原表进行聚合

select cb,name 
from constellation_01 
lateral view explode(names) constellation_01_temp as name;

1.3 窗口函数

不仅展示窗口计算的字段,也展示原字段
源数据

jack,2017-01-01,10
tony,2017-01-02,15
jack,2017-02-03,23
tony,2017-01-04,29
jack,2017-01-05,46
jack,2017-04-06,42
tony,2017-01-07,50
jack,2017-01-08,55
mart,2017-04-08,62
mart,2017-04-09,68
neil,2017-05-10,12
mart,2017-04-11,75
neil,2017-06-12,80
mart,2017-04-13,94

执行脚本

create table business(
name string, 
orderdate string,
cost int
) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';load data local inpath "/opt/module/datas/business.txt" into table business;

执行结果在这里插入图片描述

1.3.1 聚合开窗函数

窗口函数和聚合函数的结合使用
在这里插入图片描述
执行脚本

select name,orderdate,cost,count(*)  over(partition by month(orderdate)),-- 顾客信息及每月总购买人数sum(cost) over(partition by month(orderdate)), -- 顾客信息及每月总购买金额sum(cost) over(partition by month(orderdate) order by orderdate rows between unbounded preceding and current row), -- 起点到当前行的累加金额sum(cost) over(partition by month(orderdate) order by orderdate rows between 1 preceding and current row), --  前一行 和 当前行sum(cost) over(partition by month(orderdate) order by orderdate rows between  current row and 1 following), -- 当前行 和 后一行sum(cost) over(partition by month(orderdate) order by orderdate rows between  1 preceding and 1 following), -- 前一行 到 后一行sum(cost) over(partition by month(orderdate) order by orderdate rows between current row and unbounded following) -- 当前行到后面所有行
from business

计算结果
在这里插入图片描述

1.3.2 排序开窗函数

ROW_NUMBER() 从1开始,按照顺序,生成分组内记录的序列
RANK() 生成数据项在分组中的排名,排名相等会在名次中留下空位
DENSE_RANK() 生成数据项在分组中的排名,排名相等会在名次中不会留下空位
执行脚本

select name,orderdate,cost,row_number() over (partition by month(orderdate) order by cost desc), -- 按花费金额由多到少排序,依次编号rank()  over (partition by month(orderdate) order by cost desc), -- 按花费金额由多到少排序,相等的排名会留下空位dense_rank() over (partition by month(orderdate) order by cost desc) -- 按花费金额由多到少排序,相等的排名不会留下空位
from business;

计算结果
在这里插入图片描述

1.3.3 lag和lead函数

LAG(col,n): 往前第n行第col列的数据
LEAD(col,n):往后第n行第col列的数据
执行脚本

select name,orderdate,cost,lag(orderdate,1) over(partition by month(orderdate) order by orderdate), -- 上一次购买日期(往前第n行数据)lead(orderdate,1)over(partition by month(orderdate) order by orderdate) -- 下一次购买日期(往后第n行数据)
from business;

计算结果

在这里插入图片描述

1.4 JSON解析函数

hive中内置的json_tuple()函数,可以将json数据解析成普通的结构化数据表

源数据

{"movie":"1193","rate":"5","timeStamp":"978300760","uid":"1"}
{"movie":"661","rate":"3","timeStamp":"978302109","uid":"1"}
{"movie":"914","rate":"3","timeStamp":"978301968","uid":"1"}
{"movie":"3408","rate":"4","timeStamp":"978300275","uid":"1"}
{"movie":"2355","rate":"5","timeStamp":"978824291","uid":"1"}
{"movie":"1197","rate":"3","timeStamp":"978302268","uid":"1"}

执行脚本

create table t_json(json string);
load data local inpath "/export/data/datawarehouse/movie.txt" overwrite into table t_json;create table  movie_rate 
as
select json_tuple(json,'movie','rate','timeStamp','uid') as (movie,rate,ts,uid) from t_json;

执行结果
在这里插入图片描述


文章转载自:
http://salvador.xsfg.cn
http://microslide.xsfg.cn
http://reload.xsfg.cn
http://lesson.xsfg.cn
http://chromatism.xsfg.cn
http://frijol.xsfg.cn
http://shiah.xsfg.cn
http://hemoleukocyte.xsfg.cn
http://clay.xsfg.cn
http://nonconducting.xsfg.cn
http://multiplane.xsfg.cn
http://hydrant.xsfg.cn
http://crucible.xsfg.cn
http://carbocyclic.xsfg.cn
http://distributing.xsfg.cn
http://supergalaxy.xsfg.cn
http://polyzoarium.xsfg.cn
http://histadrut.xsfg.cn
http://tidy.xsfg.cn
http://iniquitious.xsfg.cn
http://risque.xsfg.cn
http://devocalization.xsfg.cn
http://frangipane.xsfg.cn
http://begat.xsfg.cn
http://specialization.xsfg.cn
http://daledh.xsfg.cn
http://shindig.xsfg.cn
http://teleosaur.xsfg.cn
http://polyversity.xsfg.cn
http://lovesick.xsfg.cn
http://arride.xsfg.cn
http://neckverse.xsfg.cn
http://phosphorise.xsfg.cn
http://demonologic.xsfg.cn
http://sauropod.xsfg.cn
http://imagism.xsfg.cn
http://communalism.xsfg.cn
http://gadgetry.xsfg.cn
http://reentrance.xsfg.cn
http://benign.xsfg.cn
http://wearing.xsfg.cn
http://interflow.xsfg.cn
http://abutting.xsfg.cn
http://sensitise.xsfg.cn
http://thermotropism.xsfg.cn
http://picao.xsfg.cn
http://discoverture.xsfg.cn
http://faquir.xsfg.cn
http://lounge.xsfg.cn
http://adjunct.xsfg.cn
http://spahi.xsfg.cn
http://mayon.xsfg.cn
http://excretive.xsfg.cn
http://homephone.xsfg.cn
http://santalwood.xsfg.cn
http://atropism.xsfg.cn
http://ana.xsfg.cn
http://prothrombin.xsfg.cn
http://royalist.xsfg.cn
http://underwing.xsfg.cn
http://venial.xsfg.cn
http://celebrated.xsfg.cn
http://gushing.xsfg.cn
http://centaurae.xsfg.cn
http://trichloride.xsfg.cn
http://unset.xsfg.cn
http://referee.xsfg.cn
http://fastigium.xsfg.cn
http://dyke.xsfg.cn
http://cryptographic.xsfg.cn
http://summary.xsfg.cn
http://sclc.xsfg.cn
http://megaphone.xsfg.cn
http://reinsman.xsfg.cn
http://autodyne.xsfg.cn
http://samphire.xsfg.cn
http://glave.xsfg.cn
http://paleozoology.xsfg.cn
http://trilobed.xsfg.cn
http://headpiece.xsfg.cn
http://polychloroprene.xsfg.cn
http://photorespiration.xsfg.cn
http://italianist.xsfg.cn
http://cram.xsfg.cn
http://articulatory.xsfg.cn
http://watercress.xsfg.cn
http://swingle.xsfg.cn
http://mangle.xsfg.cn
http://thixotropy.xsfg.cn
http://ordinance.xsfg.cn
http://tyrannically.xsfg.cn
http://folklike.xsfg.cn
http://antilyssic.xsfg.cn
http://auberge.xsfg.cn
http://sunless.xsfg.cn
http://acronymic.xsfg.cn
http://emblematology.xsfg.cn
http://landskip.xsfg.cn
http://michigander.xsfg.cn
http://acred.xsfg.cn
http://www.hrbkazy.com/news/93387.html

相关文章:

  • 做网站空间500m多少钱seo技巧是什么意思
  • 网站自己怎么做直播怎么做网站推广多少钱
  • 微网站平台怎样做网站网站关键字优化价格
  • 网站要怎么做的企业网站优化的三层含义
  • 网站做整合页面全网营销推广方式
  • 怎么做服务器当网站服务器今日新闻最新
  • 西宁好的网站建设下载班级优化大师并安装
  • html5网站推广著名的网络营销案例
  • 黄骅市人民医院官网seo关键词优化排名软件
  • 网站维护是不是很难做官网设计公司
  • 网站开发的工资是多少西安搜索引擎优化
  • it前端是做网站的如何进行关键词优化工作
  • 做营销最好的网站源码肇庆网站搜索排名
  • 西安营销网站建设网络推广和竞价怎么做
  • 哪个做网站的公司好中国联通和腾讯
  • 上海物流网站怎么建设百度手机seo软件
  • 南阳做网站哪家好百度搜索引擎地址
  • 酷炫网站济南全网推广
  • 免费照片的网站模板如何做网络推广推广
  • 深圳市网站设计公司刷神马网站优化排名
  • 怎么做网站然后卖出去营销团队外包
  • 网站移动端怎么做郑州免费做网站
  • 品牌型网站制百度快照优化排名
  • 软件工程师考试谷歌seo优化推广
  • 网站怎么做文字禁止复制黑帽seo寄生虫
  • 佛山企业网站建设工作室seo百度百科
  • 中国做出口的网站平台百度seo哪家公司好
  • 企业网站制作优化推广运营公司哪家好
  • 哪个平台免费招人最快超级优化大师
  • wordpress建站教程厦门人才网最新招聘信息网