zoukankan      html  css  js  c++  java
  • tdh inceptor orc分区表和hdfs上表目录内文件的关系(值分区,范围分区)。

    drop table if exists user7;
    drop table if exists user7_0;
    drop table if exists user7_1;
    create table user7 (name string ,age int)partitioned by (sex string) stored as orc; 
    set hive.exec.dynamic.partition=true; 
    insert into table user7 partition(sex) select 'zs',1,'girl' from system.dual;
    
     create table user7_0 (name string ,age int ,sex string)stored as orc;
    
    load data inpath '/inceptorsql1/user/hive/warehouse/default.db/hive/user7/sex=girl' into table user7_0;
    
    insert into table user7 partition(sex) select 'zs',1,'girl' from system.dual;
    
     create table user7_1 (name string ,age int) stored as orc;
    load data inpath '/inceptorsql1/user/hive/warehouse/default.db/hive/user7/sex=girl' into table user7_1;
    
    
    select * from user7_0;
    select * from user7_1;

     

     这个实验,演示了分区表和非分区表的关系。值分区表的orc文件不保存分区列的值。

    下面试着演示范围分区:

    create table  user9(name string) partitioned by range (age int) 
    (
    PARTITION p5_105_205 VALUES LESS THAN (5),
    PARTITION p5_105_215 VALUES LESS THAN (10),
    PARTITION p5_115_205 VALUES LESS THAN (20),
    PARTITION p5_115_max VALUES LESS THAN (MAXVALUE)
    )stored as orc;
    insert into user9 select name,age from user4;
    dfs -ls /inceptorsql1/user/hive/warehouse/default.db/hive/user9/p5_105_215;
    
    create table user9_0(name string,age int) stored as orc;
    
    load data inpath '/inceptorsql1/user/hive/warehouse/default.db/hive/user9/p5_105_215/000000_0' into table user9_0;

    用dfs -ls 找出有数据的目录,然后将数据load到对应非分区表user9_0中。

    结果如下,说明范围分区表中的orc文件有和对应非分区表相同数量的列。

  • 相关阅读:
    iris数据集
    codevs 1262 不要把球传我 2012年CCC加拿大高中生信息学奥赛
    codevs 1742 爬楼梯(水题日常)
    codevs 2277 爱吃皮蛋的小明(水题日常)
    洛谷 P3386 【模板】二分图匹配
    vijos 1190 繁忙的都市
    codevs 1487 大批整数排序(水题日常)
    洛谷 P2820 局域网
    codevs 1683 车厢重组(水题日常)
    codevs 1228 苹果树
  • 原文地址:https://www.cnblogs.com/wifi0/p/7420793.html
Copyright © 2011-2022 走看看