carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [1/2] incubator-carbondata git commit: [CARBONDATA-739] Avoid creating multipul instance of directDictionaryGenerator
Date Fri, 10 Mar 2017 14:48:39 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 3172d5b36 -> 6713ffa1f


[CARBONDATA-739] Avoid creating multipul instance of directDictionaryGenerator

remove one empty line

use array to replace arraylist

fix format error { is not preceded with whitespace


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/dbe35de4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/dbe35de4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/dbe35de4

Branch: refs/heads/master
Commit: dbe35de430c05b72d427e695e980be5f920e6de6
Parents: 3172d5b
Author: lucao <whucaolu@gmail.com>
Authored: Wed Mar 8 17:20:58 2017 +0800
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Fri Mar 10 20:17:37 2017 +0530

----------------------------------------------------------------------
 .../impl/DictionaryBasedResultCollector.java     | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/dbe35de4/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
index 752bea8..a4befc7 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java
@@ -17,10 +17,7 @@
 package org.apache.carbondata.core.scan.collector.impl;
 
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import org.apache.carbondata.core.cache.update.BlockletLevelDeleteDeltaDataCache;
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
@@ -37,6 +34,7 @@ import org.apache.carbondata.core.util.CarbonUtil;
 import org.apache.carbondata.core.util.DataTypeUtil;
 
 import org.apache.commons.lang3.ArrayUtils;
+
 /**
  * It is not a collector it is just a scanned result holder.
  */
@@ -103,6 +101,12 @@ public class DictionaryBasedResultCollector extends AbstractScannedResultCollect
     int[] surrogateResult;
     String[] noDictionaryKeys;
     byte[][] complexTypeKeyArray;
+
+    DirectDictionaryGenerator[] directDictionaryGenerators = new DirectDictionaryGenerator[dimSize];
+    for (int i = 0; i < dimSize; i++) {
+      directDictionaryGenerators[i] = DirectDictionaryKeyGeneratorFactory
+              .getDirectDictionaryGenerator(queryDimensions[i].getDimension().getDataType());
+    }
     while (scannedResult.hasNext() && rowCounter < batchSize) {
       Object[] row = new Object[dimSize + queryMeasures.length];
       if (isDimensionsExist) {
@@ -130,11 +134,8 @@ public class DictionaryBasedResultCollector extends AbstractScannedResultCollect
                       queryDimensions[i].getDimension().getDataType());
             }
           } else if (directDictionaryEncodingArray[i]) {
-            DirectDictionaryGenerator directDictionaryGenerator =
-                DirectDictionaryKeyGeneratorFactory
-                    .getDirectDictionaryGenerator(queryDimensions[i].getDimension().getDataType());
-            if (directDictionaryGenerator != null) {
-              row[order[i]] = directDictionaryGenerator.getValueFromSurrogate(
+            if (directDictionaryGenerators[i] != null) {
+              row[order[i]] = directDictionaryGenerators[i].getValueFromSurrogate(
                   surrogateResult[actualIndexInSurrogateKey[dictionaryColumnIndex++]]);
             }
           } else if (complexDataTypeArray[i]) {


Mime
View raw message