真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

hive中有哪些基礎(chǔ)執(zhí)行語(yǔ)句

小編給大家分享一下hive中有哪些基礎(chǔ)執(zhí)行語(yǔ)句,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!

創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供安達(dá)網(wǎng)站建設(shè)、安達(dá)做網(wǎng)站、安達(dá)網(wǎng)站設(shè)計(jì)、安達(dá)網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、安達(dá)企業(yè)網(wǎng)站模板建站服務(wù),十年安達(dá)做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

hive簡(jiǎn)單概念

hive是一種基于Hadoop的數(shù)據(jù)倉(cāng)庫(kù)的處理工具,目前只支持簡(jiǎn)單的類似傳統(tǒng)關(guān)系型數(shù)據(jù)庫(kù)的SQL查詢,修改操作功能,他可以直接將SQL轉(zhuǎn)化為MapReduce程序,開發(fā)人員不必一定要學(xué)會(huì)寫MR程序,提高了開發(fā)效率。

例子:基于MySQL存儲(chǔ)的hive環(huán)境,hive元數(shù)據(jù)(hive相關(guān)表,表的各個(gè)字段屬性等信息)存放在mysql數(shù)據(jù)庫(kù)中,mysql數(shù)據(jù)存放在hdfs默認(rèn)是/user/hive/warehouse/hive.db中

ddl 語(yǔ)句

mysql作為元數(shù)據(jù)存儲(chǔ) 數(shù)據(jù)庫(kù)(hive)結(jié)構(gòu)目錄

創(chuàng)建表

hive> create table test (id int, name string);

引入分區(qū)的概念,因?yàn)閔ive 中的select 一般會(huì)掃描整個(gè)表,這樣會(huì)浪費(fèi)很多時(shí)間,所以引入分區(qū)的概念

hive> create table test2 (id int, name string) partitioned by (ds string);

瀏覽表

hive>show tables;

引入正則表達(dá)式 類似like的功能

hive>show tables '.*t'

查看數(shù)據(jù)結(jié)構(gòu)

hive> DESCRIBE test;或desc test;

修改或刪除表

hive>alter table test rename to test3;

hive>alter table add columns (new_column type comment '注釋')

hive>drop table test;
DML操作語(yǔ)句

1、倒入數(shù)據(jù)

LOAD DATA LOCAL INPATH '/home/hadoop/test.txt' OVERWRITE INTO TABLE test;

local 表示執(zhí)行本地,如果去掉默認(rèn)是取hdfs上的文件,overwrite表示導(dǎo)入數(shù)據(jù)覆蓋,如果去掉表示append

2、執(zhí)行查詢

select * from test2 where test2.ds='2014-08-26'

3、值得注意的是 select count(*) from test 與我們平時(shí)關(guān)系型數(shù)據(jù)庫(kù)記錄查詢操作不同,他執(zhí)行的是一個(gè)mr

hive> 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)

看完了這篇文章,相信你對(duì)“hive中有哪些基礎(chǔ)執(zhí)行語(yǔ)句”有了一定的了解,如果想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!


新聞名稱:hive中有哪些基礎(chǔ)執(zhí)行語(yǔ)句
文章位置:http://weahome.cn/article/pjsjji.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部