1
我有一個包含5個查詢集的腳本。我想執行該腳本並將輸出寫入文件。我應該從配置單元cli給出什麼命令。 感謝將腳本的輸出寫入配置單元中的文件
我有一個包含5個查詢集的腳本。我想執行該腳本並將輸出寫入文件。我應該從配置單元cli給出什麼命令。 感謝將腳本的輸出寫入配置單元中的文件
樣本查詢文件(3個查詢):
ramisetty @嚮往:〜/ my_tmp $ 貓queries.q
show databases; --query1
use my_db; --query2
INSERT OVERWRITE LOCAL DIRECTORY './outputLocalDir' --query3
select * from students where branch = "ECE"; --query3
運行HIVE:
ramisetty @ aspire:〜/ my_tmp $ 配置單元
hive(默認)>source ./queries.q;
--output of Q1 on console-----
Time taken: 7.689 seconds
--output of Q2 on console -----
Time taken: 1.689 seconds
____________________________________________________________
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_201401251835_0004, Tracking URL = http://localhost:50030/jobdetails.jsp?jobid=job_201401251835_0004
Kill Command = /home/ramisetty/VJDATA/hadoop-1.0.4/libexec/../bin/hadoop job -kill job_201401251835_0004
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
2014-01-25 19:06:56,689 Stage-1 map = 0%, reduce = 0%
2014-01-25 19:07:05,868 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 2.07 sec
2014-01-25 19:07:14,047 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 2.07 sec
2014-01-25 19:07:15,059 Stage-1 map = 100%, reduce = 100%, Cumulative CPU 2.07 sec
MapReduce Total cumulative CPU time: 2 seconds 70 msec
Ended Job = job_201401251835_0004
**Copying data to local directory outputLocalDir
Copying data to local directory outputLocalDir**
2 Rows loaded to outputLocalDir
MapReduce Jobs Launched:
Job 0: Map: 1 Cumulative CPU: 2.07 sec HDFS Read: 525 HDFS Write: 66 SUCCESS
Total MapReduce CPU Time Spent: 2 seconds 70 msec
OK
firstname secondname dob score branch
Time taken: 32.44 seconds
輸出文件:
貓./outputLocalDir/000000_0
使用INSERT從以前的帖子覆蓋最後查詢之前本地目錄 「的localPath」 .. –
,我可以理解你對HIVE是新手,但是我的建議是從書本(某些編程配置單元)或網頁鏈接中瞭解它,嘗試一些東西,做研發,如果不是則提出請求。 –