File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 99#include < Processors/QueryPlan/QueryPlan.h>
1010#include < Processors/QueryPlan/SourceStepWithFilter.h>
1111#include < Processors/QueryPlan/Optimizations/QueryPlanOptimizationSettings.h>
12+ #include < Processors/QueryPlan/ConvertingActions.h>
1213#include < Interpreters/InterpreterSelectQueryAnalyzer.h>
1314#include < Interpreters/InterpreterSelectWithUnionQuery.h>
1415#include < IO/WriteBufferFromString.h>
@@ -1225,10 +1226,19 @@ void StorageDistributed::read(
12251226 plan_ptrs.push_back (std::make_unique<QueryPlan>(std::move (plan)));
12261227 }
12271228
1229+ // Get the main plan's header to use as the target for type conversion
1230+ Block main_header = plan_ptrs[0 ]->getCurrentHeader ();
1231+
1232+ // Add type conversion for each additional plan to match the main plan's header
1233+ for (size_t i = 1 ; i < plan_ptrs.size (); ++i)
1234+ {
1235+ addConvertingActions (*plan_ptrs[i], main_header, false );
1236+ }
1237+
12281238 // Create a new query plan that unions all the results
12291239 QueryPlan union_plan;
12301240
1231- // Get headers from all plans
1241+ // Get headers from all plans (after conversion)
12321242 std::vector<Block> headers;
12331243 headers.reserve (plan_ptrs.size ());
12341244 for (const auto & plan_ptr : plan_ptrs)
You can’t perform that action at this time.
0 commit comments