commit 9534df8c181e2d1c8c4059e3dfe27c43be7a05ce Author: Vihang Karajgaonkar Date: Wed May 2 15:26:17 2018 -0700 HIVE-19388 : ClassCastException during VectorMapJoinCommonOperator initialization diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinTableContainerSerDe.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinTableContainerSerDe.java index feeefe636af254b22fa4662248dc44ec7cb90246..24b8fea33815867ce544fd284437c4d02a21f1a3 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinTableContainerSerDe.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinTableContainerSerDe.java @@ -110,14 +110,14 @@ public MapJoinTableContainer load( try { if (!fs.exists(folder)) { - return getDefaultEmptyContainer(keyContext, valueContext); + return getDefaultEmptyContainer(hconf, keyContext, valueContext); } if (!fs.isDirectory(folder)) { throw new HiveException("Error, not a directory: " + folder); } FileStatus[] fileStatuses = fs.listStatus(folder); if (fileStatuses == null || fileStatuses.length == 0) { - return getDefaultEmptyContainer(keyContext, valueContext); + return getDefaultEmptyContainer(hconf, keyContext, valueContext); } AbstractSerDe keySerDe = keyContext.getSerDe(); @@ -319,8 +319,13 @@ private MapJoinPersistableTableContainer create( } // Get an empty container when the small table is empty. - private static MapJoinTableContainer getDefaultEmptyContainer(MapJoinObjectSerDeContext keyCtx, - MapJoinObjectSerDeContext valCtx) throws SerDeException { + private static MapJoinTableContainer getDefaultEmptyContainer(Configuration hconf, + MapJoinObjectSerDeContext keyCtx, MapJoinObjectSerDeContext valCtx) throws SerDeException { + boolean useOptimizedContainer = HiveConf.getBoolVar( + hconf, HiveConf.ConfVars.HIVEMAPJOINUSEOPTIMIZEDTABLE); + if (useOptimizedContainer) { + return new MapJoinBytesTableContainer(hconf, valCtx, -1, 0); + } MapJoinTableContainer container = new HashMapWrapper(); container.setSerde(keyCtx, valCtx); container.seal();