ColumnSparse: fixes

This commit is contained in:
Anton Popov 2021-04-19 15:00:31 +03:00
parent b5b624f3d7
commit 65aceaa668
3 changed files with 17 additions and 3 deletions

View File

@ -217,8 +217,17 @@ SerializationPtr IDataType::getSerialization(const NameAndTypePair & column, con
return subcolumn_type.getSerialization(column.name, callback); return subcolumn_type.getSerialization(column.name, callback);
}; };
auto type_in_storage = column.getTypeInStorage(); const auto & type_in_storage = column.getTypeInStorage();
return type_in_storage->getSubcolumnSerialization(column.getSubcolumnName(), base_serialization_getter); auto subcolumn_serialization = type_in_storage->getSubcolumnSerialization(column.getSubcolumnName(), base_serialization_getter);
if (type_in_storage->supportsSparseSerialization())
{
auto sparse_idx_name = escapeForFileName(column.getNameInStorage()) + ".sparse.idx";
if (callback(sparse_idx_name))
subcolumn_serialization = std::make_shared<SerializationSparse>(subcolumn_serialization);
return subcolumn_serialization;
}
} }
return column.type->getSerialization(column.name, callback); return column.type->getSerialization(column.name, callback);

View File

@ -52,9 +52,13 @@ namespace JoinCommon
void convertColumnToNullable(ColumnWithTypeAndName & column, bool low_card_nullability) void convertColumnToNullable(ColumnWithTypeAndName & column, bool low_card_nullability)
{ {
if (column.column->isSparse())
column.column = recursiveRemoveSparse(column.column);
if (low_card_nullability && column.type->lowCardinality()) if (low_card_nullability && column.type->lowCardinality())
{ {
column.column = recursiveRemoveLowCardinality(recursiveRemoveSparse(column.column)); column.column = recursiveRemoveLowCardinality(column.column);
column.type = recursiveRemoveLowCardinality(column.type); column.type = recursiveRemoveLowCardinality(column.type);
} }

View File

@ -230,6 +230,7 @@ IProcessor::Status AggregatingInOrderTransform::prepare()
return Status::NeedData; return Status::NeedData;
} }
current_chunk = input.pull(!is_consume_finished); current_chunk = input.pull(!is_consume_finished);
convertToFullIfSparse(current_chunk);
return Status::Ready; return Status::Ready;
} }