Fix segfault and add tabs to ton of tests (desc table)

This commit is contained in:
alesapin 2018-12-25 14:33:54 +03:00
parent c91687f9d7
commit 1228645a79
13 changed files with 145 additions and 143 deletions

View File

@ -291,11 +291,12 @@ static ColumnsDeclarationAndModifiers parseColumns(const ASTExpressionList & col
auto new_columns = Nested::flattenWithMapping(columns, mapping);
for (const auto & [old_name, new_names] : mapping)
{
if (new_names.size() == 1 && old_name == new_names.back())
auto codec_it = codecs.find(old_name);
if ((new_names.size() == 1 && old_name == new_names.back()) || codec_it == codecs.end())
continue;
auto codec = codecs[old_name];
codecs.erase(old_name);
auto codec = codec_it->second;
codecs.erase(codec_it);
for (const auto & new_name : new_names)
codecs.emplace(new_name, codec);
}

View File

@ -214,17 +214,18 @@ void parseColumn(ReadBufferFromString & buf, ColumnsDescription & result, const
result.defaults.emplace(column_name, std::move(*column_default));
}
auto comment = parseComment(buf);
if (!comment.empty())
{
result.comments.emplace(column_name, std::move(comment));
}
auto codec = parseCodec(buf);
if (codec)
{
result.codecs.emplace(column_name, std::move(codec));
}
auto comment = parseComment(buf);
if (!comment.empty())
{
result.comments.emplace(column_name, std::move(comment));
}
assertChar('\n', buf);
}

View File

@ -1,27 +1,27 @@
CounterID UInt32
StartDate Date
UserID UInt32
VisitID UInt32
NestedColumn.A Array(UInt8)
NestedColumn.S Array(String)
ToDrop UInt32
Added0 UInt32
Added1 UInt32
Added2 UInt32
AddedNested1.A Array(UInt32)
AddedNested1.B Array(UInt64)
AddedNested1.C Array(String)
AddedNested2.A Array(UInt32)
AddedNested2.B Array(UInt64)
CounterID UInt32
StartDate Date
UserID UInt32
VisitID UInt32
Added0 String
Added1 UInt32
Added2 UInt32
AddedNested1.A Array(UInt32)
AddedNested1.C Array(String)
AddedNested2.A Array(UInt32)
AddedNested2.B Array(UInt64)
CounterID UInt32
StartDate Date
UserID UInt32
VisitID UInt32
NestedColumn.A Array(UInt8)
NestedColumn.S Array(String)
ToDrop UInt32
Added0 UInt32
Added1 UInt32
Added2 UInt32
AddedNested1.A Array(UInt32)
AddedNested1.B Array(UInt64)
AddedNested1.C Array(String)
AddedNested2.A Array(UInt32)
AddedNested2.B Array(UInt64)
CounterID UInt32
StartDate Date
UserID UInt32
VisitID UInt32
Added0 String
Added1 UInt32
Added2 UInt32
AddedNested1.A Array(UInt32)
AddedNested1.C Array(String)
AddedNested2.A Array(UInt32)
AddedNested2.B Array(UInt64)
1 2014-01-01 2 3 0 0 [] [] [] []

View File

