• 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数据

  • 相关阅读:
    BiLiBiLi爬虫
    12-UE4-控件类型
    11-UE4-UMG UI设计器
    10-UE4-蓝图定义简介
    UE4-目录结构简介
    UE4-字符串
    UE4-基类
    Redis-事物
    Redis的主从配置
    Redis持久化-AOF
  • 原文地址:https://www.cnblogs.com/myblog1900/p/10031974.html
Copyright © 2020-2023  润新知