Fix tests and small bug

This commit is contained in:
alesapin 2020-02-20 12:22:17 +03:00
parent c4972b3799
commit 5282f8b59c
6 changed files with 7 additions and 7 deletions

View File

@ -517,7 +517,7 @@ void AlterCommands::prepare(const StorageInMemoryMetadata & metadata, const Cont
if (!has_column && command.if_exists)
command.ignore = true;
if (has_column)
if (has_column && command.data_type)
{
auto column_from_table = columns.get(command.column_name);
if (!command.default_expression && column_from_table.default_desc.expression)

View File

@ -28,13 +28,13 @@ some string 11
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload_length UInt16 DEFAULT length(payload) % 65535
payload_length UInt64 DEFAULT length(payload) % 65535
hello clickhouse 16
some string 11
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload_length UInt16 DEFAULT CAST(length(payload), \'UInt16\')
payload_length UInt16 DEFAULT length(payload)
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()

View File

@ -20,7 +20,7 @@ create table defaulted (payload String, date materialized today(), key materiali
desc table defaulted;
insert into defaulted (payload) values ('hello clickhouse');
select * from defaulted;
alter table defaulted add column payload_length materialized length(payload);
alter table defaulted add column payload_length UInt64 materialized length(payload);
desc table defaulted;
select *, payload_length from defaulted;
insert into defaulted (payload) values ('some string');

View File

@ -16,7 +16,7 @@ select *, length(arr) as l from prewhere_column_missing;
select *, length(arr) as l from prewhere_column_missing where l = 0;
select *, length(arr) as l from prewhere_column_missing prewhere l = 0;
alter table prewhere_column_missing add column hash_x default intHash64(x);
alter table prewhere_column_missing add column hash_x UInt64 default intHash64(x);
select * from prewhere_column_missing;
select * from prewhere_column_missing where hash_x = intHash64(x);

View File

@ -9,7 +9,7 @@ SYSTEM SYNC REPLICA byte_identical_r2;
-- Add a column with a default expression that will yield different values on different replicas.
-- Call optimize to materialize it. Replicas should compare checksums and restore consistency.
ALTER TABLE byte_identical_r1 ADD COLUMN y DEFAULT rand();
ALTER TABLE byte_identical_r1 ADD COLUMN y UInt64 DEFAULT rand();
OPTIMIZE TABLE byte_identical_r1 PARTITION tuple() FINAL;
SELECT x, t1.y - t2.y FROM byte_identical_r1 t1 SEMI LEFT JOIN byte_identical_r2 t2 USING x ORDER BY x;

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS add_materialized_column_after;
CREATE TABLE add_materialized_column_after (x UInt32, z UInt64) ENGINE MergeTree ORDER BY x;
ALTER TABLE add_materialized_column_after ADD COLUMN y MATERIALIZED toString(x) AFTER x;
ALTER TABLE add_materialized_column_after ADD COLUMN y String MATERIALIZED toString(x) AFTER x;
DESC TABLE add_materialized_column_after;