1

我们有一个按年、月和日划分的表(table1)。我创建了一个类似于 table1 的 orc 表,具有相似的分区但类型为 ORC。我正在尝试使用以下语句将日期插入分区,但我将数据转储到具有分区名称的文件夹中。我如何确保文件夹中没有分区名称?

create external table table1_orc(
col1 string,
col2 string,
col3 int
PARTITIONED BY ( 
`year` string,
`month` string,
`day` string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION '/base_path_orc/';

set hive.exec.dynamic.partition=true;
insert overwrite table table1_orc partition(year,month,day) select * from table1 where year = '2015' and month = '10' and day = '01';

hdfs 中 table1 的路径 - /base_path/2015/10/01/data.csv

hdfs中orc表的路径(当前输出)-/base_path_orc/year=2015/month=10/day=01/000000_0

所需的输出 - /base_path_orc/2015/10/01/000000_0

4

0 回答 0