| 199 | } |
| 200 | |
| 201 | Block InterpreterInsertQuery::getSampleBlock( |
| 202 | const ASTInsertQuery & query, |
| 203 | const StoragePtr & table, |
| 204 | const StorageMetadataPtr & metadata_snapshot, |
| 205 | ContextPtr context_, |
| 206 | bool no_destination, |
| 207 | bool allow_materialized) |
| 208 | { |
| 209 | /// If the query does not include information about columns |
| 210 | if (!query.columns) |
| 211 | { |
| 212 | if (auto * window_view = dynamic_cast<StorageWindowView *>(table.get())) |
| 213 | return window_view->getInputHeader(); |
| 214 | if (no_destination) |
| 215 | return metadata_snapshot->getSampleBlockWithVirtuals(VirtualsKind::All, VirtualsMaterializationPlace::All); |
| 216 | return metadata_snapshot->getSampleBlockNonMaterialized(); |
| 217 | } |
| 218 | |
| 219 | /// Form the block based on the column names from the query |
| 220 | const auto columns_ast = processColumnTransformers(context_->getCurrentDatabase(), table, metadata_snapshot, query.columns); |
| 221 | Names names; |
| 222 | names.reserve(columns_ast->children.size()); |
| 223 | for (const auto & identifier : columns_ast->children) |
| 224 | { |
| 225 | std::string current_name = identifier->getColumnName(); |
| 226 | names.emplace_back(std::move(current_name)); |
| 227 | } |
| 228 | |
| 229 | return getSampleBlock(names, table, metadata_snapshot, no_destination, allow_materialized); |
| 230 | } |
| 231 | |
| 232 | Block InterpreterInsertQuery::getSampleBlock( |
| 233 | const Names & names, |
nothing calls this directly
no test coverage detected