kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [27/50] incubator-kylin git commit: KYLIN-717, optimize OLAPEnumerator.convertCurrentRow()
Date Sun, 26 Apr 2015 04:27:09 GMT
KYLIN-717, optimize OLAPEnumerator.convertCurrentRow()


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

Branch: refs/heads/streaming-localdict
Commit: cb2c5b1e19effa42553fac57b93a7e45f8fd0cba
Parents: 6c35414
Author: Li, Yang <yangli9@ebay.com>
Authored: Wed Apr 22 15:28:26 2015 +0800
Committer: Li, Yang <yangli9@ebay.com>
Committed: Wed Apr 22 15:28:26 2015 +0800

----------------------------------------------------------------------
 .../apache/kylin/query/enumerator/OLAPEnumerator.java  | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/cb2c5b1e/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java b/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
index ce1eb88..f49853f 100644
--- a/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
+++ b/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
@@ -49,7 +49,7 @@ public class OLAPEnumerator implements Enumerator<Object[]> {
     private final Object[] current;
     private ITupleIterator cursor;
     private int[] fieldIndexes;
-    private int tupleFieldsHash;
+    private List<String> tupleFieldsSnapshot;
 
     public OLAPEnumerator(OLAPContext olapContext, DataContext optiqContext) {
         this.olapContext = olapContext;
@@ -57,7 +57,6 @@ public class OLAPEnumerator implements Enumerator<Object[]> {
         this.current = new Object[olapContext.olapRowType.getFieldCount()];
         this.cursor = null;
         this.fieldIndexes = null;
-        this.tupleFieldsHash = -1;
     }
 
     @Override
@@ -98,10 +97,8 @@ public class OLAPEnumerator implements Enumerator<Object[]> {
 
     private Object[] convertCurrentRow(ITuple tuple) {
 
-        int hashCode = tuple.getAllFields().hashCode();
-
         // build field index map, if the map doesn't exit or the tuple fields structure changed
-        if (this.fieldIndexes == null || tupleFieldsHash != hashCode) {
+        if (tupleFieldsSnapshot != tuple.getAllFields()) { // note != for fast comparison
             List<String> fields = tuple.getAllFields();
             int size = fields.size();
             this.fieldIndexes = new int[size];
@@ -114,8 +111,8 @@ public class OLAPEnumerator implements Enumerator<Object[]> {
                     fieldIndexes[i] = -1;
                 }
             }
-
-            tupleFieldsHash = hashCode;
+            
+            tupleFieldsSnapshot = tuple.getAllFields();
         }
 
         // set field value
@@ -148,7 +145,7 @@ public class OLAPEnumerator implements Enumerator<Object[]> {
         }
 
         this.fieldIndexes = null;
-        this.tupleFieldsHash = -1;
+        this.tupleFieldsSnapshot = null;
         return iterator;
     }
 


Mime
View raw message