Make the fix more minimal

This commit is contained in:
Robert Schulze 2023-06-22 11:43:11 +00:00
parent a1c131c0da
commit a9f1393862
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
3 changed files with 3 additions and 20 deletions

View File

@ -233,6 +233,7 @@ void QueryCache::Writer::buffer(Chunk && chunk, ChunkType chunk_type)
auto & buffered_chunk = (chunk_type == ChunkType::Totals) ? query_result->totals : query_result->extremes;
convertToFullIfSparse(chunk);
convertToFullIfConst(chunk);
if (!buffered_chunk.has_value())
buffered_chunk = std::move(chunk);
@ -279,7 +280,8 @@ void QueryCache::Writer::finalizeWrite()
for (auto & chunk : query_result->chunks)
{
convertToFullIfNeeded(chunk);
convertToFullIfSparse(chunk);
convertToFullIfConst(chunk);
const size_t rows_chunk = chunk.getNumRows();
if (rows_chunk == 0)

View File

@ -212,30 +212,13 @@ void convertToFullIfConst(Chunk & chunk)
chunk.setColumns(std::move(columns), num_rows);
}
void convertToFullIfLowCardinality(Chunk & chunk)
{
size_t num_rows = chunk.getNumRows();
auto columns = chunk.detachColumns();
for (auto & column : columns)
column = recursiveRemoveLowCardinality(column);
chunk.setColumns(std::move(columns), num_rows);
}
void convertToFullIfSparse(Chunk & chunk)
{
size_t num_rows = chunk.getNumRows();
auto columns = chunk.detachColumns();
for (auto & column : columns)
column = recursiveRemoveSparse(column);
chunk.setColumns(std::move(columns), num_rows);
}
void convertToFullIfNeeded(Chunk & chunk)
{
convertToFullIfSparse(chunk);
convertToFullIfConst(chunk);
convertToFullIfLowCardinality(chunk);
}
}

View File

@ -150,8 +150,6 @@ private:
/// or when you need to perform operation with two columns
/// and their structure must be equal (e.g. compareAt).
void convertToFullIfConst(Chunk & chunk);
void convertToFullIfLowCardinality(Chunk & chunk);
void convertToFullIfSparse(Chunk & chunk);
void convertToFullIfNeeded(Chunk & chunk);
}