Hive视图<转>
来源:互联网 发布:c语言中怎么开多次根号 编辑:程序博客网 时间:2024/05/20 02:25
Hive 0.6版本及以上支持视图
Hive View具有以下特点:
1. View是逻辑存在,Hive暂不支持物化视图(1.0.3)
2. View只读,不支持LOAD/INSERT/ALTER。需要改变View定义,可以是用Alter View
3. View内可能包含ORDER BY/LIMIT语句,假如一个针对view的查询也包含这些语句, 则view中的语句优先级高。例如,定义view数据为limit 10, 针对view的查询limit 20,则最多返回10条数据。
4. Hive支持迭代视图
创建View
删除view
修改view
Hive View具有以下特点:
1. View是逻辑存在,Hive暂不支持物化视图(1.0.3)
2. View只读,不支持LOAD/INSERT/ALTER。需要改变View定义,可以是用Alter View
3. View内可能包含ORDER BY/LIMIT语句,假如一个针对view的查询也包含这些语句, 则view中的语句优先级高。例如,定义view数据为limit 10, 针对view的查询limit 20,则最多返回10条数据。
4. Hive支持迭代视图
创建View
- CREATE VIEW [IF NOT EXISTS] view_name [(column_name [COMMENT column_comment], ...) ]
- [COMMENT view_comment]
- [TBLPROPERTIES (property_name = property_value, ...)]
- AS SELECT ...
- DROP VIEW [IF EXISTS] view_name
- ALTER VIEW view_name SET TBLPROPERTIES table_properties
- table_properties:
- : (property_name = property_value, property_name = property_value, ...)
实例:
- hive> desc student;
- OK
- id int
- name string
- academy string
- class string
- Time taken: 0.146 seconds
- hive> create view student_view (id, name_length) as select id, length(name) from student;
- OK
- Time taken: 0.424 seconds
- hive> desc student_view;
- OK
- id int
- name_length int
- Time taken: 0.071 secondshive> select * from student;
- Total MapReduce jobs = 1
- ......
- Total MapReduce CPU Time Spent: 680 msec
- 1 20 computer 034
- 2 21 computer 034
- 3 19 computer 034
- 4 18 computer 034
- 5 22 computer 034
- 6 23 computer 034
- 7 25 computer 034
- 1 20 physics 034
- 2 21 physics 034
- 3 19 physics 034
- 4 18 physics 034
- 5 22 physics 034
- 6 23 physics 034
- 7 25 physics 034Time taken: 0.176 seconds
- hive> select * from student_view;
- Total MapReduce jobs = 1
- ......
- Total MapReduce CPU Time Spent: 680 msec
- OK
- 1 2
- 2 2
- 3 2
- 4 2
- 5 2
- 6 2
- 7 2
- 1 2
- 2 2
- 3 2
- 4 2
- 5 2
- 6 2
- 7 2
- Time taken: 20.592 secondshive> create view student_view_view(id)
- > as
- > select id from student_view;
- OK
- Time taken: 0.215 seconds
- hive> select * from student_view_view;
- Total MapReduce jobs = 1
- .....
- Total MapReduce CPU Time Spent: 790 msec
- OK
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- <pre></pre><span style="font-family:Arial,Helvetica,sans-serif"><span style="white-space:normal"></span></span>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
- <pre></pre>
0 0
- Hive视图<转>
- hive 视图
- Hive视图
- hive视图
- hive视图
- Hive-视图
- HIVE VIEW 视图
- hive view 视图
- 查找hive中的视图
- hive视图操作
- hive视图和索引
- 查找hive中的视图
- Hive视图和索引
- hive视图——视图的嵌套
- 查找hive创建的视图
- Hive编程指南06---视图
- hive上创建表视图
- Hive编程(七)【HiveQL:视图】
- 3.PHP内核探索:一次请求生命周期
- Power Strings
- 13、UI元素状态伪类选择器
- 【自己动手写神经网络】小白入门连载(三)--神经元的感知
- windows2003域控制器
- Hive视图<转>
- ios制作静态库
- oracle11g dataguard 完全手册
- SharePoint 2013 的硬件和软件要求
- 找不到BufferedImage这个Class的解决方法
- 避免c++程序在windows7或vista下关闭后出现程序兼容性助手
- PCI设备驱动
- 10gen工程师谈MongoDB组合索引的优化
- 使用 HTML5 WebSocket 构建实时 Web 应用