mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
fix tests
This commit is contained in:
parent
500a20f30d
commit
4f896d2b07
@ -20,6 +20,7 @@
|
|||||||
#include <AggregateFunctions/parseAggregateFunctionParameters.h>
|
#include <AggregateFunctions/parseAggregateFunctionParameters.h>
|
||||||
|
|
||||||
#include <Interpreters/Context.h>
|
#include <Interpreters/Context.h>
|
||||||
|
#include <Interpreters/evaluateConstantExpression.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
@ -410,6 +411,35 @@ static StoragePtr create(const StorageFactory::Arguments & args)
|
|||||||
throw Exception(msg, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
throw Exception(msg, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_extended_storage_def)
|
||||||
|
{
|
||||||
|
/// Allow expressions in engine arguments.
|
||||||
|
/// In new syntax argument can be literal or identifier or array/tuple of identifiers.
|
||||||
|
size_t arg_idx = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (; arg_idx < engine_args.size(); ++arg_idx)
|
||||||
|
{
|
||||||
|
auto & arg = engine_args[arg_idx];
|
||||||
|
auto * arg_func = arg->as<ASTFunction>();
|
||||||
|
if (!arg_func)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/// If we got ASTFunction, let's evaluate it and replace with ASTLiteral.
|
||||||
|
/// Do not try evaluate array or tuple, because it's array or tuple of column identifiers.
|
||||||
|
if (arg_func->name == "array" || arg_func->name == "tuple")
|
||||||
|
continue;
|
||||||
|
Field value = evaluateConstantExpression(arg, args.local_context).first;
|
||||||
|
arg = std::make_shared<ASTLiteral>(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception & e)
|
||||||
|
{
|
||||||
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Cannot evaluate engine argument {}: {} {}",
|
||||||
|
arg_idx, e.message(), getMergeTreeVerboseHelp(is_extended_storage_def));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// For Replicated.
|
/// For Replicated.
|
||||||
String zookeeper_path;
|
String zookeeper_path;
|
||||||
String replica_name;
|
String replica_name;
|
||||||
|
@ -4,13 +4,13 @@ DROP TABLE IF EXISTS part_header_r2;
|
|||||||
SET replication_alter_partitions_sync = 2;
|
SET replication_alter_partitions_sync = 2;
|
||||||
|
|
||||||
CREATE TABLE part_header_r1(x UInt32, y UInt32)
|
CREATE TABLE part_header_r1(x UInt32, y UInt32)
|
||||||
ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00814/part_header/{shard}', '1{replica}') ORDER BY x
|
ENGINE ReplicatedMergeTree('/clickhouse/tables/'||currentDatabase()||'/test_00814/part_header/{shard}', '1{replica}') ORDER BY x
|
||||||
SETTINGS use_minimalistic_part_header_in_zookeeper = 0,
|
SETTINGS use_minimalistic_part_header_in_zookeeper = 0,
|
||||||
old_parts_lifetime = 1,
|
old_parts_lifetime = 1,
|
||||||
cleanup_delay_period = 0,
|
cleanup_delay_period = 0,
|
||||||
cleanup_delay_period_random_add = 0;
|
cleanup_delay_period_random_add = 0;
|
||||||
CREATE TABLE part_header_r2(x UInt32, y UInt32)
|
CREATE TABLE part_header_r2(x UInt32, y UInt32)
|
||||||
ENGINE ReplicatedMergeTree('/clickhouse/tables/test_00814/part_header/{shard}', '2{replica}') ORDER BY x
|
ENGINE ReplicatedMergeTree('/clickhouse/tables/'||currentDatabase()||'/test_00814/part_header/{shard}', '2{replica}') ORDER BY x
|
||||||
SETTINGS use_minimalistic_part_header_in_zookeeper = 1,
|
SETTINGS use_minimalistic_part_header_in_zookeeper = 1,
|
||||||
old_parts_lifetime = 1,
|
old_parts_lifetime = 1,
|
||||||
cleanup_delay_period = 0,
|
cleanup_delay_period = 0,
|
||||||
@ -39,10 +39,10 @@ SELECT sleep(3) FORMAT Null;
|
|||||||
SELECT '*** Test part removal ***';
|
SELECT '*** Test part removal ***';
|
||||||
SELECT '*** replica 1 ***';
|
SELECT '*** replica 1 ***';
|
||||||
SELECT name FROM system.parts WHERE active AND database = currentDatabase() AND table = 'part_header_r1';
|
SELECT name FROM system.parts WHERE active AND database = currentDatabase() AND table = 'part_header_r1';
|
||||||
SELECT name FROM system.zookeeper WHERE path = '/clickhouse/tables/test_00814/part_header/s1/replicas/1r1/parts';
|
SELECT name FROM system.zookeeper WHERE path = '/clickhouse/tables/'||currentDatabase()||'/test_00814/part_header/s1/replicas/1r1/parts';
|
||||||
SELECT '*** replica 2 ***';
|
SELECT '*** replica 2 ***';
|
||||||
SELECT name FROM system.parts WHERE active AND database = currentDatabase() AND table = 'part_header_r2';
|
SELECT name FROM system.parts WHERE active AND database = currentDatabase() AND table = 'part_header_r2';
|
||||||
SELECT name FROM system.zookeeper WHERE path = '/clickhouse/tables/test_00814/part_header/s1/replicas/1r1/parts';
|
SELECT name FROM system.zookeeper WHERE path = '/clickhouse/tables/'||currentDatabase()||'/test_00814/part_header/s1/replicas/1r1/parts';
|
||||||
|
|
||||||
SELECT '*** Test ALTER ***';
|
SELECT '*** Test ALTER ***';
|
||||||
ALTER TABLE part_header_r1 MODIFY COLUMN y String;
|
ALTER TABLE part_header_r1 MODIFY COLUMN y String;
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
10
|
10
|
||||||
10
|
10
|
||||||
24
|
24
|
||||||
CREATE TABLE default.replicated_mutations_empty_partitions\n(\n `key` UInt64,\n `value` UInt64\n)\nENGINE = ReplicatedMergeTree(\'/clickhouse/test/01586_replicated_mutations_empty_partitions/{shard}\', \'{replica}\')\nPARTITION BY key\nORDER BY key\nSETTINGS index_granularity = 8192
|
CREATE TABLE default.replicated_mutations_empty_partitions\n(\n `key` UInt64,\n `value` UInt64\n)\nENGINE = ReplicatedMergeTree(\'/clickhouse/test/default/01586_replicated_mutations_empty_partitions/{shard}\', \'{replica}\')\nPARTITION BY key\nORDER BY key\nSETTINGS index_granularity = 8192
|
||||||
|
@ -5,7 +5,7 @@ CREATE TABLE replicated_mutations_empty_partitions
|
|||||||
key UInt64,
|
key UInt64,
|
||||||
value String
|
value String
|
||||||
)
|
)
|
||||||
ENGINE = ReplicatedMergeTree('/clickhouse/test/01586_replicated_mutations_empty_partitions/{shard}', '{replica}')
|
ENGINE = ReplicatedMergeTree('/clickhouse/test/'||currentDatabase()||'/01586_replicated_mutations_empty_partitions/{shard}', '{replica}')
|
||||||
ORDER BY key
|
ORDER BY key
|
||||||
PARTITION by key;
|
PARTITION by key;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ INSERT INTO replicated_mutations_empty_partitions SELECT number, toString(number
|
|||||||
|
|
||||||
SELECT count(distinct value) FROM replicated_mutations_empty_partitions;
|
SELECT count(distinct value) FROM replicated_mutations_empty_partitions;
|
||||||
|
|
||||||
SELECT count() FROM system.zookeeper WHERE path = '/clickhouse/test/01586_replicated_mutations_empty_partitions/s1/block_numbers';
|
SELECT count() FROM system.zookeeper WHERE path = '/clickhouse/test/'||currentDatabase()||'/01586_replicated_mutations_empty_partitions/s1/block_numbers';
|
||||||
|
|
||||||
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '3';
|
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '3';
|
||||||
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '4';
|
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '4';
|
||||||
@ -21,7 +21,7 @@ ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '5';
|
|||||||
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '9';
|
ALTER TABLE replicated_mutations_empty_partitions DROP PARTITION '9';
|
||||||
|
|
||||||
-- still ten records
|
-- still ten records
|
||||||
SELECT count() FROM system.zookeeper WHERE path = '/clickhouse/test/01586_replicated_mutations_empty_partitions/s1/block_numbers';
|
SELECT count() FROM system.zookeeper WHERE path = '/clickhouse/test/'||currentDatabase()||'/01586_replicated_mutations_empty_partitions/s1/block_numbers';
|
||||||
|
|
||||||
ALTER TABLE replicated_mutations_empty_partitions MODIFY COLUMN value UInt64 SETTINGS replication_alter_partitions_sync=2;
|
ALTER TABLE replicated_mutations_empty_partitions MODIFY COLUMN value UInt64 SETTINGS replication_alter_partitions_sync=2;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user