remove a trick with expression continuation

This commit is contained in:
Artem Zuikov 2020-06-25 22:26:03 +03:00
parent 0e49a9ed4d
commit bfe30a9723
5 changed files with 9 additions and 45 deletions

View File

@ -44,33 +44,4 @@ Block ExpressionBlockInputStream::readImpl()
return res; return res;
} }
Block InflatingExpressionBlockInputStream::readImpl()
{
if (!initialized)
{
if (expression->resultIsAlwaysEmpty())
return {};
initialized = true;
}
Block res;
bool keep_going = not_processed && not_processed->empty(); /// There's data inside expression.
if (!not_processed || keep_going)
{
not_processed.reset();
res = children.back()->read();
if (res || keep_going)
expression->execute(res, not_processed, action_number);
}
else
{
res = std::move(not_processed->block);
expression->execute(res, not_processed, action_number);
}
return res;
}
} }

View File

@ -676,19 +676,13 @@ void ExpressionActions::execute(Block & block, bool dry_run) const
} }
} }
/// @warning It's a tricky method that allows to continue ONLY ONE action in reason of one-to-many ALL JOIN logic. void ExpressionActions::execute(Block & block, ExtraBlockPtr & not_processed) const
void ExpressionActions::execute(Block & block, ExtraBlockPtr & not_processed, size_t & start_action) const
{ {
size_t i = start_action; if (actions.size() != 1)
start_action = 0; throw Exception("Continuation over multiple expressions is not supported", ErrorCodes::LOGICAL_ERROR);
for (; i < actions.size(); ++i)
{
actions[i].execute(block, false, not_processed);
checkLimits(block);
if (not_processed) actions[0].execute(block, false, not_processed);
start_action = i; checkLimits(block);
}
} }
bool ExpressionActions::hasJoinOrArrayJoin() const bool ExpressionActions::hasJoinOrArrayJoin() const

View File

@ -212,7 +212,7 @@ public:
void execute(Block & block, bool dry_run = false) const; void execute(Block & block, bool dry_run = false) const;
/// Execute the expression on the block with continuation. /// Execute the expression on the block with continuation.
void execute(Block & block, ExtraBlockPtr & not_processed, size_t & start_action) const; void execute(Block & block, ExtraBlockPtr & not_processed) const;
bool hasJoinOrArrayJoin() const; bool hasJoinOrArrayJoin() const;

View File

@ -59,7 +59,7 @@ Block InflatingExpressionTransform::readExecute(Chunk & chunk)
res = getInputPort().getHeader().cloneWithColumns(chunk.detachColumns()); res = getInputPort().getHeader().cloneWithColumns(chunk.detachColumns());
if (res) if (res)
expression->execute(res, not_processed, action_number); expression->execute(res, not_processed);
} }
else if (not_processed->empty()) /// There's not processed data inside expression. else if (not_processed->empty()) /// There's not processed data inside expression.
{ {
@ -67,12 +67,12 @@ Block InflatingExpressionTransform::readExecute(Chunk & chunk)
res = getInputPort().getHeader().cloneWithColumns(chunk.detachColumns()); res = getInputPort().getHeader().cloneWithColumns(chunk.detachColumns());
not_processed.reset(); not_processed.reset();
expression->execute(res, not_processed, action_number); expression->execute(res, not_processed);
} }
else else
{ {
res = std::move(not_processed->block); res = std::move(not_processed->block);
expression->execute(res, not_processed, action_number); expression->execute(res, not_processed);
} }
return res; return res;
} }

View File

@ -27,7 +27,6 @@ private:
bool initialized = false; bool initialized = false;
ExtraBlockPtr not_processed; ExtraBlockPtr not_processed;
size_t action_number = 0;
Block readExecute(Chunk & chunk); Block readExecute(Chunk & chunk);
}; };