diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicValueRegistryTez.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicValueRegistryTez.java index ec1e84b10f..2d99f50338 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicValueRegistryTez.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicValueRegistryTez.java @@ -61,6 +61,11 @@ public RegistryConfTez(Configuration conf, BaseWork baseWork, } } + static class NullValue { + } + + static final NullValue NULL_VALUE = new NullValue(); + protected Map values = new ConcurrentHashMap<>(); public DynamicValueRegistryTez() { @@ -71,11 +76,21 @@ public Object getValue(String key) { if (!values.containsKey(key)) { throw new NoDynamicValuesException("Value does not exist in registry: " + key); } - return values.get(key); + Object val = values.get(key); + + if (val == NULL_VALUE) { + return null; + } + return val; } protected void setValue(String key, Object value) { - values.put(key, value); + if (value == null) { + // ConcurrentHashMap does not allow null - use a substitute value. + values.put(key, NULL_VALUE); + } else { + values.put(key, value); + } } @Override diff --git a/ql/src/test/results/clientpositive/llap/mergejoin.q.out b/ql/src/test/results/clientpositive/llap/mergejoin.q.out index 96be039d78..1cbc8cd7dd 100644 --- a/ql/src/test/results/clientpositive/llap/mergejoin.q.out +++ b/ql/src/test/results/clientpositive/llap/mergejoin.q.out @@ -520,7 +520,7 @@ STAGE PLANS: keys: 0 _col0 (type: int) 1 _col0 (type: int) - Statistics: Num rows: 391 Data size: 3128 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 392 Data size: 3136 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: count() mode: hash @@ -1687,7 +1687,7 @@ STAGE PLANS: keys: 0 _col0 (type: int) 1 _col0 (type: int) - Statistics: Num rows: 391 Data size: 3128 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 392 Data size: 3136 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: count() mode: hash @@ -3031,7 +3031,7 @@ STAGE PLANS: keys: 0 _col0 (type: int) 1 _col0 (type: int) - Statistics: Num rows: 1009 Data size: 8072 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 1012 Data size: 8096 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: count() mode: hash @@ -3968,7 +3968,7 @@ STAGE PLANS: keys: 0 _col0 (type: int) 1 _col0 (type: int) - Statistics: Num rows: 1009 Data size: 8072 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 1012 Data size: 8096 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: count() mode: hash @@ -4210,7 +4210,7 @@ STAGE PLANS: keys: 0 _col0 (type: int) 1 _col0 (type: int) - Statistics: Num rows: 391 Data size: 3128 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 392 Data size: 3136 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: count() mode: hash