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

怎么用PHP做网站留言板免费域名空间虚拟主机

怎么用PHP做网站留言板,免费域名空间虚拟主机,软装设计师要学什么,重庆市建设工程造价管理协会网站目录 分桶(Bucket) 设定属性 定义分桶 案例 建表语句 表数据 上传到数据 创建分桶语句 加载数据 分桶抽样(Sampling) 随机抽样---整行数据 随机抽样---指定列 随机抽样---百分比 随机抽样---抽取行数 Hive视图&#…

目录

分桶(Bucket)

设定属性

定义分桶

案例

建表语句

表数据

上传到数据

创建分桶语句

加载数据

 分桶抽样(Sampling)

随机抽样---整行数据

随机抽样---指定列

随机抽样---百分比

 随机抽样---抽取行数

Hive视图(View)

视图概述

应用场景

创建视图

查看视图定义

删除视图

更改视图属性

更改视图定义

Hive侧视图(Lateral View)


分桶(Bucket)

分桶对应于HDFS中的文件

  • 更高的查询处理效率
  • 使抽样(sampling)更高效 
  • 一般根据"桶列"的哈希函数将数据进行分桶

设定属性

SET hive.enforce.bucketing = true;

定义分桶

clustered by(employee) into 2 buckets

分桶只有动态分桶

必须使用INSERT方式加载数据

案例

建表语句

create table employee_id
(name         string,employee_id  int,work_place   array<string>,gender_age   struct<gender:string,age:int>,skills_score map<string,int>,depart_title map<string,array<string>>
)row format delimitedfields terminated by '|'collection items terminated by ','map keys terminated by ':'lines terminated by '\n';

表数据

Michael|100|Montreal,Toronto|Male,30|DB:80|Product:DeveloperLead
Will|101|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Steven|102|New York|Female,27|Python:80|Test:Lead,COE:Architect
Lucy|103|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead
Mike|104|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Shelley|105|New York|Female,27|Python:80|Test:Lead,COE:Architect
Luly|106|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead
Lily|107|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Shell|108|New York|Female,27|Python:80|Test:Lead,COE:Architect
Mich|109|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead
Dayong|110|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Sara|111|New York|Female,27|Python:80|Test:Lead,COE:Architect
Roman|112|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead
Christine|113|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Eman|114|New York|Female,27|Python:80|Test:Lead,COE:Architect
Alex|115|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead
Alan|116|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Andy|117|New York|Female,27|Python:80|Test:Lead,COE:Architect
Ryan|118|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead
Rome|119|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Lym|120|New York|Female,27|Python:80|Test:Lead,COE:Architect
Linm|121|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead
Dach|122|Montreal|Male,35|Perl:85|Product:Lead,Test:Lead
Ilon|123|New York|Female,27|Python:80|Test:Lead,COE:Architect
Elaine|124|Vancouver|Female,57|Sales:89,HR:94|Sales:Lead

上传到数据

load data local inpath '/opt/stufile/employee_id.txt' overwrite into table employee_id;

创建分桶语句

create table employee_id_buckets
(name         string,employee_id  int,work_place   array<string>,gender_age   struct<gender:string,age:int>,skills_score map<string,int>,depart_title map<string,array<string>>
) clustered by (employee_id) into 2 bucketsrow format delimitedfields terminated by '|'collection items terminated by ','map keys terminated by ':';

clustered by (employee_id) into 2 buckets 含义是:把employee_id设置两个分桶

加载数据

insert overwrite table employee_id_buckets select * from employee_id;

 分桶抽样(Sampling)

随机抽样---整行数据

select *
from employee_id_buckets tablesample (bucket 1 out of 2 on rand());

随机抽样---指定列

(使用分桶列更高效)

select *
from employee_id_buckets tablesample (bucket 1 out of 2 on employee_id);

随机抽样---百分比

select *
from employee_id_buckets tablesample (10 percent);

 随机抽样---抽取行数

select *
from employee_id_buckets tablesample (10 rows);

Hive视图(View)

视图概述

  • 通过隐藏子查询、连接和函数来简化查询的逻辑结构
  • 只保存定义,不存储数据
  • 如果删除或更改基础表,则查询视图将失败
  • 视图是只读的,不能插入或装载数据

应用场景

  • 将特定的列提供给用户,保护数据隐私
  • 用于查询语句复杂的场景

创建视图

支持 CTE, ORDER BY, LIMIT, JOIN等

create view view_name as select statement;

查看视图定义

show create table view_name;

删除视图

drop view_name;

更改视图属性

alter view view_name set tblproperties ('comment' = 'This is a view');

更改视图定义

alter view view_name as select statement;

Hive侧视图(Lateral View)

与表生成函数结合使用,将函数的输入和输出连接

OUTER关键字:即使output为空也会生成结果

select name, workplace, loc
from employee lateral view outer explode(split(null, ',')) a as loc;

 

支持多层级

select name,wps,gender_age.gender, gender_age.age,skill,score,depart,title
from employeelateral view explode(workplace) work_place as wpslateral view explode(skills_score) sks as skill, scorelateral view explode(depart_title) ga as depart, title;

 

http://www.yayakq.cn/news/304658/

相关文章:

  • 做网站爱域名解析后网站怎么建设
  • 具有设计感的网站做网上推广网站
  • 专做机械类毕业设计的网站c asp.net网站开发书
  • 新东阳建设集团网站网页游戏排行榜对战
  • 网页中网站设计规划流程大连网站平台研发
  • seo做的最好的网站密云网站建设服务
  • 请seo的人帮做网站排名上海网站建设公司网站
  • 郑州做网站公司排名昆明营销型网站制作设计
  • 淮南模板网站建设费用快速收录网
  • 简单的个人网站html石家庄网站seo顾问
  • 最全的提交网站入口大全什么是网络营销的核心竞争力
  • 张家口专业做网站公司黄骅市天气预报
  • asp网站合法iis网站建设中
  • 长沙河东做网站页面设计不满
  • 网站建设潍坊建站宝盒视频
  • 亿诚建设项目管理有限公司网站汽车配件做外贸在哪个网站
  • 邵东做网站泰安做网络推广的
  • 成都建站seo电子商务网站建设投资预算
  • 三层架构做网站还是系统seo关键词搜索和优化
  • 网站首页设计风格有哪些广东省建设厅官方网站多少钱
  • 搜狗网站优化软件wordpress设计漂亮的页面
  • 网站建设全部流程图wordpress 修改链接失效
  • 用vs做网站如何连接数据库网页设计心得体会1500
  • 软件开发外包是什么意思长沙自动seo
  • seo站外推广业务外包如何在手机做网站
  • 高端房产网站建设有域名怎么免费建站
  • 做it人经常逛的网站软件开发大学
  • 推荐几个手机能看的网站jsp网站建设项目实战 pdf
  • 中国建设银行江西分行网站首页东莞手机网站建设多少钱
  • 电脑记事本做复杂网站设置网站404