mirror of https://github.com/ByConity/ByConity
Fix SummingMergeTree argument checking logic.
This patch fixes the Nested Column Name checking logic, which allows nested columns be explicitly specified in SummingMergeTree engine.
This commit is contained in:
parent
c05dfc201f
commit
f30841d5ab
|
@ -318,7 +318,7 @@ void MergeTreeData::MergingParams::check(const NamesAndTypesList & columns) cons
|
||||||
|
|
||||||
for (const auto & column_to_sum : columns_to_sum)
|
for (const auto & column_to_sum : columns_to_sum)
|
||||||
if (columns.end() == std::find_if(columns.begin(), columns.end(),
|
if (columns.end() == std::find_if(columns.begin(), columns.end(),
|
||||||
[&](const NameAndTypePair & name_and_type) { return column_to_sum == name_and_type.name; }))
|
[&](const NameAndTypePair & name_and_type) { return column_to_sum == DataTypeNested::extractNestedTableName(name_and_type.name); }))
|
||||||
throw Exception("Column " + column_to_sum + " listed in columns to sum does not exist in table declaration.");
|
throw Exception("Column " + column_to_sum + " listed in columns to sum does not exist in table declaration.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,3 +2,7 @@
|
||||||
[1] [250]
|
[1] [250]
|
||||||
[1,2] [250,150]
|
[1,2] [250,150]
|
||||||
[2] [150]
|
[2] [150]
|
||||||
|
20 [1,2] [100,150]
|
||||||
|
20 [1] [250]
|
||||||
|
20 [1,2] [250,150]
|
||||||
|
20 [2] [150]
|
||||||
|
|
|
@ -8,3 +8,14 @@ optimize table test.nested_map;
|
||||||
select `SomeMap.ID`, `SomeMap.Num` from test.nested_map;
|
select `SomeMap.ID`, `SomeMap.Num` from test.nested_map;
|
||||||
|
|
||||||
drop table test.nested_map;
|
drop table test.nested_map;
|
||||||
|
|
||||||
|
drop table if exists test.nested_map_explicit;
|
||||||
|
|
||||||
|
create table test.nested_map_explicit (d default today(), k UInt64, SomeIntExcluded UInt32, SomeMap Nested(ID UInt32, Num Int64)) engine=SummingMergeTree(d, k, 8192, (SomeMap));
|
||||||
|
|
||||||
|
insert into test.nested_map_explicit (k, `SomeIntExcluded`, `SomeMap.ID`, `SomeMap.Num`) values (0, 20, [1],[100]),(1, 20, [1],[100]),(2, 20, [1],[100]),(3, 20, [1,2],[100,150]);
|
||||||
|
insert into test.nested_map_explicit (k, `SomeIntExcluded`, `SomeMap.ID`, `SomeMap.Num`) values (0, 20, [2],[150]),(1, 20, [1],[150]),(2, 20, [1,2],[150,150]),(3, 20, [1],[-100]);
|
||||||
|
optimize table test.nested_map_explicit;
|
||||||
|
select `SomeIntExcluded`, `SomeMap.ID`, `SomeMap.Num` from test.nested_map_explicit;
|
||||||
|
|
||||||
|
drop table test.nested_map_explicit;
|
||||||
|
|
Loading…
Reference in New Issue