zoukankan      html  css  js  c++  java
  • hive非分区表导入csv数据

    非分区表

    -- 示例1:
    use temp;
    drop table tmp_cuiwei_main_recommend;
    create table IF NOT EXISTS tmp_cuiwei_main_recommend(                                    
    sml_sa_id int,
    sml_set_time int,
    sml_cancel_time int
    )
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY ','
    LINES TERMINATED BY '
    ';
    
    -- local 表示数据文件在linux文件系统。如果不加local,则需要将文件上传到HDFS
    load data local inpath '/data/home/gongzi/main_recommend.csv' into table temp.tmp_cuiwei_main_recommend;
    
    select 
    sml_sa_id,
    -- 加上##号的目的是看字段与数据有没有对应上
    "##",
    sml_set_time,
    "##",
    sml_cancel_time 
    from temp.tmp_cuiwei_main_recommend limit 30;
    
    
    -- 示例2:
    use temp;
    drop table main_goods_yongyuan;
    create table IF NOT EXISTS main_goods_yongyuan(         
    a string,
    b string,
    c string,
    d string,
    e int
    )
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY ','
    LINES TERMINATED BY '
    ';
    
    -- local 表示数据文件在linux文件系统。如果不加local,则需要将文件上传到HDFS
    load data local inpath '/tmp/xiaoming.txt' into table temp.main_goods_yongyuan;
    

    Blog:hive 非分区表 导入csv数据

  • 相关阅读:
    Mac item 远程连接服务器
    搭建私人Git Server
    数据结构第三章小结
    第二章实践小结
    poj3617 Best Cow Line
    最长上升子序列问题
    Uva11450 Wedding shopping
    poj3050 hopscotch
    poj2718 Smallest Difference
    poj3669 Meteor Shower
  • 原文地址:https://www.cnblogs.com/myblog1900/p/10031974.html
Copyright © 2011-2022 走看看