Hadoop 将路径文件加载到分区表

Hadoop 将路径文件加载到分区表,hadoop,hive,Hadoop,Hive,我正试图通过运行以下命令将文件本地加载到配置单元中: 将路径'/DATA/work/hive/staging/ExampleData.csv'中的数据加载到表tablename中 这给了我一个错误: SemanticException[错误10062]:需要指定分区列 因为目标表是分区的(state=42000,code=10062) 建议创建一个中间表,然后让动态分区开始加载到分区表中 我创建了一个与数据匹配的表,并将其截断: create table temptablename as sel

我正试图通过运行以下命令将文件本地加载到配置单元中:

将路径'/DATA/work/hive/staging/ExampleData.csv'中的数据加载到表tablename中

这给了我一个错误:

SemanticException[错误10062]:需要指定分区列 因为目标表是分区的(state=42000,code=10062)

建议创建一个中间表,然后让动态分区开始加载到分区表中

我创建了一个与数据匹配的表,并将其截断:

create table temptablename as select * from tablename;
truncate table temptablename
然后使用以下命令加载数据:

LOAD DATA INPATH '/data/work/hive/staging/ExampleData.csv' INTO TABLE temptablename;

如何“启动”动态分区?

列的顺序重要吗?是的,列的顺序必须与目标表的架构一致。
1.Load data into temptablename(without partition)
create table temptablename(col1,col2..);
LOAD DATA INPATH '/data/work/hive/staging/ExampleData.csv' INTO TABLE 
temptablename;

now once you have data in intermediate table ,you can kick in dynamic 
partitioning using following command.

2.INSERT into tablename PARTITION(partition_column) select * from 
temptablename;