@ -1,56 +1,56 @@
d Date
k UInt64
i32 Int32
d Date
k UInt64
i32 Int32
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32) ENGINE = MergeTree(d, k, 8192)
2015-01-01 10 42
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, `n.ui8` Array(UInt8), `n.s` Array(String)) ENGINE = MergeTree(d, k, 8192)
2015-01-01 8 40 [1,2,3] ['12','13','14']
2015-01-01 10 42 [] []
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
n.d Array(Date)
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
n.d Array(Date)
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, `n.ui8` Array(UInt8), `n.s` Array(String), `n.d` Array(Date)) ENGINE = MergeTree(d, k, 8192)
2015-01-01 7 39 [10,20,30] ['120','130','140'] ['2000-01-01','2000-01-01','2000-01-03']
2015-01-01 8 40 [1,2,3] ['12','13','14'] ['0000-00-00','0000-00-00','0000-00-00']
2015-01-01 10 42 [] [] []
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
n.d Array(Date)
s String DEFAULT \'0\'
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
n.d Array(Date)
s String DEFAULT \'0\'
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, `n.ui8` Array(UInt8), `n.s` Array(String), `n.d` Array(Date), s String DEFAULT \'0\') ENGINE = MergeTree(d, k, 8192)
2015-01-01 6 38 [10,20,30] ['asd','qwe','qwe'] ['2000-01-01','2000-01-01','2000-01-03'] 100500
2015-01-01 7 39 [10,20,30] ['120','130','140'] ['2000-01-01','2000-01-01','2000-01-03'] 0
2015-01-01 8 40 [1,2,3] ['12','13','14'] ['0000-00-00','0000-00-00','0000-00-00'] 0
2015-01-01 10 42 [] [] [] 0
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
s Int64
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
s Int64
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, `n.ui8` Array(UInt8), `n.s` Array(String), s Int64) ENGINE = MergeTree(d, k, 8192)
2015-01-01 6 38 [10,20,30] ['asd','qwe','qwe'] 100500
2015-01-01 7 39 [10,20,30] ['120','130','140'] 0
2015-01-01 8 40 [1,2,3] ['12','13','14'] 0
2015-01-01 10 42 [] [] 0
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
s UInt32
n.d Array(Date)
d Date
k UInt64
i32 Int32
n.ui8 Array(UInt8)
n.s Array(String)
s UInt32
n.d Array(Date)
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, `n.ui8` Array(UInt8), `n.s` Array(String), s UInt32, `n.d` Array(Date)) ENGINE = MergeTree(d, k, 8192)
2015-01-01 6 38 [10,20,30] ['asd','qwe','qwe'] 100500 ['0000-00-00','0000-00-00','0000-00-00']
2015-01-01 7 39 [10,20,30] ['120','130','140'] 0 ['0000-00-00','0000-00-00','0000-00-00']
@ -60,40 +60,40 @@ CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, `n.ui8` Array(UInt8),
2015-01-01 7 39 [10,20,30] ['120','130','140'] 0 ['0000-00-00','0000-00-00','0000-00-00']
2015-01-01 8 40 [1,2,3] ['12','13','14'] 0 ['0000-00-00','0000-00-00','0000-00-00']
2015-01-01 10 42 [] [] 0 []
d Date
k UInt64
i32 Int32
n.s Array(String)
s UInt32
d Date
k UInt64
i32 Int32
n.s Array(String)
s UInt32
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, `n.s` Array(String), s UInt32) ENGINE = MergeTree(d, k, 8192)
2015-01-01 6 38 ['asd','qwe','qwe'] 100500
2015-01-01 7 39 ['120','130','140'] 0
2015-01-01 8 40 ['12','13','14'] 0
2015-01-01 10 42 [] 0
d Date
k UInt64
i32 Int32
s UInt32
d Date
k UInt64
i32 Int32
s UInt32
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, s UInt32) ENGINE = MergeTree(d, k, 8192)
2015-01-01 6 38 100500
2015-01-01 7 39 0
2015-01-01 8 40 0
2015-01-01 10 42 0
d Date
k UInt64
i32 Int32
s UInt32
n.s Array(String)
n.d Array(Date)
d Date
k UInt64
i32 Int32
s UInt32
n.s Array(String)
n.d Array(Date)
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, s UInt32, `n.s` Array(String), `n.d` Array(Date)) ENGINE = MergeTree(d, k, 8192)
2015-01-01 6 38 100500 [] []
2015-01-01 7 39 0 [] []
2015-01-01 8 40 0 [] []
2015-01-01 10 42 0 [] []
d Date
k UInt64
i32 Int32
s UInt32
d Date
k UInt64
i32 Int32
s UInt32
CREATE TABLE test.alter ( d Date, k UInt64, i32 Int32, s UInt32) ENGINE = MergeTree(d, k, 8192)
2015-01-01 6 38 100500
2015-01-01 7 39 0

