You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2015/07/30 06:59:37 UTC

incubator-kylin git commit: KYLIN-717 optimize OLAPEnumerator.convertCurrentRow()

Repository: incubator-kylin
Updated Branches:
  refs/heads/0.7-staging f3b7bc5ab -> 8b6c92481


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/8b6c9248
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/8b6c9248
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/8b6c9248

Branch: refs/heads/0.7-staging
Commit: 8b6c9248143c686a6df8cadf6264f3a0e06e86d0
Parents: f3b7bc5
Author: shaofengshi <sh...@apache.org>
Authored: Wed Jul 29 17:26:32 2015 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Wed Jul 29 17:27:05 2015 +0800

----------------------------------------------------------------------
 .../kylin/query/enumerator/CubeEnumerator.java       |  7 +++++--
 script/package.sh                                    | 15 +++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/8b6c9248/query/src/main/java/org/apache/kylin/query/enumerator/CubeEnumerator.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/enumerator/CubeEnumerator.java b/query/src/main/java/org/apache/kylin/query/enumerator/CubeEnumerator.java
index b83e449..011db30 100644
--- a/query/src/main/java/org/apache/kylin/query/enumerator/CubeEnumerator.java
+++ b/query/src/main/java/org/apache/kylin/query/enumerator/CubeEnumerator.java
@@ -46,7 +46,8 @@ public class CubeEnumerator implements Enumerator<Object[]> {
     private final DataContext optiqContext;
     private final Object[] current;
     private ITupleIterator cursor;
-    private int[] fieldIndexes;
+    private int[] fieldIndexes;    
+    private List<String> tupleFieldsSnapshot;
 
     public CubeEnumerator(OLAPContext olapContext, DataContext optiqContext) {
         this.olapContext = olapContext;
@@ -95,7 +96,7 @@ public class CubeEnumerator implements Enumerator<Object[]> {
     private Object[] convertCurrentRow(ITuple tuple) {
 
         // build field index map
-        if (this.fieldIndexes == null) {
+        if (tupleFieldsSnapshot != tuple.getAllFields()) { // note != for fast comparison
             List<String> fields = tuple.getAllFields();
             int size = fields.size();
             this.fieldIndexes = new int[size];
@@ -108,6 +109,7 @@ public class CubeEnumerator implements Enumerator<Object[]> {
                     fieldIndexes[i] = -1;
                 }
             }
+            tupleFieldsSnapshot = tuple.getAllFields();
         }
 
         // set field value
@@ -140,6 +142,7 @@ public class CubeEnumerator implements Enumerator<Object[]> {
         }
 
         this.fieldIndexes = null;
+        this.tupleFieldsSnapshot = null;
         return iterator;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/8b6c9248/script/package.sh
----------------------------------------------------------------------
diff --git a/script/package.sh b/script/package.sh
index 9b0a5b2..63bfb3b 100755
--- a/script/package.sh
+++ b/script/package.sh
@@ -54,6 +54,21 @@ export version
 mkdir -p dist
 #commit id
 cat << EOF > dist/commit.sha1
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 EOF
 git rev-parse HEAD >> dist/commit.sha1