pick from master #41673
This commit is contained in:
@ -41,6 +41,7 @@ import org.apache.doris.nereids.trees.plans.algebra.Generate;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalDeferMaterializeOlapScan;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalFilter;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalSort;
|
||||
import org.apache.doris.nereids.trees.plans.logical.LogicalTopN;
|
||||
@ -179,6 +180,18 @@ public class CheckAfterRewrite extends OneAnalysisRuleFactory {
|
||||
throw new AnalysisException(Type.OnlyMetricTypeErrorMsg);
|
||||
}
|
||||
});
|
||||
} else if (plan instanceof LogicalJoin) {
|
||||
LogicalJoin<?, ?> join = (LogicalJoin<?, ?>) plan;
|
||||
for (Expression conjunct : join.getHashJoinConjuncts()) {
|
||||
if (conjunct.anyMatch(e -> ((Expression) e).getDataType().isVariantType())) {
|
||||
throw new AnalysisException("variant type could not in join equal conditions: " + conjunct.toSql());
|
||||
}
|
||||
}
|
||||
for (Expression conjunct : join.getMarkJoinConjuncts()) {
|
||||
if (conjunct.anyMatch(e -> ((Expression) e).getDataType().isVariantType())) {
|
||||
throw new AnalysisException("variant type could not in join equal conditions: " + conjunct.toSql());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
27
regression-test/suites/nereids_p0/join/test_join_on.groovy
Normal file
27
regression-test/suites/nereids_p0/join/test_join_on.groovy
Normal file
@ -0,0 +1,27 @@
|
||||
// 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.
|
||||
|
||||
suite("test_join_on", "nereids_p0") {
|
||||
sql "SET enable_nereids_planner=true"
|
||||
sql "SET enable_fallback_to_original_planner=false"
|
||||
|
||||
test {
|
||||
sql """select * from (select cast('' as variant) as a) t1 join (select cast('' as variant) as a) t2 on t1.a = t2.a"""
|
||||
exception "variant type could not in join equal conditions"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user