Skip to content

Commit 0b0e979

Browse files
committed
Do in reverse order
1 parent aafae2e commit 0b0e979

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Storages/MergeTree/MergeTreeRangeReader.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,10 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
10071007
filterColumns(columns, read_result.final_filter);
10081008
}
10091009

1010+
/// If columns not empty, then apply on-fly alter conversions if any required
1011+
if (!prewhere_info || prewhere_info->perform_alter_conversions)
1012+
merge_tree_reader->performRequiredConversions(columns);
1013+
10101014
/// If some columns absent in part, then evaluate default values
10111015
if (should_evaluate_missing_defaults)
10121016
{
@@ -1018,9 +1022,6 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
10181022
merge_tree_reader->evaluateMissingDefaults(additional_columns, columns);
10191023
}
10201024

1021-
/// If columns not empty, then apply on-fly alter conversions if any required
1022-
if (!prewhere_info || prewhere_info->perform_alter_conversions)
1023-
merge_tree_reader->performRequiredConversions(columns);
10241025
}
10251026

10261027
read_result.columns.reserve(read_result.columns.size() + columns.size());
@@ -1046,14 +1047,14 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
10461047
bool should_evaluate_missing_defaults;
10471048
merge_tree_reader->fillMissingColumns(columns, should_evaluate_missing_defaults, read_result.num_rows);
10481049

1049-
/// If some columns absent in part, then evaluate default values
1050-
if (should_evaluate_missing_defaults)
1051-
merge_tree_reader->evaluateMissingDefaults({}, columns);
1052-
10531050
/// If result not empty, then apply on-fly alter conversions if any required
10541051
if (!prewhere_info || prewhere_info->perform_alter_conversions)
10551052
merge_tree_reader->performRequiredConversions(columns);
10561053

1054+
/// If some columns absent in part, then evaluate default values
1055+
if (should_evaluate_missing_defaults)
1056+
merge_tree_reader->evaluateMissingDefaults({}, columns);
1057+
10571058
for (size_t i = 0; i < columns.size(); ++i)
10581059
read_result.columns[i] = std::move(columns[i]);
10591060
}

0 commit comments

Comments
 (0)