hive建表并导入csv文件数据

先是在的hive命令行建的表,成功导入了,但是impala客户端查不到,然后刷新了元数据(invalidate metadata 表名)
impala报错不支持org.apache.hadoop.hive.serde2.OpenCSVSerde
然后就选了第二种方法(注意分隔符)

一、建表
1.
create table if not exists test.product_browsing (
    user_id STRING,
    phone STRING, 
    goods_id STRING, 
    goods_name STRING,
    view_date STRING,
    view_time STRING

) row format serde
'org.apache.hadoop.hive.serde2.OpenCSVSerde'
with
SERDEPROPERTIES
("separatorChar"=",","quotechar"="\"")
STORED AS TEXTFILE;

2.
create table if not exists Impala.test.product_browsing (
    user_id STRING,
    phone STRING, 
    goods_id STRING, 
    goods_name STRING,
    view_date STRING,
    view_time STRING

) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE;

二、加载数据命令
load data local inpath '/home/data.csv' overwrite into table test.product_browsing;

你可能感兴趣的:(数据库程序员)