fixed arrayJoin, also functions on the original array should be working now [#CONV-7967]

This commit is contained in:
Vyacheslav Alipov 2013-08-01 16:00:38 +00:00
parent f298f2698e
commit c82710b275
2 changed files with 7 additions and 3 deletions

View File

@ -247,7 +247,7 @@ void ExpressionActions::Action::execute(Block & block) const
{
const ColumnWithNameAndType & current = block.getByPosition(i);
if (isArrayJoinedColumnName(current.name))
if (current.name == source_name || isArrayJoinedColumnName(current.name))
{
if (!dynamic_cast<const DataTypeArray *>(&*current.type))
throw Exception("arrayJoin of not array: " + current.name, ErrorCodes::TYPE_MISMATCH);
@ -276,7 +276,7 @@ void ExpressionActions::Action::execute(Block & block) const
{
ColumnWithNameAndType & current = block.getByPosition(i);
if (isArrayJoinedColumnName(current.name))
if (current.name == source_name || isArrayJoinedColumnName(current.name))
{
ColumnPtr array_ptr = current.column;
if (array_ptr->isConst())

View File

@ -637,7 +637,11 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl
ASTPtr arg = node->arguments->children[0];
getActionsImpl(arg, no_subqueries, only_consts, actions_stack);
if (!only_consts)
actions_stack.addAction(ExpressionActions::Action::arrayJoin(arg->getColumnName(), node->getColumnName()));
{
String temp_name = "__array_joined__" + arg->getColumnName();
actions_stack.addAction(ExpressionActions::Action::copyColumn(arg->getColumnName(), temp_name));
actions_stack.addAction(ExpressionActions::Action::arrayJoin(temp_name, node->getColumnName()));
}
return;
}