@@ -1007,10 +1007,6 @@ 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-
10141010 // / If some columns absent in part, then evaluate default values
10151011 if (should_evaluate_missing_defaults)
10161012 {
@@ -1022,6 +1018,9 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
10221018 merge_tree_reader->evaluateMissingDefaults (additional_columns, columns);
10231019 }
10241020
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);
10251024 }
10261025
10271026 read_result.columns .reserve (read_result.columns .size () + columns.size ());
@@ -1047,14 +1046,14 @@ MergeTreeRangeReader::ReadResult MergeTreeRangeReader::read(size_t max_rows, Mar
10471046 bool should_evaluate_missing_defaults;
10481047 merge_tree_reader->fillMissingColumns (columns, should_evaluate_missing_defaults, read_result.num_rows );
10491048
1050- // / If result not empty, then apply on-fly alter conversions if any required
1051- if (!prewhere_info || prewhere_info->perform_alter_conversions )
1052- merge_tree_reader->performRequiredConversions (columns);
1053-
10541049 // / If some columns absent in part, then evaluate default values
10551050 if (should_evaluate_missing_defaults)
10561051 merge_tree_reader->evaluateMissingDefaults ({}, columns);
10571052
1053+ // / If result not empty, then apply on-fly alter conversions if any required
1054+ if (!prewhere_info || prewhere_info->perform_alter_conversions )
1055+ merge_tree_reader->performRequiredConversions (columns);
1056+
10581057 for (size_t i = 0 ; i < columns.size (); ++i)
10591058 read_result.columns [i] = std::move (columns[i]);
10601059 }
0 commit comments