zoukankan      html  css  js  c++  java
  • [Hive]使用HDFS文件夹数据创建Hive表分区

    描写叙述:

    Hive表pms.cross_sale_path建立以日期作为分区,将hdfs文件夹/user/pms/workspace/ouyangyewei/testUsertrack/job1Output/crossSale上的数据,写入该表的$yesterday分区上

    表结构:

    hive -e "
    set mapred.job.queue.name=pms;
    
    drop table if exists pms.cross_sale_path;
    create external table pms.cross_sale_path
    (
    track_id string,
    track_time string,
    session_id string,
    gu_id string,
    end_user_id string,
    page_category_id bigint,
    algorithm_id int,
    is_add_cart int,
    rcmd_product_id bigint,
    product_id bigint,
    category_id bigint,
    path_id string,
    path_type int,
    path_length int,
    path_list string,
    order_code string
    )
    PARTITIONED BY (ds string)
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '	' 
    LINES TERMINATED BY '
    ' 
    STORED AS TEXTFILE;"

    写法:

    yesterday=`date -d -1days +%Y-%m-%d`
    hive -e "load data inpath '/user/pms/workspace/ouyangyewei/testUsertrack/job1Output/crossSale' into table pms.cross_sale_path partition(ds='$yesterday');"
    

  • 相关阅读:
    使用Mybatis时报错Invalid bound statement (not found):
    MyBatis学习(3)
    选数字
    看程序写结果
    NP
    完全平方数
    hahaha
    haha

    凝视
  • 原文地址:https://www.cnblogs.com/hrhguanli/p/5080096.html
Copyright © 2011-2022 走看看