mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
fix test
This commit is contained in:
parent
b317715b7e
commit
41145c4e35
@ -6,6 +6,7 @@
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <ext/range.h>
|
||||
#include <DataTypes/DataTypeNothing.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -222,8 +223,11 @@ void MergeTreeBaseBlockInputStream::executePrewhereActions(Block & block) const
|
||||
{
|
||||
bool had_prewhere_column = block.has(prewhere_column_name);
|
||||
prewhere_actions->execute(block);
|
||||
if (!had_prewhere_column && block.columns() > 1)
|
||||
if (!had_prewhere_column)
|
||||
block.erase(prewhere_column_name);
|
||||
|
||||
if (block.columns() == 0)
|
||||
block.insert({nullptr, std::make_shared<DataTypeNothing>(), "_nothing"});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include <Storages/MergeTree/MergeTreeReader.h>
|
||||
#include <Columns/FilterDescription.h>
|
||||
#include <ext/range.h>
|
||||
#include <Columns/ColumnsCommon.h>
|
||||
#include <Columns/ColumnNothing.h>
|
||||
#include <ext/range.h>
|
||||
|
||||
#if __SSE2__
|
||||
#include <emmintrin.h>
|
||||
#include <DataTypes/DataTypeNothing.h>
|
||||
#endif
|
||||
|
||||
namespace DB
|
||||
@ -611,23 +613,25 @@ void MergeTreeRangeReader::executePrewhereActionsAndFilterColumns(ReadResult & r
|
||||
if (!result.block)
|
||||
return;
|
||||
|
||||
/// Calculate the number of rows in block in order to create const column.
|
||||
size_t rows = result.block.rows();
|
||||
/// If block has single column, it's filter. We need to count bytes in it in order to get the number of rows.
|
||||
if (result.block.columns() == 1)
|
||||
{
|
||||
if (result.getFilter())
|
||||
rows = countBytesInFilter(result.getFilter()->getData());
|
||||
else
|
||||
rows = prev_rows;
|
||||
}
|
||||
|
||||
if (remove_prewhere_column)
|
||||
result.block.erase(*prewhere_column_name);
|
||||
else
|
||||
{
|
||||
/// Calculate the number of rows in block in order to create const column.
|
||||
size_t rows = result.block.rows();
|
||||
/// If block has single column, it's filter. We need to count bytes in it in order to get the number of rows.
|
||||
if (result.block.columns() == 1)
|
||||
{
|
||||
if (result.getFilter())
|
||||
rows = countBytesInFilter(result.getFilter()->getData());
|
||||
else
|
||||
rows = prev_rows;
|
||||
}
|
||||
|
||||
prewhere_column.column = prewhere_column.type->createColumnConst(rows, UInt64(1));
|
||||
}
|
||||
|
||||
/// If block is empty, create column in order to store rows number.
|
||||
if (last_reader_in_chain && result.block.columns() == 0)
|
||||
result.block.insert({ColumnNothing::create(rows), std::make_shared<DataTypeNothing>(), "_nothing"});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user