2019-07-29 13:50:13 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/IStorage.h>
|
|
|
|
|
2019-07-30 12:15:02 +00:00
|
|
|
|
2019-07-29 13:50:13 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2019-07-31 14:12:05 +00:00
|
|
|
/* One block storage used for values table function
|
|
|
|
* It's structure is similar to IStorageSystemOneBlock
|
2019-07-31 14:06:22 +00:00
|
|
|
*/
|
2022-05-03 06:43:28 +00:00
|
|
|
class StorageValues final : public IStorage
|
2019-07-29 13:50:13 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-04-19 20:47:29 +00:00
|
|
|
StorageValues(
|
|
|
|
const StorageID & table_id_, const ColumnsDescription & columns_, const Block & res_block_, const NamesAndTypesList & virtuals_ = {});
|
|
|
|
|
2019-07-29 13:50:13 +00:00
|
|
|
std::string getName() const override { return "Values"; }
|
|
|
|
|
2020-08-03 13:54:14 +00:00
|
|
|
Pipe read(
|
2019-07-29 16:20:17 +00:00
|
|
|
const Names & column_names,
|
2021-07-09 03:15:41 +00:00
|
|
|
const StorageSnapshotPtr & storage_snapshot,
|
2020-09-20 17:52:17 +00:00
|
|
|
SelectQueryInfo & query_info,
|
2021-04-10 23:33:54 +00:00
|
|
|
ContextPtr context,
|
2019-07-29 16:20:17 +00:00
|
|
|
QueryProcessingStage::Enum processed_stage,
|
|
|
|
size_t max_block_size,
|
2022-10-07 10:46:45 +00:00
|
|
|
size_t num_streams) override;
|
2019-07-29 13:50:13 +00:00
|
|
|
|
2020-04-29 12:15:23 +00:00
|
|
|
/// Why we may have virtual columns in the storage from a single block?
|
|
|
|
/// Because it used as tmp storage for pushing blocks into views, and some
|
|
|
|
/// views may contain virtual columns from original storage.
|
|
|
|
NamesAndTypesList getVirtuals() const override
|
|
|
|
{
|
|
|
|
return virtuals;
|
|
|
|
}
|
2022-01-31 22:27:55 +00:00
|
|
|
|
|
|
|
/// FIXME probably it should return false, but StorageValues is used in ExecutingInnerQueryFromViewTransform (whatever it is)
|
|
|
|
bool supportsTransactions() const override { return true; }
|
|
|
|
|
Disable parallelize_output_from_storages for storages with only one block
$ clickhouse-benchmark -i 10000 -d 0 --parallelize_output_from_storages=0 -q "select * from values('foo')"
Loaded 1 queries.
Queries executed: 10000.
localhost:9000, queries 10000, QPS: 2800.490, RPS: 2800.490, MiB/s: 0.032, result RPS: 2800.490, result MiB/s: 0.032.
0.000% 0.000 sec.
10.000% 0.000 sec.
20.000% 0.000 sec.
30.000% 0.000 sec.
40.000% 0.000 sec.
50.000% 0.000 sec.
60.000% 0.000 sec.
70.000% 0.000 sec.
80.000% 0.000 sec.
90.000% 0.000 sec.
95.000% 0.000 sec.
99.000% 0.001 sec.
99.900% 0.001 sec.
99.990% 0.001 sec.
$ clickhouse-benchmark -i 10000 -d 0 --parallelize_output_from_storages=1 -q "select * from values('foo')"
Loaded 1 queries.
Queries executed: 10000.
localhost:9000, queries 10000, QPS: 1259.805, RPS: 1259.805, MiB/s: 0.014, result RPS: 1259.805, result MiB/s: 0.014.
0.000% 0.001 sec.
10.000% 0.001 sec.
20.000% 0.001 sec.
30.000% 0.001 sec.
40.000% 0.001 sec.
50.000% 0.001 sec.
60.000% 0.001 sec.
70.000% 0.001 sec.
80.000% 0.001 sec.
90.000% 0.001 sec.
95.000% 0.001 sec.
99.000% 0.001 sec.
99.900% 0.001 sec.
99.990% 0.003 sec.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-05-25 05:22:00 +00:00
|
|
|
bool parallelizeOutputAfterReading(ContextPtr) const override { return false; }
|
|
|
|
|
2019-07-29 13:50:13 +00:00
|
|
|
private:
|
|
|
|
Block res_block;
|
2020-04-29 12:15:23 +00:00
|
|
|
NamesAndTypesList virtuals;
|
2019-07-29 13:50:13 +00:00
|
|
|
};
|
2019-07-30 12:15:02 +00:00
|
|
|
|
2019-07-29 13:50:13 +00:00
|
|
|
}
|