Andrew Kyle Purtell created PHOENIX-7896:
--------------------------------------------
Summary: EXPLAIN top-of-plan disclosures
Key: PHOENIX-7896
URL: https://issues.apache.org/jira/browse/PHOENIX-7896
Project: Phoenix
Issue Type: Sub-task
Reporter: Andrew Kyle Purtell
Assignee: Andrew Kyle Purtell
Fix For: PHOENIX-7876-feature
Top-of-plan disclosures rendered as clause-style lines before the first
operator.
A new {{ExplainTable.explainTopOfPlan(planSteps, ...)}} static helper is
invoked from {{ExecutableExplainStatement.compilePlan}} after
{{{}plan.getExplainPlan(){}}}. The block emits {{TENANT '<id>'}} when
{{getTenantId()}} is non-null, {{VIEW <viewName> OVER <baseTableName>}} when
{{{}tableRef.getTable().getType() == PTableType.VIEW{}}}, with the user visible
view name resolved from {{plan.getStatement().getFrom()}} and the base from
{{PTable.getParentName()}} or {{{}getBaseTableLogicalName(){}}}, a CDC scope
line when the table type is {{CDC}} or
{{StatementContext.getCDCIncludeScopes()}} is not null, and {{TXN OMID}} when
{{{}isTransactional(){}}}.
Parse tree and optimizer rewrites are surfaced as {{REWRITE <description>}}
lines in the same block, fed by a new {{appliedRewrites}} list in
{{{}StatementContext{}}}. {{BaseQueryPlan.getExplainPlan}} walks the query
planning context, dedupes, preserving first occurrence order, and prepends one
{{REWRITE}} line per breadcrumb. {{ExplainPlanAttributes}} gains a {{rewrites}}
attribute. {{SubqueryRewriter}} emits one of {{IN SUBQUERY AS SEMI JOIN}} /
{{EXISTS SUBQUERY AS SEMI JOIN}} / {{NOT EXISTS SUBQUERY AS ANTI JOIN}} /
{{SCALAR SUBQUERY AS INNER JOIN}} / {{CORRELATED SUBQUERY AS LEFT JOIN}} per
decorrelation. {{JoinCompiler.JoinTable.getStarJoinVector()}} emits {{STAR JOIN
ON <n> RIGHT LEGS}} when there are at least two right legs. {{HavingCompiler}}
emits {{{}HAVING PREDICATE AS WHERE{}}}. {{RVCOffsetCompiler}} emits {{{}RVC
OFFSET 0x<hex>{}}}. {{OrderByCompiler.compile}} emits {{{}REVERSE SCAN
SUBSTITUTION{}}}. {{QueryCompiler.compileJoinQuery}} and {{SortMergeJoinPlan}}
emit {{RIGHT JOIN AS LEFT JOIN}} when the swap fires.
{{IndexExpressionParseNodeRewriter}} emits {{{}INDEX EXPRESSION <expr> AS
<indexcol>{}}}. {{QueryOptimizer.isPartialIndexUsable}} emits {{PARTIAL INDEX
APPLICABLE}} or {{{}PARTIAL INDEX NOT APPLICABLE -- <reason>{}}}, deduped per
table and per index. {{UnionCompiler.optimizeUnionOrderByIfPossible}} emits
{{{}UNION ORDER BY MERGE{}}}. {{SubselectRewriter.flatten}} increments a
counter slot on {{StatementContext}} per merge and emits {{DERIVED TABLE
FLATTENED <n>}} once with the final count, suppressed when the count is zero.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)