Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hive 动态分区下嵌套静态分区_Hive_Mapreduce_Hive Partitions - Fatal编程技术网

Hive 动态分区下嵌套静态分区

Hive 动态分区下嵌套静态分区,hive,mapreduce,hive-partitions,Hive,Mapreduce,Hive Partitions,在配置单元中,为什么不允许在动态分区下嵌套静态分区 例如,以下内容是允许的 INSERT OVERWRITE TABLE T PARTITION (ds='2010-03-03', hr) SELECT key, value, /*ds,*/ hr FROM srcpart WHERE ds is not null and hr>10; 但这是不允许的 INSERT OVERWRITE TABLE T PARTITION (ds, hr = 11) SELECT key, value,

在配置单元中,为什么不允许在动态分区下嵌套静态分区

例如,以下内容是允许的

INSERT OVERWRITE TABLE T PARTITION (ds='2010-03-03', hr)
SELECT key, value, /*ds,*/ hr FROM srcpart WHERE ds is not null and hr>10;
但这是不允许的

INSERT OVERWRITE TABLE T PARTITION (ds, hr = 11)
SELECT key, value, ds/*, hr*/ FROM srcpart WHERE ds is not null and hr=11;
我发现官方维基页面的解释(如下所示)不够充分。更喜欢逻辑解释或基础映射级别的解释

SP is a subpartition of a DP: should throw an error because partition column order determins directory hierarchy. We cannot change the hierarchy in DML
这是一个蜂巢设计问题()

如果有多个分区列,则它们的顺序为 这一点非常重要,因为它转换为HDFS中的目录结构:
按(ds string,dept int)分区
表示目录结构为
ds=2009-02-26/dept=2

在涉及分区表的DML或DDL中, 如果指定了分区列的子集(静态),我们应该 如果动态分区列较低,则抛出错误

例如:

create table nzhang_part(a string) partitioned by (ds string, dept int);
insert overwrite nzhang_part (dept=1)
  select a, ds, dept from T
  where dept=1 and ds is not null;

作为优化,静态分区将在@runtime期间提前创建。因此,您的(ds,hr=11)将无法工作,因为父目录是动态的。