diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java index a6a8176..df54cf4 100755 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java @@ -197,18 +197,22 @@ public void configure(JobConf job) { public static InputFormat getInputFormatFromCache( Class inputFormatClass, JobConf job) throws IOException { - - if (!inputFormats.containsKey(inputFormatClass)) { + InputFormat instance = inputFormats.get(inputFormatClass); + if (instance == null) { try { - InputFormat newInstance = (InputFormat) ReflectionUtils + instance = (InputFormat) ReflectionUtils .newInstance(inputFormatClass, job); - inputFormats.put(inputFormatClass, newInstance); + // HBase input formats are not thread safe today. See HIVE-8808. + String inputFormatName = inputFormatClass.getName().toLowerCase(); + if (!inputFormatName.contains("hbase")) { + inputFormats.put(inputFormatClass, instance); + } } catch (Exception e) { throw new IOException("Cannot create an instance of InputFormat class " + inputFormatClass.getName() + " as specified in mapredWork!", e); } } - return inputFormats.get(inputFormatClass); + return instance; } public RecordReader getRecordReader(InputSplit split, JobConf job,