diff --git ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java index 0567cbe..b7efce9 100644 --- ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java +++ ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java @@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.codec.binary.Hex; +import org.apache.hadoop.hive.conf.HiveConfUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.conf.Configuration; @@ -1813,6 +1814,7 @@ public boolean isBlocking() { private final LocalCache localCache; private boolean isWarnLogged = false; private HiveConf conf; + private boolean localMetaStore; public MetastoreCache(LocalCache lc) { localCache = lc; @@ -1909,17 +1911,26 @@ public void put(Long fileId, FileStatus file, FileMetaInfo fileMetaInfo, Reader throws IOException { localCache.put(fileId, file, fileMetaInfo, orcReader); if (fileId != null) { - try { - getHive().putFileMetadata(Lists.newArrayList(fileId), - Lists.newArrayList(((ReaderImpl)orcReader).getSerializedFileFooter())); - } catch (HiveException e) { - throw new IOException(e); + if (localMetaStore) { + //TODO:get the local store and have PutFileMetadataRequest? Is it + // not expensive? + return; + } else { + try { + getHive().putFileMetadata(Lists.newArrayList(fileId), + Lists.newArrayList( + ((ReaderImpl) orcReader).getSerializedFileFooter())); + } catch (HiveException e) { + throw new IOException(e); + } } } } public void configure(HiveConf queryConfig) { this.conf = queryConfig; + String msUri = conf.getVar(HiveConf.ConfVars.METASTOREURIS); + localMetaStore = HiveConfUtil.isEmbeddedMetaStore(msUri); } @Override