View File

@ -1,42 +1,42 @@
col1 UInt8 DEFAULT 0
col1 UInt32
col2 UInt64 DEFAULT col1 + 1
col3 UInt64 MATERIALIZED col1 + 2
col4 UInt64 ALIAS col1 + 3
col1 UInt8 DEFAULT 0
col1 UInt32
col2 UInt64 DEFAULT col1 + 1
col3 UInt64 MATERIALIZED col1 + 2
col4 UInt64 ALIAS col1 + 3
10 11
12 13
99
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
hello clickhouse
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload_length UInt64 MATERIALIZED length(payload)
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload_length UInt64 MATERIALIZED length(payload)
hello clickhouse 16
hello clickhouse 16
some string 11
hello clickhouse 16
some string 11
payload String
payload_length UInt64 DEFAULT length(payload)
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload String
payload_length UInt64 DEFAULT length(payload)
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
hello clickhouse 16
some string 11
payload String
payload_length UInt16 DEFAULT length(payload) % 65535
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload String
payload_length UInt16 DEFAULT length(payload) % 65535
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
hello clickhouse 16
some string 11
payload String
payload_length UInt16 DEFAULT CAST(length(payload), \'UInt16\')
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload String
payload_length UInt16 DEFAULT CAST(length(payload), \'UInt16\')
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
payload String
date Date MATERIALIZED today()
key UInt64 MATERIALIZED 0 * rand()
hello clickhouse
some string

View File

@ -1,9 +1,9 @@
EventDate Date
UTCEventTime DateTime
MoscowEventDate Date DEFAULT toDate(UTCEventTime)
EventDate Date
UTCEventTime DateTime
MoscowEventDate Date DEFAULT toDate(UTCEventTime)
EventDate Date
UTCEventTime DateTime
MoscowEventDate Date DEFAULT toDate(UTCEventTime)
EventDate Date
UTCEventTime DateTime
MoscowEventDate Date DEFAULT toDate(UTCEventTime)
2015-06-09 2015-06-09 01:02:03 2015-06-09
2015-06-09 2015-06-09 01:02:03 2015-06-09
2015-06-09 2015-06-09 01:02:03 2015-06-09

View File

@ -6,7 +6,7 @@ performing test: union_all
performing test: bad_union_all
query failed
performing test: describe_table
dummy UInt8
dummy UInt8
performing test: clickhouse-local
2 3
performing test: http

View File

@ -1,3 +1,3 @@
x UInt8
x Int64 DEFAULT toInt64(y)
y String
x UInt8
x Int64 DEFAULT toInt64(y)
y String

View File

@ -8,6 +8,6 @@ hello
hello
1970-01-01 00:00:01
CREATE TABLE test.cast ( x UInt8, e Enum8('hello' = 1, 'world' = 2) DEFAULT CAST(x, 'Enum8(\'hello\' = 1, \'world\' = 2)')) ENGINE = MergeTree ORDER BY e SETTINGS index_granularity = 8192
x UInt8
e Enum8(\'hello\' = 1, \'world\' = 2) DEFAULT CAST(x, \'Enum8(\\\'hello\\\' = 1, \\\'world\\\' = 2)\')
x UInt8
e Enum8(\'hello\' = 1, \'world\' = 2) DEFAULT CAST(x, \'Enum8(\\\'hello\\\' = 1, \\\'world\\\' = 2)\')
1 hello

View File

@ -1,9 +1,9 @@
a Decimal(9, 4) DEFAULT CAST(0, \'Decimal(9, 4)\')
b Decimal(18, 4) DEFAULT CAST(a / 2, \'Decimal(18, 4)\')
c Decimal(38, 4) DEFAULT CAST(b / 3, \'Decimal(38, 4)\')
d Decimal(9, 4) MATERIALIZED a + toDecimal32(\'0.2\', 1)
e Decimal(18, 4) ALIAS b * 2
f Decimal(38, 4) ALIAS c * 6
a Decimal(9, 4) DEFAULT CAST(0, \'Decimal(9, 4)\')
b Decimal(18, 4) DEFAULT CAST(a / 2, \'Decimal(18, 4)\')
c Decimal(38, 4) DEFAULT CAST(b / 3, \'Decimal(38, 4)\')
d Decimal(9, 4) MATERIALIZED a + toDecimal32(\'0.2\', 1)
e Decimal(18, 4) ALIAS b * 2
f Decimal(38, 4) ALIAS c * 6
0.0000 0.0000 0.0000
1.0000 0.5000 0.1666
2.0000 1.0000 0.3333

View File

@ -1,9 +1,9 @@
CREATE TABLE test.check_query_comment_column ( first_column UInt8 DEFAULT 1 COMMENT \'comment 1\', fourth_column UInt8 COMMENT \'comment 4\', fifth_column UInt8, second_column UInt8 MATERIALIZED first_column COMMENT \'comment 2\', third_column UInt8 ALIAS second_column COMMENT \'comment 3\') ENGINE = TinyLog
first_column UInt8 DEFAULT 1 comment 1
fourth_column UInt8 comment 4
fifth_column UInt8
second_column UInt8 MATERIALIZED first_column comment 2
third_column UInt8 ALIAS second_column comment 3
first_column UInt8 DEFAULT 1 comment 1
fourth_column UInt8 comment 4
fifth_column UInt8
second_column UInt8 MATERIALIZED first_column comment 2
third_column UInt8 ALIAS second_column comment 3
┌─table──────────────────────┬─name──────────┬─comment───┐
│ check_query_comment_column │ first_column │ comment 1 │
│ check_query_comment_column │ fourth_column │ comment 4 │
@ -21,9 +21,9 @@ CREATE TABLE test.check_query_comment_column ( first_column UInt8 DEFAULT 1 COMM
└────────────────────────────┴───────────────┴─────────────┘
CREATE TABLE test.check_query_comment_column ( first_column UInt8 DEFAULT 1 COMMENT \'comment 1_2\', fourth_column UInt8 COMMENT \'comment 4_2\', fifth_column UInt8 COMMENT \'comment 5_2\', second_column UInt8 MATERIALIZED first_column COMMENT \'comment 2_2\', third_column UInt8 ALIAS second_column COMMENT \'comment 3_2\') ENGINE = TinyLog
CREATE TABLE test.check_query_comment_column ( first_column UInt8 COMMENT \'comment 1\', second_column UInt8 COMMENT \'comment 2\', third_column UInt8 COMMENT \'comment 3\') ENGINE = MergeTree() PARTITION BY second_column ORDER BY first_column SAMPLE BY first_column SETTINGS index_granularity = 8192
first_column UInt8 comment 1
second_column UInt8 comment 2
third_column UInt8 comment 3
first_column UInt8 comment 1
second_column UInt8 comment 2
third_column UInt8 comment 3
┌─table──────────────────────┬─name──────────┬─comment───┐
│ check_query_comment_column │ first_column │ comment 1 │
│ check_query_comment_column │ second_column │ comment 2 │

View File

@ -1,4 +1,4 @@
CREATE TABLE test.check_comments ( column_name1 UInt8 DEFAULT 1 COMMENT \'comment\') ENGINE = ReplicatedMergeTree(\'clickhouse/tables/test_comments\', \'r1\') ORDER BY column_name1 SETTINGS index_granularity = 8192
column_name1 UInt8 DEFAULT 1 comment
column_name1 UInt8 DEFAULT 1 comment
CREATE TABLE test.check_comments ( column_name1 UInt8 DEFAULT 1 COMMENT \'another comment\') ENGINE = ReplicatedMergeTree(\'clickhouse/tables/test_comments\', \'r1\') ORDER BY column_name1 SETTINGS index_granularity = 8192
column_name1 UInt8 DEFAULT 1 another comment
column_name1 UInt8 DEFAULT 1 another comment