Can't create a partition in hive



at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkTraverse(
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(
at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(
at org.apache.hadoop.hdfs.server.namenode.FSDirStatAndListingOp.getFileInfo(
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$
at org.apache.hadoop.ipc.RPC$
at org.apache.hadoop.ipc.Server$Handler$
at org.apache.hadoop.ipc.Server$Handler$
at Method)
at org.apache.hadoop.ipc.Server$


Where are you trying this?


Im trying to use this, in hdfs, /user/drestrepohinc/data/raw


Can you share the script you are trying to create hive table?


Alter table avro_orders add partition (year=2018) location ‘/user/drestrepohinc/data/raw/’;


It is not how partition table will be created. Can you tell me your database name? I will give the script.


Database: drestrepohinc__retail_db
Table: avro_orders


There are several issues in your approach

  • Your database is pointing to your home directory. It will not work in our lab as it is multi tenant environment
  • Table is external, it might not work in our lab as it is multi tenant environment.
  • Table is not partitioned
  • Table already have data, in partitioned tables main directory of the table should not have data
  • year column does not exist in the table

Here is the code to create partitioned table in a newly created database:

create database drestrepohinc;
use drestrepohinc;
CREATE TABLE `avro_orders_partitioned`(
  `ingestion_year` int COMMENT '',
  `ingestion_month` int COMMENT '',
  `ingestion_day` int COMMENT '',
  `order_id` int COMMENT '',
  `order_date` bigint COMMENT '',
  `order_customer_id` int COMMENT '',
  `order_status` string COMMENT '')

Alter table avro_orders_partitioned add partition (year=2018);

As the user have lab, we are able to quickly troubleshoot the issue and provide the solution


thank you so much, that was very helpfull