[fix](mutil-catalog) fix get many same name db/table when show where (#15076)

when show databases/tables/table status where xxx, it will change a selectStmt to select result from 
information_schema, it need catalog info to scan schema table, otherwise may get many
database or table info from multi catalog.

for example
mysql> show databases where schema_name='test';
+----------+
| Database |
+----------+
| test |
| test |
+----------+

MySQL [internal.test]> show tables from test where table_name='test_dc';
+----------------+
| Tables_in_test |
+----------------+
| test_dc |
| test_dc |
+----------------+
This commit is contained in:
xueweizhang
2022-12-19 14:27:48 +08:00
committed by GitHub
parent 000972ae17
commit 1597afcd67
21 changed files with 169 additions and 8 deletions

View File

@ -97,6 +97,10 @@ Status VSchemaScanNode::init(const TPlanNode& tnode, RuntimeState* state) {
_scanner_param.table_structure = _pool->add(
new std::vector<TSchemaTableStructure>(tnode.schema_scan_node.table_structure));
}
if (tnode.schema_scan_node.__isset.catalog) {
_scanner_param.catalog = _pool->add(new std::string(tnode.schema_scan_node.catalog));
}
return Status::OK();
}