This is an automated email from the ASF dual-hosted git repository. morrysnow pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 65ac74564d7 [chore](Nereids) remove useless exception (#44356) 65ac74564d7 is described below commit 65ac74564d7b730df9fc963d94bc68ce86cce6e9 Author: morrySnow <zhangwen...@selectdb.com> AuthorDate: Thu Nov 21 21:14:21 2024 +0800 [chore](Nereids) remove useless exception (#44356) - DialectTransformException - DoNotFallbackException - UnsupportedDialectException - TransformException - MetaNotFoundException --- .../doris/catalog/constraint/TableIdentifier.java | 8 +-- .../exceptions/DialectTransformException.java | 28 -------- .../nereids/exceptions/DoNotFallbackException.java | 27 -------- .../nereids/exceptions/MetaNotFoundException.java | 74 ---------------------- .../nereids/exceptions/TransformException.java | 28 -------- .../exceptions/UnsupportedDialectException.java | 35 ---------- .../doris/nereids/rules/AppliedAwareRule.java | 3 +- .../java/org/apache/doris/nereids/rules/Rule.java | 3 +- 8 files changed, 6 insertions(+), 200 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/constraint/TableIdentifier.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/constraint/TableIdentifier.java index 8e510ec7a93..ccf688663d2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/constraint/TableIdentifier.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/constraint/TableIdentifier.java @@ -21,7 +21,7 @@ import org.apache.doris.catalog.DatabaseIf; import org.apache.doris.catalog.Env; import org.apache.doris.catalog.TableIf; import org.apache.doris.datasource.CatalogIf; -import org.apache.doris.nereids.exceptions.MetaNotFoundException; +import org.apache.doris.nereids.exceptions.AnalysisException; import com.google.common.base.Preconditions; import com.google.gson.annotations.SerializedName; @@ -48,15 +48,15 @@ public class TableIdentifier { public TableIf toTableIf() { CatalogIf<?> catalogIf = Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogId); if (catalogIf == null) { - throw new MetaNotFoundException(String.format("Can not find catalog %s in constraint", catalogId)); + throw new AnalysisException(String.format("Can not find catalog %s in constraint", catalogId)); } DatabaseIf<?> databaseIf = catalogIf.getDbNullable(databaseId); if (databaseIf == null) { - throw new MetaNotFoundException(String.format("Can not find database %s in constraint", databaseId)); + throw new AnalysisException(String.format("Can not find database %s in constraint", databaseId)); } TableIf tableIf = databaseIf.getTableNullable(tableId); if (tableIf == null) { - throw new MetaNotFoundException(String.format("Can not find table %s in constraint", databaseId)); + throw new AnalysisException(String.format("Can not find table %s in constraint", databaseId)); } return tableIf; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/DialectTransformException.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/DialectTransformException.java deleted file mode 100644 index 3d96e6dd039..00000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/DialectTransformException.java +++ /dev/null @@ -1,28 +0,0 @@ -// 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.doris.nereids.exceptions; - -/** - * DialectTransformException when have not supported transforming for dialect converters. - */ -public class DialectTransformException extends UnsupportedOperationException { - - public DialectTransformException(String msg) { - super(String.format("Unsupported dialect transformation is %s", msg)); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/DoNotFallbackException.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/DoNotFallbackException.java deleted file mode 100644 index b6253f52c6b..00000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/DoNotFallbackException.java +++ /dev/null @@ -1,27 +0,0 @@ -// 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.doris.nereids.exceptions; - -/** - * Exception for can not fall back error in Nereids. - */ -public class DoNotFallbackException extends RuntimeException { - public DoNotFallbackException(String msg) { - super(msg); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/MetaNotFoundException.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/MetaNotFoundException.java deleted file mode 100644 index f7d19c3f844..00000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/MetaNotFoundException.java +++ /dev/null @@ -1,74 +0,0 @@ -// 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.doris.nereids.exceptions; - -import org.apache.doris.nereids.trees.plans.logical.LogicalPlan; - -import java.util.Optional; - -/** Nereids's AnalysisException. */ -public class MetaNotFoundException extends RuntimeException { - private final String message; - private final Optional<Integer> line; - private final Optional<Integer> startPosition; - private final Optional<LogicalPlan> plan; - - public MetaNotFoundException(String message, Throwable cause, Optional<Integer> line, - Optional<Integer> startPosition, Optional<LogicalPlan> plan) { - super(message, cause); - this.message = message; - this.line = line; - this.startPosition = startPosition; - this.plan = plan; - } - - public MetaNotFoundException(String message, Optional<Integer> line, - Optional<Integer> startPosition, Optional<LogicalPlan> plan) { - super(message); - this.message = message; - this.line = line; - this.startPosition = startPosition; - this.plan = plan; - } - - public MetaNotFoundException(String message, Throwable cause) { - this(message, cause, Optional.empty(), Optional.empty(), Optional.empty()); - } - - public MetaNotFoundException(String message) { - this(message, Optional.empty(), Optional.empty(), Optional.empty()); - } - - @Override - public String getMessage() { - String planAnnotation = plan.map(p -> ";\n" + p.treeString()).orElse(""); - return getSimpleMessage() + planAnnotation; - } - - private String getSimpleMessage() { - if (line.isPresent() || startPosition.isPresent()) { - String lineAnnotation = line.map(l -> "line " + l).orElse(""); - String positionAnnotation = startPosition.map(s -> " pos " + s).orElse(""); - return message + ";" + lineAnnotation + positionAnnotation; - } else { - return message; - } - } - - // TODO: support ErrorCode -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/TransformException.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/TransformException.java deleted file mode 100644 index 401fdd56bab..00000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/TransformException.java +++ /dev/null @@ -1,28 +0,0 @@ -// 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.doris.nereids.exceptions; - -/** - * All exceptions thrown by transform action in {@link org.apache.doris.nereids.rules.Rule} - * should be a subclass of this class. - */ -public class TransformException extends RuntimeException { - public TransformException(String msg) { - super(String.format("Transform error: %s", msg)); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/UnsupportedDialectException.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/UnsupportedDialectException.java deleted file mode 100644 index cdf7944c61c..00000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/UnsupportedDialectException.java +++ /dev/null @@ -1,35 +0,0 @@ -// 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.doris.nereids.exceptions; - -import org.apache.doris.nereids.parser.Dialect; - -/** - * UnsupportedDialectException when not match any in - * {@link Dialect}. - */ -public class UnsupportedDialectException extends UnsupportedOperationException { - - public UnsupportedDialectException(Dialect dialect) { - super(String.format("Unsupported dialect name is %s", dialect.getDialectName())); - } - - public UnsupportedDialectException(String type, String msg) { - super(String.format("Unsupported dialect type is %s, msg is %s", type, msg)); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/AppliedAwareRule.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/AppliedAwareRule.java index 8f7ea106236..5f4822ead04 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/AppliedAwareRule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/AppliedAwareRule.java @@ -18,7 +18,6 @@ package org.apache.doris.nereids.rules; import org.apache.doris.nereids.CascadesContext; -import org.apache.doris.nereids.exceptions.TransformException; import org.apache.doris.nereids.pattern.Pattern; import org.apache.doris.nereids.pattern.ProxyPattern; import org.apache.doris.nereids.trees.plans.Plan; @@ -52,7 +51,7 @@ public class AppliedAwareRule extends Rule { } @Override - public List<Plan> transform(Plan plan, CascadesContext context) throws TransformException { + public List<Plan> transform(Plan plan, CascadesContext context) { return rule.transform(plan, context); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/Rule.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/Rule.java index 7d5b4001d9a..40b6225e98f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/Rule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/Rule.java @@ -18,7 +18,6 @@ package org.apache.doris.nereids.rules; import org.apache.doris.nereids.CascadesContext; -import org.apache.doris.nereids.exceptions.TransformException; import org.apache.doris.nereids.memo.GroupExpression; import org.apache.doris.nereids.pattern.Pattern; import org.apache.doris.nereids.rules.RuleType.RuleTypeClass; @@ -73,7 +72,7 @@ public abstract class Rule { return getRuleType().toString(); } - public abstract List<Plan> transform(Plan node, CascadesContext context) throws TransformException; + public abstract List<Plan> transform(Plan node, CascadesContext context); /** callback this function when the traverse framework accept a new plan which produce by this rule */ public void acceptPlan(Plan plan) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org