dbms: tiny modification [#CONV-2944].

This commit is contained in:
Alexey Milovidov 2012-10-13 02:12:50 +00:00
parent c1f67a439d
commit 2d0b3c97d5
2 changed files with 4 additions and 11 deletions

View File

@ -18,19 +18,14 @@ using Poco::SharedPtr;
class FilterBlockInputStream : public IProfilingBlockInputStream
{
public:
/// filter_column_ - номер столбца с условиями фильтрации. -1 - последний столбец
FilterBlockInputStream(BlockInputStreamPtr input_, ssize_t filter_column_ = -1);
/// filter_column_ - номер столбца с условиями фильтрации.
FilterBlockInputStream(BlockInputStreamPtr input_, ssize_t filter_column_);
FilterBlockInputStream(BlockInputStreamPtr input_, const String & filter_column_name_);
Block readImpl();
String getName() const { return "FilterBlockInputStream"; }
BlockInputStreamPtr clone()
{
return filter_column_name.empty()
? new FilterBlockInputStream(input, filter_column)
: new FilterBlockInputStream(input, filter_column_name);
}
BlockInputStreamPtr clone() { return new FilterBlockInputStream(input, filter_column); }
private:
BlockInputStreamPtr input;

View File

@ -36,10 +36,8 @@ Block FilterBlockInputStream::readImpl()
throw Exception("There is only filter column in block.", ErrorCodes::ONLY_FILTER_COLUMN_IN_BLOCK);
/// Найдём настоящую позицию столбца с фильтром в блоке.
if (!filter_column_name.empty())
if (filter_column == -1)
filter_column = res.getPositionByName(filter_column_name);
else if (filter_column < 0)
filter_column = static_cast<ssize_t>(res.columns()) + filter_column;
/// Любой столбец - не являющийся фильтром.
IColumn & any_not_filter_column = *res.getByPosition(filter_column == 0 ? 1 : 0).column;