Repository: kylin
Updated Branches:
  refs/heads/KYLIN-2254 [created] 9af1e264f


KYLIN-UNKNOWN, sub_query/query12.sql


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

Branch: refs/heads/KYLIN-2254
Commit: 9af1e264ff29441c409737a78f4c2c33082f04a6
Parents: 365caae
Author: Li Yang <liy...@apache.org>
Authored: Wed Dec 7 17:51:26 2016 +0800
Committer: Li Yang <liy...@apache.org>
Committed: Wed Dec 7 18:29:51 2016 +0800

----------------------------------------------------------------------
 .../apache/kylin/metadata/model/TblColRef.java  |  2 +-
 .../resources/query/sql_subquery/query12.sql    | 37 ++++++++++++++++++++
 .../kylin/query/relnode/OLAPFilterRel.java      |  9 +++--
 3 files changed, 45 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/9af1e264/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
----------------------------------------------------------------------
diff --git 
a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java 
b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
index 5d72c3f..fd0224f 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/TblColRef.java
@@ -150,7 +150,7 @@ public class TblColRef implements Serializable {
         return column.getType();
     }
 
-    public void markInnerColumn(InnerDataTypeEnum dataType) {
+    private void markInnerColumn(InnerDataTypeEnum dataType) {
         this.column.setDatatype(dataType.getDataType());
         this.column.getTable().setName(INNER_TABLE_NAME);
         this.column.getTable().setDatabase("DEFAULT");

http://git-wip-us.apache.org/repos/asf/kylin/blob/9af1e264/kylin-it/src/test/resources/query/sql_subquery/query12.sql
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/resources/query/sql_subquery/query12.sql 
b/kylin-it/src/test/resources/query/sql_subquery/query12.sql
new file mode 100644
index 0000000..6ed45fa
--- /dev/null
+++ b/kylin-it/src/test/resources/query/sql_subquery/query12.sql
@@ -0,0 +1,37 @@
+--
+-- 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.
+--
+
+SELECT
+  f.lstg_format_name
+  ,sum(price) as sum_price
+FROM
+  test_kylin_fact f
+  inner join
+  ( 
+    select
+      lstg_format_name,
+      min(slr_segment_cd) as min_seg
+    from
+      test_kylin_fact
+    group by
+      lstg_format_name
+  ) t on f.lstg_format_name = t.lstg_format_name
+where
+  f.slr_segment_cd = min_seg
+group by
+  f.lstg_format_name

http://git-wip-us.apache.org/repos/asf/kylin/blob/9af1e264/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
----------------------------------------------------------------------
diff --git 
a/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java 
b/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
index 411142d..9573dfb 100755
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
@@ -151,7 +151,11 @@ public class OLAPFilterRel extends Filter implements 
OLAPRel {
                 if (filter == null) {
                     filter = cast(childFilter, call.type);
                 } else {
-                    filter.addChild(childFilter);
+                    try {
+                        filter.addChild(childFilter);
+                    } catch (Exception ex) {
+                        return new 
UnsupportedTupleFilter(FilterOperatorEnum.UNSUPPORTED);
+                    }
                 }
             }
 
@@ -227,7 +231,8 @@ public class OLAPFilterRel extends Filter implements 
OLAPRel {
         @Override
         public TupleFilter visitInputRef(RexInputRef inputRef) {
             TblColRef column = 
inputRowType.getColumnByIndex(inputRef.getIndex());
-            context.allColumns.add(column);
+            if (!column.isInnerColumn())
+                context.allColumns.add(column);
             ColumnTupleFilter filter = new ColumnTupleFilter(column);
             return filter;
         }

Reply via email to