diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/HybridHashTableContainer.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/HybridHashTableContainer.java index 0a6461f..ce8527b 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/HybridHashTableContainer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/HybridHashTableContainer.java @@ -36,6 +36,7 @@ import org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator; import org.apache.hadoop.hive.ql.exec.JoinUtil; import org.apache.hadoop.hive.ql.exec.Utilities; +import org.apache.hadoop.hive.ql.exec.mapjoin.MapJoinMemoryExhaustionException; import org.apache.hadoop.hive.ql.exec.persistence.MapJoinBytesTableContainer.KeyValueHelper; import org.apache.hadoop.hive.ql.exec.vector.VectorHashKeyWrapper; import org.apache.hadoop.hive.ql.exec.vector.VectorHashKeyWrapperBatch; @@ -235,7 +236,7 @@ public int size() { public HybridHashTableContainer(Configuration hconf, long keyCount, long memoryAvailable, long estimatedTableSize, HybridHashTableConf nwayConf) - throws SerDeException, IOException { + throws SerDeException, IOException, HiveException { this(HiveConf.getFloatVar(hconf, HiveConf.ConfVars.HIVEHASHTABLEKEYCOUNTADJUSTMENT), HiveConf.getIntVar(hconf, HiveConf.ConfVars.HIVEHASHTABLETHRESHOLD), HiveConf.getFloatVar(hconf,HiveConf.ConfVars.HIVEHASHTABLELOADFACTOR), @@ -249,7 +250,7 @@ public HybridHashTableContainer(Configuration hconf, long keyCount, long memoryA private HybridHashTableContainer(float keyCountAdj, int threshold, float loadFactor, int memCheckFreq, int minWbSize, int maxWbSize, int minNumParts, long estimatedTableSize, long keyCount, long memoryAvailable, HybridHashTableConf nwayConf) - throws SerDeException, IOException { + throws SerDeException, IOException, HiveException { directWriteHelper = new MapJoinBytesTableContainer.DirectKeyValueWriter(); int newKeyCount = HashMapWrapper.calculateTableSize( @@ -543,11 +544,14 @@ public long spillPartition(int partitionId) throws IOException { * @return number of partitions needed */ public static int calcNumPartitions(long memoryThreshold, long dataSize, int minNumParts, - int minWbSize, HybridHashTableConf nwayConf) throws IOException { + int minWbSize, HybridHashTableConf nwayConf) throws IOException, HiveException { int numPartitions = minNumParts; if (memoryThreshold < minNumParts * minWbSize) { - LOG.warn("Available memory is not enough to create a HybridHashTableContainer!"); + String msg = String.format("Available memory is not enough to create a HybridHashTableContainer!" + + " memoryThreshold=%d, minNumParts=%d, minWbSize=%d", + memoryThreshold, minNumParts, minWbSize); + throw new MapJoinMemoryExhaustionException(msg); } if (memoryThreshold < dataSize) { while (dataSize / numPartitions > memoryThreshold) {