add total in system.one, test

This commit is contained in:
Yakov Olkhovskiy 2024-08-16 23:31:41 +00:00
parent c9bfff3934
commit 07fa798ffa
4 changed files with 25 additions and 2 deletions

View File

@ -41,7 +41,10 @@ Pipe StorageSystemOne::read(
auto column = DataTypeUInt8().createColumnConst(1, 0u)->convertToFullColumnIfConst();
Chunk chunk({ std::move(column) }, 1);
return Pipe(std::make_shared<SourceFromSingleChunk>(std::move(header), std::move(chunk)));
auto source = std::make_shared<SourceFromSingleChunk>(std::move(header), std::move(chunk));
source->addTotalRowsApprox(1);
return Pipe(source);
}

View File

@ -86,7 +86,7 @@ void StorageSystemViewRefreshes::fillData(
res_columns[i++]->insert(refresh.exception_message);
res_columns[i++]->insert(refresh.refresh_count);
res_columns[i++]->insert(std::min(Float64(refresh.progress.read_rows) / refresh.progress.total_rows_to_read, 1.0));
res_columns[i++]->insert(Float64(refresh.progress.read_rows) / refresh.progress.total_rows_to_read);
res_columns[i++]->insert(refresh.progress.elapsed_ns / 1e9);
res_columns[i++]->insert(refresh.progress.read_rows);
res_columns[i++]->insert(refresh.progress.read_bytes);

View File

@ -0,0 +1,2 @@
0
4 4 1

View File

@ -0,0 +1,18 @@
set allow_experimental_refreshable_materialized_view=1;
CREATE MATERIALIZED VIEW 03221_rmv
REFRESH AFTER 1 SECOND
(
x UInt64
)
ENGINE = Memory
AS SELECT number AS x
FROM numbers(3)
UNION ALL
SELECT rand64() AS x;
SELECT sleep(2);
SELECT read_rows, total_rows, progress FROM system.view_refreshes WHERE view = '03221_rmv';
DROP TABLE 03221_rmv;