Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2549#discussion_r205049034
--- Diff:
core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
---
@@ -141,22 +141,52 @@ public
DictionaryBasedResultCollector(BlockExecutionInfo blockExecutionInfos) {
}
fillMeasureData(scannedResult, row);
if
(scannedResult.complexParentIndexToQueryMap.toString().contains("StructQueryType"))
{
+ int[] isComplexColumn = new int[queryDimensions.length +
queryMeasures.length];
+ for (ProjectionDimension dimension : queryDimensions) {
+ if (null !=
dimension.getDimension().getComplexParentDimension()) {
+ isComplexColumn[dimension.getOrdinal()] = 1;
+ }
+ }
+
// If a : <b,c> and d : <e,f> are two struct and if a.b,a.c,d.e is
given in the
// projection list,then object array will contain a,null,d as
result, because for a.b,
// a will be filled and for a.c null will be placed.
// Instead place null in the end of object array and send a,d,null
as result.
- int count = 0;
for (int j = 0; j < row.length; j++) {
- if (row[j] != null) row[count++] = row[j];
+ if (row[j] == null && isComplexColumn[j] == 1) {
+ shiftNullForStruct(row, isComplexColumn, j);
--- End diff --
does break; required here ? shiftNullForStruct seems like it is handling
the consecutive nulls also. better to call shiftNullForStruct by passing row
and keep loop logic inside that, else coverity tool may give warnings.
---