Header in every stream: development [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-02-17 07:13:49 +03:00
parent 999d59e5ac
commit dba529d674
4 changed files with 5 additions and 12 deletions

View File

@ -43,9 +43,7 @@ Block ExpressionBlockInputStream::readImpl()
Block res = children.back()->read();
if (!res)
return res;
expression->execute(res);
return res;
}

View File

@ -29,9 +29,9 @@ FilterBlockInputStream::FilterBlockInputStream(const BlockInputStreamPtr & input
children.push_back(input);
/// Determine position of filter column.
Block src_header = expression->getSampleBlock();
filter_column = src_header.getPositionByName(filter_column_name);
Block input_header = input->getHeader();
expression->execute(input_header);
filter_column = input_header.getPositionByName(filter_column_name);
}

View File

@ -64,6 +64,7 @@ void IBlockInputStream::dumpTree(std::ostream & ostr, size_t indent, size_t mult
ostr << String(indent, ' ') << getName();
if (multiplier > 1)
ostr << " × " << multiplier;
// ostr << ": " << getHeader().dumpStructure();
ostr << std::endl;
++indent;

View File

@ -473,13 +473,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::read(
filter_function->children.push_back(filter_function->arguments);
}
/// Add all other columns: expression must save them.
ASTPtr expr_with_filter = std::make_shared<ASTExpressionList>();
for (const auto & name : column_names_to_read)
expr_with_filter->children.push_back(std::make_shared<ASTIdentifier>(StringRange(), name));
expr_with_filter->children.push_back(filter_function);
filter_expression = ExpressionAnalyzer(expr_with_filter, context, nullptr, available_real_columns).getActions(true);
filter_expression = ExpressionAnalyzer(filter_function, context, nullptr, available_real_columns).getActions(true);
/// Add columns needed for `sampling_expression` to `column_names_to_read`.
std::vector<String> add_columns = filter_expression->getRequiredColumns();