mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #48517 from CurtizJ/fix-memory-compressed-tables
Fix storage `Memory` with enabled compression
This commit is contained in:
commit
5f01b8a2b5
@ -15,23 +15,18 @@ ColumnPtr tryGetColumnFromBlock(const Block & block, const NameAndTypePair & req
|
||||
if (!elem)
|
||||
return nullptr;
|
||||
|
||||
DataTypePtr elem_type;
|
||||
ColumnPtr elem_column;
|
||||
auto elem_type = elem->type;
|
||||
auto elem_column = elem->column->decompress();
|
||||
|
||||
if (requested_column.isSubcolumn())
|
||||
{
|
||||
auto subcolumn_name = requested_column.getSubcolumnName();
|
||||
elem_type = elem->type->tryGetSubcolumnType(subcolumn_name);
|
||||
elem_column = elem->type->tryGetSubcolumn(subcolumn_name, elem->column);
|
||||
elem_column = elem_type->tryGetSubcolumn(subcolumn_name, elem_column);
|
||||
elem_type = elem_type->tryGetSubcolumnType(subcolumn_name);
|
||||
|
||||
if (!elem_type || !elem_column)
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
elem_type = elem->type;
|
||||
elem_column = elem->column;
|
||||
}
|
||||
|
||||
return castColumn({elem_column, elem_type, ""}, requested_column.type);
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
1 foo ['0','1','2','3','4'] {'k1':'v1'}
|
||||
2 bar ['0','1','2','3','4'] {'k2':'v2'}
|
@ -0,0 +1,11 @@
|
||||
DROP TABLE IF EXISTS t_memory_compressed;
|
||||
|
||||
CREATE TABLE t_memory_compressed (id UInt64, s String, arr Array(LowCardinality(String)), m Map(String, String))
|
||||
ENGINE = Memory SETTINGS compress = 1;
|
||||
|
||||
INSERT INTO t_memory_compressed VALUES (1, 'foo', range(5), map('k1', 'v1'));
|
||||
INSERT INTO t_memory_compressed VALUES (2, 'bar', range(5), map('k2', 'v2'));
|
||||
|
||||
SELECT * FROM t_memory_compressed ORDER BY id;
|
||||
|
||||
DROP TABLE t_memory_compressed;
|
Loading…
Reference in New Issue
Block a user