Repository: hive Updated Branches: refs/heads/branch-1 e08c5c293 -> 411038515
HIVE-14381 : Handle null value in WindowingTableFunction.WindowingIterator.next() (Wei Zheng, reviewed by Jesus Camacho Rodriguez) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/41103851 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/41103851 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/41103851 Branch: refs/heads/branch-1 Commit: 41103851559c9e74b890fc7691857612214ed356 Parents: e08c5c2 Author: Wei Zheng <[email protected]> Authored: Sun Jul 31 15:08:58 2016 -0700 Committer: Wei Zheng <[email protected]> Committed: Sun Jul 31 15:09:58 2016 -0700 ---------------------------------------------------------------------- .../hadoop/hive/ql/udf/ptf/WindowingTableFunction.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/41103851/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java index 40fd6a4..cdcec8f 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java @@ -1356,7 +1356,13 @@ public class WindowingTableFunction extends TableFunctionEvaluator { wFn.getWFnEval().aggregate(aggBuffers[j], args[j]); Object out = ((ISupportStreamingModeForWindowing) wFn.getWFnEval()) .getNextResult(aggBuffers[j]); - out = ObjectInspectorUtils.copyToStandardObject(out, wFn.getOI()); + if (out != null) { + if (out == ISupportStreamingModeForWindowing.NULL_RESULT) { + out = null; + } else { + out = ObjectInspectorUtils.copyToStandardObject(out, wFn.getOI()); + } + } output.set(j, out); } else { Range rng = getRange(wFn, currIdx, iPart, order);
