| 110 | } |
| 111 | |
| 112 | StoragePtr TableFunctionURL::getStorage( |
| 113 | const String & source, const String & format_, const ColumnsDescription & columns, ContextPtr context, |
| 114 | const std::string & table_name, const String & compression_method_, bool is_insert_query) const |
| 115 | { |
| 116 | const auto & settings = context->getSettingsRef(); |
| 117 | const auto is_secondary_query = context->getClientInfo().query_kind == ClientInfo::QueryKind::SECONDARY_QUERY; |
| 118 | const auto parallel_replicas_cluster_name = settings[Setting::cluster_for_parallel_replicas].toString(); |
| 119 | const bool can_use_parallel_replicas = !parallel_replicas_cluster_name.empty() |
| 120 | && settings[Setting::parallel_replicas_for_cluster_engines] |
| 121 | && context->canUseTaskBasedParallelReplicas() |
| 122 | && !context->isDistributed() |
| 123 | && !is_secondary_query |
| 124 | && !is_insert_query; |
| 125 | |
| 126 | if (can_use_parallel_replicas) |
| 127 | { |
| 128 | return std::make_shared<StorageURLCluster>( |
| 129 | context, |
| 130 | parallel_replicas_cluster_name, |
| 131 | source, |
| 132 | format_, |
| 133 | compression_method_, |
| 134 | StorageID(getDatabaseName(), table_name), |
| 135 | getActualTableStructure(context, true), |
| 136 | ConstraintsDescription{}, |
| 137 | configuration); |
| 138 | } |
| 139 | |
| 140 | /// Note: distributed_processing is always false for the plain url() table function. |
| 141 | /// Cluster table functions (urlCluster) handle distributed processing in their own getStorage() method. |
| 142 | return std::make_shared<StorageURL>( |
| 143 | source, |
| 144 | StorageID(getDatabaseName(), table_name), |
| 145 | format_, |
| 146 | std::nullopt /*format settings*/, |
| 147 | columns, |
| 148 | ConstraintsDescription{}, |
| 149 | String{}, |
| 150 | context, |
| 151 | compression_method_, |
| 152 | configuration.headers, |
| 153 | configuration.http_method, |
| 154 | nullptr, |
| 155 | /*distributed_processing=*/false); |
| 156 | } |
| 157 | |
| 158 | ColumnsDescription TableFunctionURL::getActualTableStructure(ContextPtr context, bool /*is_insert_query*/) const |
| 159 | { |
nothing calls this directly
no test coverage detected