hive中有哪些基础执行语句


小编给大家分享一下hive中有哪些基础执行语句,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!hive是一种基于Hadoop的数据仓库的处理工具,目前只支持简单的类似传统关系型数据库的SQL查询,修改操作功能,他可以直接将SQL转化为Ma开发云主机域名pReduce程序,开发人员不必一定要学会写MR程序,提高了开发效率。例子:基于mysql存储的hive环境,hive元数据(hive相关表,表的各个字段属性等信息)存放在mysql数据库中,mysql数据存放在hdfs默认是/user/hive/warehouse/hive.db中mysql作为元数据存储 数据库(hive)结构目录创建表hive> create table test (id int, name string);引入分区的概念,因为hive 中的select 一般会扫描整个表,这样会浪费很多时间,所以引入分区的概念hive> create table test2 (id int, name string) partitioned by (ds string);浏览表hive>show tables;引入正则表达式 类似like的功能hive>show tables ‘.*t’查看数据结构hive> DESCRIBE test;或desc test;修改或删除表hive>alter table test rename to test3;hive>alter table add columns (new_column type comment ‘注释’)1、倒入数据local 表示执行本地,如果去掉默认是取hdfs上的文件,overwrite表示导入数据覆盖,如果去掉表示append2、执行查询select * from test2 where test2.ds=’2014-08-26’3、值得注意的是 select count(*) from test 与我们平时关系型数据库记录查询操作不同,他执行的是一个mrhive> select count(*) from test2;
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
set hive.exec.reducers.bytes.per.reducer=
In order to limit the maximum number of reducers:
set hive.exec.reducers.max=
In order to set a constant number of reducers:
set mapred.reduce.tasks=
Starting Job = job_1411720827309_0004, Tracking URL = http://master:8031/proxy/application_1411720827309_0004/
Kill Command = /usr/local/cloud/hadoop/bin/hadoop job -kill job_1411720827309_0004
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 1
Stage-1 map = 0%, reduce = 0%
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.93 sec
Stage-1 map = 100%, reduce = 100%, Cumulative CPU 2.3 sec
Stage-1 map = 100%, reduce = 100%, Cumulative CPU 2.3 sec
MapReduce Total cumulative CPU time: 2 seconds 300 msec
Ended Job = job_1411720827309_0004
MapReduce Jobs Launched:
Job 0: Map: 1 Reduce: 1 Cumulative CPU: 2.3 sec HDFS Read: 245 HDFS Write: 2 SUCCESS
Total MapReduce CPU Time Spent: 2 seconds 300 msec
OK
3
Time taken: 27.508 seconds, Fetched: 1 row(s)
看完了这篇文章,相信你对“hive中有哪些基础执行语句”有了一定的了解,如果想了解更多相关知识,欢迎关注开发云行业资讯频道,感谢各位的阅读!

相关推荐: 虚拟主机要多少钱

虚拟主机要多少钱?开发云主机域名很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。首先需要知道,任何主机产品的价格都不能离开配置或性能泛泛而谈。我们在选择虚拟主机的时候会发现空间大小、月…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 05/30 13:45
下一篇 05/30 13:45

相关推荐