我使用Hortonworks在配置单元中创建分区表,并使用配置单元中的另一个表将数据插入其中。问题是,在我将数据插入到我创建的表中之后,结果表中分区列(passenger\u count)中的所有值都显示为0,即使原始表中没有一个值是0。
-
运行以下查询以创建名为“date\u partitioned”的表:
create table date_partitioned
(tpep_dropoff_datetime string, trip_distance double)
partitioned by (passenger_count int);
-
INSERT INTO TABLE date_partitioned
PARTITION (passenger_count)
SELECT tpep_dropoff_datetime, trip_distance, passenger_count
FROM trips_raw;
“trips\u raw”的列类型和示例值显示在下面的屏幕截图中:
如您所见,“passenger\u count”列是int类型,包含非零值。但是当我查看'date\u partitioned'表的结果时,'passenger\u count'列的值都显示为0。该表还创建了一个重复的“passenger\u count”(因此它有2个“passenger\u count”列,其中一个是空的)。从下面的截图可以看到:
如有任何建议,将不胜感激。我很好奇,为什么“passenger\u count”在原始列没有0的情况下在结果表中显示为0,为什么在结果表中有一个额外的“passenger\u count”列。