minor, special treatment for OLAPContext.allColumns when select star

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

Branch: refs/heads/master
Commit: 3200d6a148d4368801e415f6ae969bbab7c7345e
Parents: 28a07eb
Author: Hongbin Ma <mahong...@apache.org>
Authored: Sun Aug 27 15:41:22 2017 +0800
Committer: Hongbin Ma <m...@kyligence.io>
Committed: Mon Aug 28 10:42:57 2017 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/query/relnode/OLAPTableScan.java  | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/3200d6a1/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
----------------------------------------------------------------------
diff --git 
a/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java 
b/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
index 7801891..dd2160b 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java
@@ -210,7 +210,8 @@ public class OLAPTableScan extends TableScan implements 
OLAPRel, EnumerableRel {
         Preconditions.checkState(columnRowType == null, "OLAPTableScan MUST 
NOT be shared by more than one prent");
 
         // create context in case of non-join
-        if (implementor.getContext() == null || !(implementor.getParentNode() 
instanceof OLAPJoinRel) || implementor.isNewOLAPContextRequired()) {
+        if (implementor.getContext() == null || !(implementor.getParentNode() 
instanceof OLAPJoinRel)
+                || implementor.isNewOLAPContextRequired()) {
             implementor.allocateContext();
         }
 
@@ -227,6 +228,13 @@ public class OLAPTableScan extends TableScan implements 
OLAPRel, EnumerableRel {
         if (context.firstTableScan == null) {
             context.firstTableScan = this;
         }
+
+        if (implementor.getParentNode() instanceof OLAPToEnumerableConverter) {
+            // OLAPToEnumerableConverter on top of table scan, should be a 
select * from table
+            for (TblColRef tblColRef : columnRowType.getAllColumns()) {
+                context.allColumns.add(tblColRef);
+            }
+        }
     }
 
     public String getAlias() {
@@ -288,7 +296,8 @@ public class OLAPTableScan extends TableScan implements 
OLAPRel, EnumerableRel {
         String execFunction = genExecFunc();
 
         PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), 
this.rowType, pref.preferArray());
-        MethodCallExpression exprCall = 
Expressions.call(table.getExpression(OLAPTable.class), execFunction, 
implementor.getRootExpression(), Expressions.constant(context.id));
+        MethodCallExpression exprCall = 
Expressions.call(table.getExpression(OLAPTable.class), execFunction,
+                implementor.getRootExpression(), 
Expressions.constant(context.id));
         return implementor.result(physType, Blocks.toBlock(exprCall));
     }
 

Reply via email to