0
votes

I have an employee data with 3 departments A,B,C. I am trying to create partioned table on departments. I created the table using below command.

create external table Parti_Trail (EmployeeID Int,FirstName String,Designation String,Salary Int) PARTITIONED BY (Department String) row format delimited fields terminated by "," location '/user/sree/HiveTrail';

But this did nt load my table with data in location '/user/sree/HiveTrail'

So I tried to load my table

LOAD DATA INPATH '/user/aibladmin/HiveTrail' OVERWRITE INTO TABLE Parti_SCDTrail PARTITION(department); 

But showing

FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: department not found in table's partition spec: {department=null}
  1. Why is it so. Am I doing anything wrong?
  2. What happens if we SET hive.exec.dynamic.partition.mode = nonstrict;
  3. While creating partitioned table , do we need to keep data seperated in different folder or whether it automatically get seperated into different partitions
1

1 Answers

0
votes

For external tables with partition in Hive you need to run an ALTER statement to update the Metastore for new partitions. Because external tables are not managed by Hive.

Check this link

Hope it helps...!!!