forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix](nereids) fix bind expression compare dbname ignore cluster (apa…
…che#39114) This pr is similar with apache#23008, ignoring cluster_name in binding when compare dbname. e.g. in this sql, the "dbname" should be viewed same db when comparing with "default_cluster:dbname" ```sql select dbname.test_db_name_ignore_cluster.a from `default_cluster:dbname`.test_db_name_ignore_cluster; ```
- Loading branch information
1 parent
3c535e8
commit fba7fa0
Showing
4 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
regression-test/data/nereids_rules_p0/bindExpression/bind_dbname_ignore_cluster.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !test_update -- | ||
2 10 | ||
|
41 changes: 41 additions & 0 deletions
41
regression-test/suites/nereids_rules_p0/bindExpression/bind_dbname_ignore_cluster.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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_db_name_ignore_cluster") { | ||
String db = context.config.getDbNameByFile(new File(context.file.parent)) | ||
sql 'set enable_nereids_planner=true' | ||
sql 'set enable_nereids_distribute_planner=false' | ||
sql "use ${db}" | ||
sql "drop table if exists ${db}.test_db_name_ignore_cluster" | ||
sql """create table ${db}.test_db_name_ignore_cluster(a int, b int) unique key(a) distributed by hash(a) | ||
properties("replication_num"="1");""" | ||
sql "select ${db}.test_db_name_ignore_cluster.a from `default_cluster:${db}`.test_db_name_ignore_cluster;" | ||
sql "select ${db}.test_db_name_ignore_cluster.* from `default_cluster:${db}`.test_db_name_ignore_cluster;" | ||
|
||
sql "select `default_cluster:${db}`.test_db_name_ignore_cluster.a from `${db}`.test_db_name_ignore_cluster;" | ||
sql "select `default_cluster:${db}`.test_db_name_ignore_cluster.* from `${db}`.test_db_name_ignore_cluster;" | ||
|
||
sql "select `default_cluster:${db}`.test_db_name_ignore_cluster.a from `default_cluster:${db}`.test_db_name_ignore_cluster;" | ||
sql "select `default_cluster:${db}`.test_db_name_ignore_cluster.* from `default_cluster:${db}`.test_db_name_ignore_cluster;" | ||
|
||
sql "select internal.`${db}`.test_db_name_ignore_cluster.a from internal.`default_cluster:${db}`.test_db_name_ignore_cluster;" | ||
sql "select internal.`default_cluster:${db}`.test_db_name_ignore_cluster.* from internal.`${db}`.test_db_name_ignore_cluster;" | ||
|
||
sql "insert into ${db}.test_db_name_ignore_cluster values(2,4)" | ||
sql "update `default_cluster:${db}`.test_db_name_ignore_cluster set `${db}`.test_db_name_ignore_cluster.b=10;" | ||
sql "update `${db}`.test_db_name_ignore_cluster set `${db}`.test_db_name_ignore_cluster.b=10;" | ||
qt_test_update "select * from ${db}.test_db_name_ignore_cluster" | ||
} |