This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new bfb1ab059d [BUG] fix information_schema.columns results not correctly on vec engine (#9612) bfb1ab059d is described below commit bfb1ab059d73fed59e391f1a82a40eb80a82d6b5 Author: camby <104178...@qq.com> AuthorDate: Wed May 18 07:44:32 2022 +0800 [BUG] fix information_schema.columns results not correctly on vec engine (#9612) * VSchemaScanNode get_next bugfix * add regression-test case for VSchemaScanNode Co-authored-by: cambyzju <zhuxiaol...@baidu.com> --- be/src/vec/exec/vmysql_scan_node.cpp | 1 + be/src/vec/exec/vodbc_scan_node.cpp | 1 + be/src/vec/exec/vschema_scan_node.cpp | 7 +- .../data/account/test_information_schema.out | 31 +++++++ .../suites/account/test_information_schema.groovy | 95 ++++++++++++++++++++++ 5 files changed, 132 insertions(+), 3 deletions(-) diff --git a/be/src/vec/exec/vmysql_scan_node.cpp b/be/src/vec/exec/vmysql_scan_node.cpp index 980fb57eb8..d5cec3e215 100644 --- a/be/src/vec/exec/vmysql_scan_node.cpp +++ b/be/src/vec/exec/vmysql_scan_node.cpp @@ -46,6 +46,7 @@ Status VMysqlScanNode::get_next(RuntimeState* state, vectorized::Block* block, b bool mysql_eos = false; do { + columns.resize(_slot_num); for (int i = 0; i < _slot_num; ++i) { if (mem_reuse) { columns[i] = std::move(*block->get_by_position(i).column).mutate(); diff --git a/be/src/vec/exec/vodbc_scan_node.cpp b/be/src/vec/exec/vodbc_scan_node.cpp index 938c226fa6..8366ee0c14 100644 --- a/be/src/vec/exec/vodbc_scan_node.cpp +++ b/be/src/vec/exec/vodbc_scan_node.cpp @@ -58,6 +58,7 @@ Status VOdbcScanNode::get_next(RuntimeState* state, Block* block, bool* eos) { do { RETURN_IF_CANCELLED(state); + columns.resize(column_size); for (auto i = 0; i < column_size; i++) { if (mem_reuse) { columns[i] = std::move(*block->get_by_position(i).column).mutate(); diff --git a/be/src/vec/exec/vschema_scan_node.cpp b/be/src/vec/exec/vschema_scan_node.cpp index c1aed663a1..2c02834b9a 100644 --- a/be/src/vec/exec/vschema_scan_node.cpp +++ b/be/src/vec/exec/vschema_scan_node.cpp @@ -69,12 +69,14 @@ Status VSchemaScanNode::get_next(RuntimeState* state, vectorized::Block* block, if (!_is_init) return Status::InternalError("used before initialize."); RETURN_IF_ERROR(exec_debug_action(TExecNodePhase::GETNEXT)); RETURN_IF_CANCELLED(state); - bool mem_reuse = block->mem_reuse(); - DCHECK(block->rows() == 0); std::vector<vectorized::MutableColumnPtr> columns(_slot_num); bool schema_eos = false; do { + bool mem_reuse = block->mem_reuse(); + DCHECK(block->rows() == 0); + + columns.resize(_slot_num); for (int i = 0; i < _slot_num; ++i) { if (mem_reuse) { columns[i] = std::move(*block->get_by_position(i).column).mutate(); @@ -88,7 +90,6 @@ Status VSchemaScanNode::get_next(RuntimeState* state, vectorized::Block* block, // get all slots from schema table. RETURN_IF_ERROR(_schema_scanner->get_next_row(_src_single_tuple, _tuple_pool.get(), &schema_eos)); - if (schema_eos) { *eos = true; break; diff --git a/regression-test/data/account/test_information_schema.out b/regression-test/data/account/test_information_schema.out new file mode 100644 index 0000000000..1e6a3994f3 --- /dev/null +++ b/regression-test/data/account/test_information_schema.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql -- +612 + +-- !sql -- +578 + +-- !sql -- +544 + +-- !sql -- +510 + +-- !sql -- +476 + +-- !sql -- +612 + +-- !sql -- +578 + +-- !sql -- +544 + +-- !sql -- +510 + +-- !sql -- +476 + diff --git a/regression-test/suites/account/test_information_schema.groovy b/regression-test/suites/account/test_information_schema.groovy new file mode 100644 index 0000000000..71c89c6f58 --- /dev/null +++ b/regression-test/suites/account/test_information_schema.groovy @@ -0,0 +1,95 @@ +// 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_information_schema", "columns") { + def dbPrefix = "db_test_schema_" + def tablePrefix = "tb_test_schema_" + + // create lots of dbs and tables to make rows in `information_schema.columns` more than 1024 + for (int i = 1; i <= 5; i++) { + def dbName = dbPrefix + i.toString() + sql "CREATE DATABASE IF NOT EXISTS `${dbName}`" + sql "USE `${dbName}`" + for (int j = i; j <= 18; j++) { + def tableName = tablePrefix + j.toString(); + sql """ + CREATE TABLE IF NOT EXISTS `${tableName}` ( + `aaa` varchar(170) NOT NULL COMMENT "", + `bbb` varchar(100) NOT NULL COMMENT "", + `ccc` varchar(170) NULL COMMENT "", + `ddd` varchar(120) NULL COMMENT "", + `eee` varchar(120) NULL COMMENT "", + `fff` varchar(130) NULL COMMENT "", + `ggg` varchar(170) NULL COMMENT "", + `hhh` varchar(170) NULL COMMENT "", + `jjj` varchar(170) NULL COMMENT "", + `kkk` varchar(170) NULL COMMENT "", + `lll` varchar(170) NULL COMMENT "", + `mmm` varchar(170) NULL COMMENT "", + `nnn` varchar(70) NULL COMMENT "", + `ooo` varchar(140) NULL COMMENT "", + `ppp` varchar(70) NULL COMMENT "", + `qqq` varchar(130) NULL COMMENT "", + `rrr` bigint(20) NULL COMMENT "", + `sss` bigint(20) NULL COMMENT "", + `ttt` decimal(24, 2) NULL COMMENT "", + `uuu` decimal(24, 2) NULL COMMENT "", + `vvv` decimal(24, 2) NULL COMMENT "", + `www` varchar(50) NULL COMMENT "", + `xxx` varchar(190) NULL COMMENT "", + `yyy` varchar(190) NULL COMMENT "", + `zzz` varchar(100) NULL COMMENT "", + `aa` bigint(20) NULL COMMENT "", + `bb` bigint(20) NULL COMMENT "", + `cc` bigint(20) NULL COMMENT "", + `dd` varchar(60) NULL COMMENT "", + `ee` varchar(60) NULL COMMENT "", + `ff` varchar(60) NULL COMMENT "", + `gg` varchar(50) NULL COMMENT "", + `hh` bigint(20) NULL COMMENT "", + `ii` bigint(20) NULL COMMENT "" + ) ENGINE=OLAP + DUPLICATE KEY(`aaa`) + COMMENT "OLAP" + DISTRIBUTED BY HASH(`aaa`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "in_memory" = "false", + "storage_format" = "V2" + ) + """ + } + } + + sql "set enable_vectorized_engine=true" + for (int i = 1; i <= 5; i++) { + def dbName = dbPrefix + i.toString() + sql "USE information_schema" + qt_sql "SELECT COUNT(*) FROM `columns` WHERE TABLE_SCHEMA='${dbName}'" + } + + sql "set enable_vectorized_engine=false" + for (int i = 1; i <= 5; i++) { + def dbName = dbPrefix + i.toString() + sql "USE information_schema" + qt_sql "SELECT COUNT(*) FROM `columns` WHERE TABLE_SCHEMA='${dbName}'" + } + + for (int i = 1; i <= 5; i++) { + def dbName = dbPrefix + i.toString() + sql "DROP DATABASE `${dbName}`" + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org