diff options
author | aidarsamer <aidarsamer@ydb.tech> | 2022-11-17 15:31:35 +0300 |
---|---|---|
committer | aidarsamer <aidarsamer@ydb.tech> | 2022-11-17 15:31:35 +0300 |
commit | 112fc78512fcf54918cf0805b8a61fa9391cd84d (patch) | |
tree | 1dbb953f1dfb18a4c04286c3acf9c4c729e26b9e | |
parent | 2ea084bfc239ef31c3483557bcccd2871b59dc42 (diff) | |
download | ydb-112fc78512fcf54918cf0805b8a61fa9391cd84d.tar.gz |
Add store option for clickbench workload. It allows to choose between row and column types of storage.
Add store option to clickbench workload.
This option allows to choose between row and column type of storage.
-rw-r--r-- | ydb/public/lib/ydb_cli/commands/click_bench.cpp | 22 | ||||
-rw-r--r-- | ydb/public/lib/ydb_cli/commands/click_bench.h | 1 | ||||
-rw-r--r-- | ydb/public/lib/ydb_cli/commands/click_bench_schema.sql | 8 |
3 files changed, 27 insertions, 4 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/click_bench.cpp b/ydb/public/lib/ydb_cli/commands/click_bench.cpp index 26b94e57e30..6b99dd2f83b 100644 --- a/ydb/public/lib/ydb_cli/commands/click_bench.cpp +++ b/ydb/public/lib/ydb_cli/commands/click_bench.cpp @@ -321,20 +321,38 @@ void TClickBenchCommandInit::Config(TConfig& config) { } Table = arg; }); + config.Opts->AddLongOption("store", "Storage type." + " Options: row, column\n" + "row - use row-based storage engine;\n" + "column - use column-based storage engine.") + .DefaultValue("column").StoreResult(&StoreType); }; int TClickBenchCommandInit::Run(TConfig& config) { + StoreType = to_lower(StoreType); + TString partitionBy = ""; + TString storageType = ""; + if (StoreType == "column") { + partitionBy = "PARTITION BY HASH(CounterID)"; + storageType = "STORE = COLUMN,"; + } else if (StoreType != "row") { + throw yexception() << "Incorrect storage type. Available options: \"row\", \"column\"." << Endl; + } + auto driver = CreateDriver(config); TString createSql = NResource::Find("click_bench_schema.sql"); TTableClient client(driver); SubstGlobal(createSql, "{table}", FullTablePath(config.Database, Table)); + SubstGlobal(createSql, "{partition}", partitionBy); + SubstGlobal(createSql, "{store}", storageType); + ThrowOnError(client.RetryOperationSync([createSql](TSession session) { return session.ExecuteSchemeQuery(createSql).GetValueSync(); })); - Cout << "Table created" << Endl; + Cout << "Table created." << Endl; driver.Stop(true); return 0; }; @@ -467,7 +485,7 @@ int TClickBenchCommandRun::Run(TConfig& config) { }; TCommandClickBench::TCommandClickBench() - : TClientCommandTree("clickbench") + : TClientCommandTree("clickbench", {}, "ClickBench workload (ClickHouse OLAP test)") { AddCommand(std::make_unique<TClickBenchCommandRun>()); AddCommand(std::make_unique<TClickBenchCommandInit>()); diff --git a/ydb/public/lib/ydb_cli/commands/click_bench.h b/ydb/public/lib/ydb_cli/commands/click_bench.h index a0d76489076..f3bbc298494 100644 --- a/ydb/public/lib/ydb_cli/commands/click_bench.h +++ b/ydb/public/lib/ydb_cli/commands/click_bench.h @@ -14,6 +14,7 @@ public: private: TString Table; + TString StoreType; }; class TClickBenchCommandClean : public NYdb::NConsoleClient::TYdbCommand { diff --git a/ydb/public/lib/ydb_cli/commands/click_bench_schema.sql b/ydb/public/lib/ydb_cli/commands/click_bench_schema.sql index 14d9d9c1e65..64e0afe5a4d 100644 --- a/ydb/public/lib/ydb_cli/commands/click_bench_schema.sql +++ b/ydb/public/lib/ydb_cli/commands/click_bench_schema.sql @@ -107,6 +107,10 @@ CREATE TABLE `{table}` URLHash Int64, CLID Int64, PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) -) WITH ( - AUTO_PARTITIONING_BY_SIZE = ENABLED +) +{partition} +WITH ( + {store} + AUTO_PARTITIONING_BY_SIZE = ENABLED, + AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 128 ); |