Analyzer support EXPLAIN ESTIMATE

This commit is contained in:
Maksim Kita 2023-11-09 17:30:53 +03:00
parent c391527c86
commit 6fb7d44b62
4 changed files with 19 additions and 7 deletions

View File

@ -536,11 +536,21 @@ QueryPipeline InterpreterExplainQuery::executeImpl()
auto settings = checkAndGetSettings<QueryPlanSettings>(ast.getSettings());
QueryPlan plan;
ContextPtr context;
ContextPtr context = getContext();
if (context->getSettingsRef().allow_experimental_analyzer)
{
InterpreterSelectQueryAnalyzer interpreter(ast.getExplainedQuery(), getContext(), SelectQueryOptions());
plan = std::move(interpreter).extractQueryPlan();
context = interpreter.getContext();
}
else
{
InterpreterSelectWithUnionQuery interpreter(ast.getExplainedQuery(), getContext(), SelectQueryOptions());
interpreter.buildQueryPlan(plan);
context = interpreter.getContext();
}
// Collect the selected marks, rows, parts during build query pipeline.
// Hold on to the returned QueryPipelineBuilderPtr because `plan` may have pointers into
// it (through QueryPlanResourceHolder).

View File

@ -532,9 +532,6 @@ std::optional<QueryProcessingStage::Enum> StorageDistributed::getOptimizedQueryP
const auto & query_node = query_info.query_tree->as<const QueryNode &>();
// std::cerr << query_node.dumpTree() << std::endl;
// std::cerr << query_info.table_expression->dumpTree() << std::endl;
auto expr_contains_sharding_key = [&](const ListNode & exprs) -> bool
{
std::unordered_set<std::string> expr_columns;

View File

@ -0,0 +1,5 @@
-- Tags: distributed
SET allow_experimental_analyzer = 1;
EXPLAIN ESTIMATE SELECT 0 = 1048577, NULL, groupBitmapOr(bitmapBuild([toInt32(65537)])) FROM cluster(test_cluster_two_shards) WHERE NULL = 1048575;