mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
remove a trick with expression continuation
This commit is contained in:
parent
0e49a9ed4d
commit
bfe30a9723
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user