| 274 | InterpreterSelectWithUnionQuery::~InterpreterSelectWithUnionQuery() = default; |
| 275 | |
| 276 | SharedHeader InterpreterSelectWithUnionQuery::getSampleBlock(const ASTPtr & query_ptr_, ContextPtr context_, bool is_subquery, bool is_create_parameterized_view) |
| 277 | { |
| 278 | if (!context_->hasQueryContext()) |
| 279 | { |
| 280 | SelectQueryOptions options; |
| 281 | if (is_subquery) |
| 282 | options = options.subquery(); |
| 283 | if (is_create_parameterized_view) |
| 284 | options = options.createParameterizedView(); |
| 285 | return InterpreterSelectWithUnionQuery(query_ptr_, context_, std::move(options.analyze())).getSampleBlock(); |
| 286 | } |
| 287 | |
| 288 | /// Using query string because query_ptr changes for every internal SELECT |
| 289 | auto key = query_ptr_->formatWithSecretsOneLine(); |
| 290 | { |
| 291 | auto [cache, lock] = context_->getSampleBlockCache(); |
| 292 | if (cache->contains(key)) |
| 293 | return cache->at(key); |
| 294 | } |
| 295 | |
| 296 | SelectQueryOptions options; |
| 297 | if (is_subquery) |
| 298 | options = options.subquery(); |
| 299 | if (is_create_parameterized_view) |
| 300 | options = options.createParameterizedView(); |
| 301 | |
| 302 | auto sample_block = InterpreterSelectWithUnionQuery(query_ptr_, context_, std::move(options.analyze())).getSampleBlock(); |
| 303 | auto [cache, lock] = context_->getSampleBlockCache(); |
| 304 | return (*cache)[key] = sample_block; |
| 305 | } |
| 306 | |
| 307 | |
| 308 | void InterpreterSelectWithUnionQuery::buildQueryPlan(QueryPlan & query_plan) |
no test coverage detected