@@ -459,7 +459,7 @@ void ReadFromRemote::addLazyPipe(Pipes & pipes, const ClusterProxy::SelectStream
459459 my_stage = stage, my_storage = storage,
460460 add_agg_info, add_totals, add_extremes, async_read, async_query_sending,
461461 query_tree = shard.query_tree , planner_context = shard.planner_context ,
462- pushed_down_filters]() mutable
462+ pushed_down_filters, my_is_remote_function = is_remote_function ]() mutable
463463 -> QueryPipelineBuilder
464464 {
465465 auto current_settings = my_context->getSettingsRef ();
@@ -543,6 +543,8 @@ void ReadFromRemote::addLazyPipe(Pipes & pipes, const ClusterProxy::SelectStream
543543 {DataTypeUInt32 ().createColumnConst (1 , my_shard.shard_info .shard_num ), std::make_shared<DataTypeUInt32>(), " _shard_num" }};
544544 auto remote_query_executor = std::make_shared<RemoteQueryExecutor>(
545545 std::move (connections), query_string, header, my_context, my_throttler, my_scalars, my_external_tables, my_stage);
546+ remote_query_executor->setRemoteFunction (my_is_remote_function);
547+ remote_query_executor->setShardCount (my_shard_count);
546548
547549 auto pipe = createRemoteSourcePipe (remote_query_executor, add_agg_info, add_totals, add_extremes, async_read, async_query_sending);
548550 QueryPipelineBuilder builder;
@@ -627,6 +629,8 @@ void ReadFromRemote::addPipe(Pipes & pipes, const ClusterProxy::SelectStreamFact
627629 priority_func);
628630 remote_query_executor->setLogger (log);
629631 remote_query_executor->setPoolMode (PoolMode::GET_ONE);
632+ remote_query_executor->setRemoteFunction (is_remote_function);
633+ remote_query_executor->setShardCount (shard_count);
630634
631635 if (!table_func_ptr)
632636 remote_query_executor->setMainTable (shard.main_table ? shard.main_table : main_table);
@@ -646,6 +650,8 @@ void ReadFromRemote::addPipe(Pipes & pipes, const ClusterProxy::SelectStreamFact
646650 auto remote_query_executor = std::make_shared<RemoteQueryExecutor>(
647651 shard.shard_info .pool , query_string, shard.header , context, throttler, scalars, external_tables, stage);
648652 remote_query_executor->setLogger (log);
653+ remote_query_executor->setRemoteFunction (is_remote_function);
654+ remote_query_executor->setShardCount (shard_count);
649655
650656 if (context->canUseTaskBasedParallelReplicas ())
651657 {
0 commit comments