mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
Add total_rows/total_bytes support for Set/Join
This commit is contained in:
parent
840d96255e
commit
4d1385ef19
@ -100,7 +100,10 @@ HashJoinPtr StorageJoin::getJoin(std::shared_ptr<TableJoin> analyzed_join) const
|
|||||||
|
|
||||||
|
|
||||||
void StorageJoin::insertBlock(const Block & block) { join->addJoinedBlock(block, true); }
|
void StorageJoin::insertBlock(const Block & block) { join->addJoinedBlock(block, true); }
|
||||||
|
|
||||||
size_t StorageJoin::getSize() const { return join->getTotalRowCount(); }
|
size_t StorageJoin::getSize() const { return join->getTotalRowCount(); }
|
||||||
|
std::optional<UInt64> StorageJoin::totalRows() const { return join->getTotalRowCount(); }
|
||||||
|
std::optional<UInt64> StorageJoin::totalBytes() const { return join->getTotalByteCount(); }
|
||||||
|
|
||||||
|
|
||||||
void registerStorageJoin(StorageFactory & factory)
|
void registerStorageJoin(StorageFactory & factory)
|
||||||
|
@ -46,6 +46,9 @@ public:
|
|||||||
size_t max_block_size,
|
size_t max_block_size,
|
||||||
unsigned num_streams) override;
|
unsigned num_streams) override;
|
||||||
|
|
||||||
|
std::optional<UInt64> totalRows() const override;
|
||||||
|
std::optional<UInt64> totalBytes() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Block sample_block;
|
Block sample_block;
|
||||||
const Names key_names;
|
const Names key_names;
|
||||||
|
@ -151,8 +151,10 @@ StorageSet::StorageSet(
|
|||||||
|
|
||||||
void StorageSet::insertBlock(const Block & block) { set->insertFromBlock(block); }
|
void StorageSet::insertBlock(const Block & block) { set->insertFromBlock(block); }
|
||||||
void StorageSet::finishInsert() { set->finishInsert(); }
|
void StorageSet::finishInsert() { set->finishInsert(); }
|
||||||
size_t StorageSet::getSize() const { return set->getTotalRowCount(); }
|
|
||||||
|
|
||||||
|
size_t StorageSet::getSize() const { return set->getTotalRowCount(); }
|
||||||
|
std::optional<UInt64> StorageSet::totalRows() const { return set->getTotalRowCount(); }
|
||||||
|
std::optional<UInt64> StorageSet::totalBytes() const { return set->getTotalByteCount(); }
|
||||||
|
|
||||||
void StorageSet::truncate(const ASTPtr &, const StorageMetadataPtr & metadata_snapshot, const Context &, TableExclusiveLockHolder &)
|
void StorageSet::truncate(const ASTPtr &, const StorageMetadataPtr & metadata_snapshot, const Context &, TableExclusiveLockHolder &)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,9 @@ public:
|
|||||||
|
|
||||||
void truncate(const ASTPtr &, const StorageMetadataPtr & metadata_snapshot, const Context &, TableExclusiveLockHolder &) override;
|
void truncate(const ASTPtr &, const StorageMetadataPtr & metadata_snapshot, const Context &, TableExclusiveLockHolder &) override;
|
||||||
|
|
||||||
|
std::optional<UInt64> totalRows() const override;
|
||||||
|
std::optional<UInt64> totalBytes() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SetPtr set;
|
SetPtr set;
|
||||||
|
|
||||||
|
@ -39,3 +39,9 @@ Check lifetime_bytes/lifetime_rows for Buffer
|
|||||||
200 100
|
200 100
|
||||||
200 100
|
200 100
|
||||||
402 201
|
402 201
|
||||||
|
Check total_bytes/total_rows for Set
|
||||||
|
2048 50
|
||||||
|
2048 100
|
||||||
|
Check total_bytes/total_rows for Join
|
||||||
|
10240 50
|
||||||
|
10240 100
|
||||||
|
@ -112,3 +112,17 @@ INSERT INTO check_system_tables SELECT * FROM numbers_mt(101); -- direct block w
|
|||||||
SELECT lifetime_bytes, lifetime_rows FROM system.tables WHERE name = 'check_system_tables';
|
SELECT lifetime_bytes, lifetime_rows FROM system.tables WHERE name = 'check_system_tables';
|
||||||
DROP TABLE check_system_tables;
|
DROP TABLE check_system_tables;
|
||||||
DROP TABLE check_system_tables_null;
|
DROP TABLE check_system_tables_null;
|
||||||
|
|
||||||
|
SELECT 'Check total_bytes/total_rows for Set';
|
||||||
|
CREATE TABLE check_system_tables Engine=Set() AS SELECT * FROM numbers(50);
|
||||||
|
SELECT total_bytes, total_rows FROM system.tables WHERE name = 'check_system_tables';
|
||||||
|
INSERT INTO check_system_tables SELECT number+50 FROM numbers(50);
|
||||||
|
SELECT total_bytes, total_rows FROM system.tables WHERE name = 'check_system_tables';
|
||||||
|
DROP TABLE check_system_tables;
|
||||||
|
|
||||||
|
SELECT 'Check total_bytes/total_rows for Join';
|
||||||
|
CREATE TABLE check_system_tables Engine=Join(ANY, LEFT, number) AS SELECT * FROM numbers(50);
|
||||||
|
SELECT total_bytes, total_rows FROM system.tables WHERE name = 'check_system_tables';
|
||||||
|
INSERT INTO check_system_tables SELECT number+50 FROM numbers(50);
|
||||||
|
SELECT total_bytes, total_rows FROM system.tables WHERE name = 'check_system_tables';
|
||||||
|
DROP TABLE check_system_tables;
|
||||||
|
Loading…
Reference in New Issue
Block a user