码迷,mamicode.com
首页 > 其他好文 > 详细

【云计算】impala建表,文件关联,查询

时间:2014-10-23 14:23:29      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:io   java   for   sp   文件   on   amp   ad   bs   

[cloudil@hadoop164 caixianfeng]$ hdfs dfs -mkdir -p /csv-pig/tab1 /csv-pig/tab1

tab1.csv:

1,true,123.123,2012-10-24 08:55:00 
2,false,1243.5,2012-10-25 13:40:00
3,false,24453.325,2008-08-22 09:33:21.123
4,false,243423.325,2007-05-12 22:32:21.33454
5,true,243.325,1953-04-22 09:11:33

[cloudil@hadoop164 caixianfeng]$ hdfs dfs -put tab1.csv /csv-pig/tab1

 

DROP TABLE IF EXISTS tab1;

-- The EXTERNAL clause means the data is located outside the central location for Impala data files
-- and is preserved when the associated Impala table is dropped. We expect the data to already
-- exist in the directory specified by the LOCATION clause.
CREATE EXTERNAL TABLE tab1
(
id INT,
col_1 BOOLEAN,
col_2 DOUBLE,
col_3 TIMESTAMP
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,‘
LOCATION ‘/csv-pig/tab1‘;

 

impala-shell -i 172.16.230.152 -f table_setup.sql

 

【云计算】impala建表,文件关联,查询

标签:io   java   for   sp   文件   on   amp   ad   bs   

原文地址:http://www.cnblogs.com/illday/p/4045537.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!