mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #28762 from CurtizJ/fix-nested-1
Fix usage of nested columns with non-array columns with the same prefix [2]
This commit is contained in:
commit
0bb74f8eaf
@ -135,10 +135,11 @@ void IMergeTreeReader::fillMissingColumns(Columns & res_columns, bool & should_e
|
||||
|
||||
String offsets_name = Nested::extractTableName(name);
|
||||
auto offset_it = offset_columns.find(offsets_name);
|
||||
if (offset_it != offset_columns.end())
|
||||
const auto * array_type = typeid_cast<const DataTypeArray *>(type.get());
|
||||
if (offset_it != offset_columns.end() && array_type)
|
||||
{
|
||||
const auto & nested_type = array_type->getNestedType();
|
||||
ColumnPtr offsets_column = offset_it->second;
|
||||
DataTypePtr nested_type = typeid_cast<const DataTypeArray &>(*type).getNestedType();
|
||||
size_t nested_rows = typeid_cast<const ColumnUInt64 &>(*offsets_column).getData().back();
|
||||
|
||||
ColumnPtr nested_column =
|
||||
|
@ -0,0 +1,2 @@
|
||||
123 asd [1,2]
|
||||
123 asd [1,2] 0
|
18
tests/queries/0_stateless/02017_columns_with_dot_2.sql
Normal file
18
tests/queries/0_stateless/02017_columns_with_dot_2.sql
Normal file
@ -0,0 +1,18 @@
|
||||
DROP TABLE IF EXISTS test_nested;
|
||||
|
||||
CREATE TABLE test_nested
|
||||
(
|
||||
`id` String,
|
||||
`with_dot.str` String,
|
||||
`with_dot.array` Array(Int32)
|
||||
)
|
||||
ENGINE = MergeTree()
|
||||
ORDER BY id;
|
||||
|
||||
INSERT INTO test_nested VALUES('123', 'asd', [1,2]);
|
||||
SELECT * FROM test_nested;
|
||||
|
||||
ALTER TABLE test_nested ADD COLUMN `with_dot.bool` UInt8;
|
||||
SELECT * FROM test_nested;
|
||||
|
||||
DROP TABLE test_nested;
|
Loading…
Reference in New Issue
Block a user