fix reading of columns of type Tuple(Map(LowCardinality(...)))

This commit is contained in:
Anton Popov 2024-05-16 12:40:44 +00:00
parent 7aeeaabf3d
commit bb130f429e
3 changed files with 47 additions and 1 deletions

View File

@ -515,8 +515,14 @@ void SerializationLowCardinality::deserializeBinaryBulkWithMultipleStreams(
size_t limit,
DeserializeBinaryBulkSettings & settings,
DeserializeBinaryBulkStatePtr & state,
SubstreamsCache * /* cache */) const
SubstreamsCache * cache) const
{
if (auto cached_column = getFromSubstreamsCache(cache, settings.path))
{
column = cached_column;
return;
}
auto mutable_column = column->assumeMutable();
ColumnLowCardinality & low_cardinality_column = typeid_cast<ColumnLowCardinality &>(*mutable_column);
@ -670,6 +676,7 @@ void SerializationLowCardinality::deserializeBinaryBulkWithMultipleStreams(
}
column = std::move(mutable_column);
addToSubstreamsCache(cache, settings.path, column);
}
void SerializationLowCardinality::serializeBinary(const Field & field, WriteBuffer & ostr, const FormatSettings & settings) const

View File

@ -0,0 +1,6 @@
100000
100000
100000
100000
100000
100000

View File

@ -0,0 +1,33 @@
DROP TABLE IF EXISTS t_map_lc;
CREATE TABLE t_map_lc
(
id UInt64,
t Tuple(m Map(LowCardinality(String), LowCardinality(String)))
)
ENGINE = MergeTree ORDER BY id SETTINGS min_bytes_for_wide_part = 0;
INSERT INTO t_map_lc SELECT * FROM generateRandom('id UInt64, t Tuple(m Map(LowCardinality(String), LowCardinality(String)))') LIMIT 100000;
SELECT count(), FROM t_map_lc WHERE NOT ignore(*, mapKeys(t.m));
SELECT count(), FROM t_map_lc WHERE NOT ignore(*, t.m.keys);
SELECT count(), FROM t_map_lc WHERE NOT ignore(*, t.m.values);
SELECT * FROM t_map_lc WHERE mapContains(t.m, 'not_existing_key_1337');
DROP TABLE t_map_lc;
CREATE TABLE t_map_lc
(
id UInt64,
t Tuple(m Map(LowCardinality(String), LowCardinality(String)))
)
ENGINE = MergeTree ORDER BY id SETTINGS min_bytes_for_wide_part = '10G';
INSERT INTO t_map_lc SELECT * FROM generateRandom('id UInt64, t Tuple(m Map(LowCardinality(String), LowCardinality(String)))') LIMIT 100000;
SELECT count(), FROM t_map_lc WHERE NOT ignore(*, mapKeys(t.m));
SELECT count(), FROM t_map_lc WHERE NOT ignore(*, t.m.keys);
SELECT count(), FROM t_map_lc WHERE NOT ignore(*, t.m.values);
SELECT * FROM t_map_lc WHERE mapContains(t.m, 'not_existing_key_1337');
DROP TABLE t_map_lc;