mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #36439 from xiedeyantu/temp-table-improve
temporary table can show total rows and total bytes
This commit is contained in:
commit
2e187e4b97
@ -244,10 +244,30 @@ protected:
|
||||
if (columns_mask[src_index++])
|
||||
res_columns[res_index++]->insert(table.second->getName());
|
||||
|
||||
/// Fill the rest columns with defaults
|
||||
const auto & settings = context->getSettingsRef();
|
||||
while (src_index < columns_mask.size())
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
// total_rows
|
||||
if (src_index == 18 && columns_mask[src_index])
|
||||
{
|
||||
if (auto total_rows = table.second->totalRows(settings))
|
||||
res_columns[res_index++]->insert(*total_rows);
|
||||
else
|
||||
res_columns[res_index++]->insertDefault();
|
||||
}
|
||||
// total_bytes
|
||||
else if (src_index == 19 && columns_mask[src_index])
|
||||
{
|
||||
if (auto total_bytes = table.second->totalBytes(settings))
|
||||
res_columns[res_index++]->insert(*total_bytes);
|
||||
else
|
||||
res_columns[res_index++]->insertDefault();
|
||||
}
|
||||
/// Fill the rest columns with defaults
|
||||
else if (columns_mask[src_index])
|
||||
res_columns[res_index++]->insertDefault();
|
||||
src_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
1
|
||||
1
|
||||
1
|
||||
t_00693 Memory 1 [] 1970-01-01 00:00:00 [] [] CREATE TEMPORARY TABLE t_00693 (`x` UInt8) ENGINE = Memory Memory \N \N
|
||||
t_00693 Memory 1 [] 1970-01-01 00:00:00 [] [] CREATE TEMPORARY TABLE t_00693 (`x` UInt8) ENGINE = Memory Memory 0 0
|
||||
1
|
||||
1
|
||||
1
|
||||
|
@ -0,0 +1 @@
|
||||
02271_temporary_table_show_rows_bytes 1000 8192
|
@ -0,0 +1,4 @@
|
||||
-- NOTE: database = currentDatabase() is not mandatory
|
||||
|
||||
CREATE TEMPORARY TABLE 02271_temporary_table_show_rows_bytes (A Int64) Engine=Memory as SELECT * FROM numbers(1000);
|
||||
SELECT database, name, total_rows, total_bytes FROM system.tables WHERE is_temporary AND name = '02271_temporary_table_show_rows_bytes';
|
Loading…
Reference in New Issue
Block a user