diff --git ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java index e577961..c2ecbac 100644 --- ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java +++ ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcRecordUpdater.java @@ -187,14 +187,22 @@ static StructObjectInspector createEventSchema(ObjectInspector rowInspector) { fs = path.getFileSystem(options.getConfiguration()); } this.fs = fs; - try { - FSDataOutputStream strm = fs.create(new Path(path, ACID_FORMAT), false); - strm.writeInt(ORC_ACID_VERSION); - strm.close(); - } catch (IOException ioe) { - if (LOG.isDebugEnabled()) { - LOG.debug("Failed to create " + path + "/" + ACID_FORMAT + " with " + + Path formatFile = new Path(path, ACID_FORMAT); + if(!fs.exists(formatFile)) { + FSDataOutputStream strm = null; + try { + strm = fs.create(formatFile, false); + strm.writeInt(ORC_ACID_VERSION); + } catch (IOException ioe) { + if (LOG.isDebugEnabled()) { + LOG.debug("Failed to create " + path + "/" + ACID_FORMAT + " with " + ioe); + } + } + finally { + if(strm != null) { + strm.close(); + } } } if (options.getMinimumTransactionId() != options.getMaximumTransactionId()