提交 7103157b 编写于 作者: V Vitaliy Lyudvichenko

Added simple test for groupUniqArray(String). [#METR-22071]

Also reverted Benchmark.cpp it will be added in separate PR.
上级 80f037b1
......@@ -8,7 +8,6 @@
#include <fstream>
#include <iomanip>
#include <random>
#include <limits.h>
#include <Poco/File.h>
#include <Poco/Util/Application.h>
......@@ -59,11 +58,11 @@ public:
Benchmark(unsigned concurrency_, double delay_,
const String & host_, UInt16 port_, const String & default_database_,
const String & user_, const String & password_, const String & stage,
bool randomize_, size_t num_repetions_, double max_time_,
bool randomize_,
const Settings & settings_)
: concurrency(concurrency_), delay(delay_), queue(concurrency),
connections(concurrency, host_, port_, default_database_, user_, password_),
randomize(randomize_), num_repetions(num_repetions_), max_time(max_time_),
randomize(randomize_),
settings(settings_), pool(concurrency)
{
std::cerr << std::fixed << std::setprecision(3);
......@@ -95,8 +94,6 @@ private:
ConnectionPool connections;
bool randomize;
size_t num_repetions;
double max_time;
Settings settings;
QueryProcessingStage::Enum query_processing_stage;
......@@ -186,7 +183,7 @@ private:
Stopwatch watch;
/// В цикле, кладём все запросы в очередь.
for (size_t i = 0; !interrupt_listener.check() && (!(num_repetions > 0) || i < num_repetions); ++i)
for (size_t i = 0; !interrupt_listener.check(); ++i)
{
if (i >= queries.size())
i = 0;
......@@ -197,7 +194,7 @@ private:
queue.push(queries[query_index]);
if (delay > 0 && watch.elapsedSeconds() > delay)
if (watch.elapsedSeconds() > delay)
{
auto total_queries = 0;
{
......@@ -209,18 +206,6 @@ private:
report(info_per_interval);
watch.restart();
}
if (num_repetions > 0 && info_total.queries >= num_repetions)
{
std::cout << "The execution is broken since request number of loops is reached\n";
break;
}
if (max_time > 0 && info_total.watch.elapsedSeconds() >= max_time)
{
std::cout << "The execution is broken since requested time limit is reached\n";
break;
}
}
/// Попросим потоки завершиться.
......@@ -361,15 +346,13 @@ int main(int argc, char ** argv)
desc.add_options()
("help", "produce help message")
("concurrency,c", boost::program_options::value<unsigned>()->default_value(1), "number of parallel queries")
("delay,d", boost::program_options::value<double>()->default_value(1), "delay between reports in seconds (set 0 to disable)")
("delay,d", boost::program_options::value<double>()->default_value(1), "delay between reports in seconds")
("host,h", boost::program_options::value<std::string>()->default_value("localhost"), "")
("port", boost::program_options::value<UInt16>()->default_value(9000), "")
("user", boost::program_options::value<std::string>()->default_value("default"), "")
("password", boost::program_options::value<std::string>()->default_value(""), "")
("database", boost::program_options::value<std::string>()->default_value("default"), "")
("stage", boost::program_options::value<std::string>()->default_value("complete"), "request query processing up to specified stage")
("loops,l", boost::program_options::value<size_t>()->default_value(0), "number of tests repetions")
("timelimit,t", boost::program_options::value<double>()->default_value(0.), "stop repeating after specified time limit")
("randomize,r", boost::program_options::value<bool>()->default_value(false), "randomize order of execution")
#define DECLARE_SETTING(TYPE, NAME, DEFAULT) (#NAME, boost::program_options::value<std::string> (), "Settings.h")
#define DECLARE_LIMIT(TYPE, NAME, DEFAULT) (#NAME, boost::program_options::value<std::string> (), "Limits.h")
......@@ -409,8 +392,6 @@ int main(int argc, char ** argv)
options["password"].as<std::string>(),
options["stage"].as<std::string>(),
options["randomize"].as<bool>(),
options["loops"].as<size_t>(),
options["timelimit"].as<double>(),
settings);
}
catch (const Exception & e)
......
DROP TABLE IF EXISTS test.group_uniq;
CREATE TABLE test.group_uniq ENGINE = Memory AS SELECT number % 10 as id, toString(intDiv((number%10000), 10)) as v FROM system.numbers LIMIT 10000000;
INSERT INTO test.group_uniq SELECT 2 as id, toString(number % 100) as v FROM system.numbers LIMIT 1000000;
INSERT INTO test.group_uniq SELECT 5 as id, toString(number % 100) as v FROM system.numbers LIMIT 10000000;
SELECT length(groupUniqArray(v)) FROM test.group_uniq GROUP BY id ORDER BY id;
--SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{1,2,3,4}', 'test', 'group_uniq') GROUP BY id ORDER BY id;
DROP TABLE IF EXISTS test.group_uniq;
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册