| 2211 | |
| 2212 | |
| 2213 | void ClientBase::sendDataFrom(ReadBuffer & buf, Block & sample, const ColumnsDescription & columns_description, ASTPtr parsed_query, bool have_more_data) |
| 2214 | { |
| 2215 | String current_format = "Values"; |
| 2216 | |
| 2217 | /// Data format can be specified in the INSERT query. |
| 2218 | if (const auto * insert = parsed_query->as<ASTInsertQuery>()) |
| 2219 | { |
| 2220 | if (!insert->format.empty()) |
| 2221 | current_format = insert->format; |
| 2222 | } |
| 2223 | |
| 2224 | const Settings & settings = client_context->getSettingsRef(); |
| 2225 | |
| 2226 | /// Setting value from cmd arg overrides one from config. |
| 2227 | size_t insert_format_max_block_size_rows = settings[Setting::max_insert_block_size].changed |
| 2228 | ? settings[Setting::max_insert_block_size] |
| 2229 | : insert_format_max_block_size_rows_from_config.value_or(settings[Setting::max_insert_block_size]); |
| 2230 | |
| 2231 | size_t insert_format_max_block_size_bytes = settings[Setting::max_insert_block_size_bytes].changed |
| 2232 | ? settings[Setting::max_insert_block_size_bytes] |
| 2233 | : insert_format_max_block_size_bytes_from_config.value_or(settings[Setting::max_insert_block_size_bytes]); |
| 2234 | |
| 2235 | size_t insert_format_min_block_size_rows = settings[Setting::min_insert_block_size_rows].changed |
| 2236 | ? settings[Setting::min_insert_block_size_rows] |
| 2237 | : insert_format_min_block_size_rows_from_config.value_or(settings[Setting::min_insert_block_size_rows]); |
| 2238 | |
| 2239 | size_t insert_format_min_block_size_bytes = settings[Setting::min_insert_block_size_bytes].changed |
| 2240 | ? settings[Setting::min_insert_block_size_bytes] |
| 2241 | : insert_format_min_block_size_bytes_from_config.value_or(settings[Setting::min_insert_block_size_bytes]); |
| 2242 | |
| 2243 | auto source = client_context->getInputFormat( |
| 2244 | current_format, |
| 2245 | buf, |
| 2246 | sample, |
| 2247 | insert_format_max_block_size_rows, |
| 2248 | std::nullopt, |
| 2249 | insert_format_max_block_size_bytes, |
| 2250 | insert_format_min_block_size_rows, |
| 2251 | insert_format_min_block_size_bytes); |
| 2252 | Pipe pipe(source); |
| 2253 | |
| 2254 | if (columns_description.hasDefaults()) |
| 2255 | { |
| 2256 | pipe.addSimpleTransform([&](const SharedHeader & header) |
| 2257 | { |
| 2258 | return std::make_shared<AddingDefaultsTransform>(header, columns_description, *source, client_context); |
| 2259 | }); |
| 2260 | } |
| 2261 | |
| 2262 | sendDataFromPipe(std::move(pipe), parsed_query, have_more_data); |
| 2263 | } |
| 2264 | |
| 2265 | void ClientBase::sendDataFromPipe(Pipe && pipe, ASTPtr parsed_query, bool have_more_data) |
| 2266 | { |
nothing calls this directly
no test coverage detected