Support Questions
Find answers, ask questions, and share your expertise

FileAlreadyExistsException when inserting in to Hive table

New Contributor

Py4JJavaError: An error occurred while calling o64.sql.

: org.apache.spark.SparkException: Job aborted due to stage failure: Task 2 in stage 222.1 failed 4 times, most recent failure: Lost task 2.3 in stage 222.1

org.apache.hadoop.fs.FileAlreadyExistsException: /apps/hive/warehouse/.hive-staging_hive_2017-08-24_13-19-26_363_3818389113915853615-3/-ext-10000/_temporary/0/_temporary/attempt_20170824131928_0222_m_000052_0/part-00052 for client 10.64.66.157 already exists

When Creating the Hive table as below

try:

hive.sql("drop table tablename")

except:

pass

hive.sql("CREATE TABLE tablename STORED AS ORC AS SELECT * from temptable")

2 REPLIES 2

Hi @Vivekanandan Gunasekaran

Log states that there is already file contained in the place where you are trying to create a hive table. You may need to delete that file and try to re-create it or create the new hive table pointing to different location. Hope It Help!!

Explorer

@Vivekanandan Gunasekaran What version of spark are you using? From the error, it looks like issue is similar to https://issues.apache.org/jira/browse/HIVE-14137. How temptable was created?

; ;