You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2019/08/15 13:34:26 UTC
[kylin] 02/11: KYLIN-4047 Use push-down query when division dynamic
column cube query is not supported (#689)
This is an automated email from the ASF dual-hosted git repository.
nic pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 9650c8d597a57472677a283d51956f1a69a1e735
Author: wangxiaojing123 <49...@users.noreply.github.com>
AuthorDate: Sun Jul 14 18:19:10 2019 +0800
KYLIN-4047 Use push-down query when division dynamic column cube query is not supported (#689)
* KYLIN-4047 Use push-down query when division dynamic column cube query is not supported
* Minor, Code format
---
.../kylin/exception/QueryOnCubeException.java | 43 ++++++++++++++++++++++
.../metadata/expression/BinaryTupleExpression.java | 5 ++-
.../metadata/expression/TupleExpressionTest.java | 9 +++--
.../org/apache/kylin/query/util/PushDownUtil.java | 4 +-
4 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/core-metadata/src/main/java/org/apache/kylin/exception/QueryOnCubeException.java b/core-metadata/src/main/java/org/apache/kylin/exception/QueryOnCubeException.java
new file mode 100644
index 0000000..1b8708d
--- /dev/null
+++ b/core-metadata/src/main/java/org/apache/kylin/exception/QueryOnCubeException.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+*/
+
+package org.apache.kylin.exception;
+
+/**
+ *
+ */
+public class QueryOnCubeException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public QueryOnCubeException() {
+ super();
+ }
+
+ public QueryOnCubeException(String s) {
+ super(s);
+ }
+
+ public QueryOnCubeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public QueryOnCubeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/expression/BinaryTupleExpression.java b/core-metadata/src/main/java/org/apache/kylin/metadata/expression/BinaryTupleExpression.java
index adafd9c..240d331 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/expression/BinaryTupleExpression.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/expression/BinaryTupleExpression.java
@@ -23,6 +23,7 @@ import java.nio.ByteBuffer;
import java.util.List;
import org.apache.kylin.common.util.DecimalUtil;
+import org.apache.kylin.exception.QueryOnCubeException;
import org.apache.kylin.metadata.filter.IFilterCodeSystem;
import org.apache.kylin.metadata.tuple.IEvaluatableTuple;
@@ -64,7 +65,7 @@ public class BinaryTupleExpression extends TupleExpression {
private void verifyMultiply() {
if (ExpressionColCollector.collectMeasureColumns(getLeft()).size() > 0 //
&& ExpressionColCollector.collectMeasureColumns(getRight()).size() > 0) {
- throw new IllegalArgumentException(
+ throw new QueryOnCubeException(
"That both of the two sides of the BinaryTupleExpression own columns is not supported for "
+ operator.toString());
}
@@ -72,7 +73,7 @@ public class BinaryTupleExpression extends TupleExpression {
private void verifyDivide() {
if (ExpressionColCollector.collectMeasureColumns(getRight()).size() > 0) {
- throw new IllegalArgumentException(
+ throw new QueryOnCubeException(
"That the right side of the BinaryTupleExpression owns columns is not supported for "
+ operator.toString());
}
diff --git a/core-metadata/src/test/java/org/apache/kylin/metadata/expression/TupleExpressionTest.java b/core-metadata/src/test/java/org/apache/kylin/metadata/expression/TupleExpressionTest.java
index 7617c5a..5745920 100644
--- a/core-metadata/src/test/java/org/apache/kylin/metadata/expression/TupleExpressionTest.java
+++ b/core-metadata/src/test/java/org/apache/kylin/metadata/expression/TupleExpressionTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.fail;
import java.math.BigDecimal;
import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.apache.kylin.exception.QueryOnCubeException;
import org.apache.kylin.metadata.model.TableDesc;
import org.apache.kylin.metadata.model.TblColRef;
import org.junit.AfterClass;
@@ -65,8 +66,8 @@ public class TupleExpressionTest extends LocalFileMetadataTestCase {
Lists.newArrayList(constTuple2, colTuple2));
try {
biTuple2.verify();
- fail("IllegalArgumentException should be thrown");
- } catch (IllegalArgumentException e) {
+ fail("QueryOnCubeException should be thrown,That the right side of the BinaryTupleExpression owns columns is not supported for /");
+ } catch (QueryOnCubeException e) {
}
biTuple2 = new BinaryTupleExpression(TupleExpression.ExpressionOperatorEnum.DIVIDE,
@@ -77,8 +78,8 @@ public class TupleExpressionTest extends LocalFileMetadataTestCase {
Lists.<TupleExpression> newArrayList(biTuple1, biTuple2));
try {
biTuple.verify();
- fail("IllegalArgumentException should be thrown");
- } catch (IllegalArgumentException e) {
+ fail("QueryOnCubeException should be thrown,That both of the two sides of the BinaryTupleExpression own columns is not supported for *");
+ } catch (QueryOnCubeException e) {
}
}
}
diff --git a/query/src/main/java/org/apache/kylin/query/util/PushDownUtil.java b/query/src/main/java/org/apache/kylin/query/util/PushDownUtil.java
index aa58cc4..c5e8d68 100644
--- a/query/src/main/java/org/apache/kylin/query/util/PushDownUtil.java
+++ b/query/src/main/java/org/apache/kylin/query/util/PushDownUtil.java
@@ -42,6 +42,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.util.ClassUtil;
import org.apache.kylin.common.util.Pair;
+import org.apache.kylin.exception.QueryOnCubeException;
import org.apache.kylin.metadata.model.tool.CalciteParser;
import org.apache.kylin.metadata.project.ProjectManager;
import org.apache.kylin.metadata.querymeta.SelectedColumnMeta;
@@ -143,7 +144,8 @@ public class PushDownUtil {
return (rootCause != null //
&& (rootCause instanceof NoRealizationFoundException //
|| rootCause instanceof SqlValidatorException //
- || rootCause instanceof RoutingIndicatorException)); //
+ || rootCause instanceof RoutingIndicatorException //
+ || rootCause instanceof QueryOnCubeException)); //
}
}