This is an automated email from the ASF dual-hosted git repository. magang pushed a commit to branch realtime-streaming in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/realtime-streaming by this push: new 7590263 KYLIN-3787 NPE throws when dimension value has null when query real-time data 7590263 is described below commit 7590263cbf38227d00274d40da3e9dee41492eeb Author: Ma,Gang <ga...@ebay.com> AuthorDate: Fri Jan 25 13:10:29 2019 +0800 KYLIN-3787 NPE throws when dimension value has null when query real-time data --- .../kylin/stream/core/query/RecordsAggregator.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/stream-core/src/main/java/org/apache/kylin/stream/core/query/RecordsAggregator.java b/stream-core/src/main/java/org/apache/kylin/stream/core/query/RecordsAggregator.java index d87fa78..bb35c90 100644 --- a/stream-core/src/main/java/org/apache/kylin/stream/core/query/RecordsAggregator.java +++ b/stream-core/src/main/java/org/apache/kylin/stream/core/query/RecordsAggregator.java @@ -136,14 +136,25 @@ public class RecordsAggregator implements Iterable<Record>{ final Comparator<String[]> comparator = new Comparator<String[]>() { @Override public int compare(String[] o1, String[] o2) { + int result = 0; for (int i = 0; i < groupIndexes.length; i++) { int groupIdx = groupIndexes[i]; - int result = o1[groupIdx].compareTo(o2[groupIdx]); - if (result != 0) { - return result; + if (o1[groupIdx] == null && o2[groupIdx] == null) { + continue; + } else if (o1[groupIdx] != null && o2[groupIdx] == null) { + return 1; + } else if (o1[groupIdx] == null && o2[groupIdx] != null) { + return -1; + } else { + result = o1[groupIdx].compareTo(o2[groupIdx]); + if (result == 0) { + continue; + } else { + return result; + } } } - return 0; + return result; } }; }