mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
minor refactoring
This commit is contained in:
parent
6a1e116c46
commit
b5682c1f02
@ -856,11 +856,11 @@ static InterpolateDescriptionPtr getInterpolateDescription(const ASTSelectQuery
|
|||||||
auto syntax_result = TreeRewriter(context).analyze(exprs, block.getNamesAndTypesList());
|
auto syntax_result = TreeRewriter(context).analyze(exprs, block.getNamesAndTypesList());
|
||||||
ExpressionAnalyzer analyzer(exprs, syntax_result, context);
|
ExpressionAnalyzer analyzer(exprs, syntax_result, context);
|
||||||
ActionsDAGPtr actions = analyzer.getActionsDAG(true);
|
ActionsDAGPtr actions = analyzer.getActionsDAG(true);
|
||||||
ActionsDAGPtr convDAG = ActionsDAG::makeConvertingActions(actions->getResultColumns(),
|
ActionsDAGPtr conv_dag = ActionsDAG::makeConvertingActions(actions->getResultColumns(),
|
||||||
columns, ActionsDAG::MatchColumnsMode::Position, true);
|
columns, ActionsDAG::MatchColumnsMode::Position, true);
|
||||||
ActionsDAGPtr mergeDAG = ActionsDAG::merge(std::move(*actions->clone()), std::move(*convDAG));
|
ActionsDAGPtr merge_dag = ActionsDAG::merge(std::move(*actions->clone()), std::move(*conv_dag));
|
||||||
|
|
||||||
interpolate_descr = std::make_shared<InterpolateDescription>(mergeDAG, aliases);
|
interpolate_descr = std::make_shared<InterpolateDescription>(merge_dag, aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
return interpolate_descr;
|
return interpolate_descr;
|
||||||
|
@ -259,7 +259,7 @@ void FillingTransform::transform(Chunk & chunk)
|
|||||||
{
|
{
|
||||||
interpolate_block.clear();
|
interpolate_block.clear();
|
||||||
|
|
||||||
if (input_positions.size())
|
if (!input_positions.empty())
|
||||||
{
|
{
|
||||||
/// populate calculation block with required columns with values from previous row
|
/// populate calculation block with required columns with values from previous row
|
||||||
for (const auto & [col_pos, name_type] : input_positions)
|
for (const auto & [col_pos, name_type] : input_positions)
|
||||||
@ -270,7 +270,7 @@ void FillingTransform::transform(Chunk & chunk)
|
|||||||
if (size == 0) /// this is the first row in current chunk
|
if (size == 0) /// this is the first row in current chunk
|
||||||
{
|
{
|
||||||
/// take value from last row of previous chunk if exists, else use default
|
/// take value from last row of previous chunk if exists, else use default
|
||||||
if (last_row.size() > col_pos && last_row[col_pos]->size())
|
if (last_row.size() > col_pos && !last_row[col_pos]->empty())
|
||||||
column->insertFrom(*last_row[col_pos], 0);
|
column->insertFrom(*last_row[col_pos], 0);
|
||||||
else
|
else
|
||||||
column->insertDefault();
|
column->insertDefault();
|
||||||
@ -284,7 +284,6 @@ void FillingTransform::transform(Chunk & chunk)
|
|||||||
}
|
}
|
||||||
else /// all INTERPOLATE expressions are constants
|
else /// all INTERPOLATE expressions are constants
|
||||||
{
|
{
|
||||||
/// LOL :)
|
|
||||||
size_t n = 1;
|
size_t n = 1;
|
||||||
interpolate_actions->execute(interpolate_block, n);
|
interpolate_actions->execute(interpolate_block, n);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user