Skip to content

Conversation

@yangbin09
Copy link
Contributor

Description

Fixes issue #23798 where EXPLAIN ANALYZE failed on queries with CTE materialization due to expecting only one sub stage.

Problem

The ExplainAnalyzeOperator had a strict check that expected exactly one sub-stage for explain nodes. However, when CTE materialization is enabled, multiple sub-stages are generated, causing the operator to fail with the error "Expected one sub stage of explain node".

Solution

  • Modified ExplainAnalyzeOperator to support multiple sub stages
  • Added generateTextPlanForSubStages method to handle multiple sub-stages for TEXT format
  • Added generateJsonPlanForSubStages method to handle multiple sub-stages for JSON format
  • Maintained backward compatibility for single sub-stage scenarios
  • Added comprehensive test case for CTE materialization with EXPLAIN ANALYZE

Testing

  • Added test case testExplainAnalyzeWithCTEMaterialization to verify the fix
  • Verified that existing functionality remains unaffected
  • Tested both TEXT and JSON output formats

Files Changed

  • presto-main-base/src/main/java/com/facebook/presto/operator/ExplainAnalyzeOperator.java
  • presto-main/src/test/java/com/facebook/presto/operator/TestExplainAnalyzeOperator.java

Resolves: #23798

Added Bootstrap tooltip initialization in QueryList component's
componentDidMount method to ensure tooltips display at correct
position instead of top-left corner.

Fixes prestodb#24727
…23798 where EXPLAIN ANALYZE failed on queries with CTE\nmaterialization due to expecting only one sub stage.\n\nChanges:\n- Modified ExplainAnalyzeOperator to support multiple sub stages\n- Added generateTextPlanForSubStages and generateJsonPlanForSubStages methods\n- Added test case for CTE materialization with EXPLAIN ANALYZE\n\nResolves: prestodb#23798
@tdcmeehan tdcmeehan self-assigned this Aug 18, 2025
@yangbin09
Copy link
Contributor Author

Hi @tdcmeehan @, quick context:

  • This fixes EXPLAIN ANALYZE fails on queries with CTE materialization #23798 where EXPLAIN ANALYZE fails when CTE materialization creates multiple sub-stages.
  • Kept single-substage behavior backward compatible.
  • Added tests for TEXT/JSON outputs and multi-substage plans.
    When you have a moment, I’d appreciate an initial pass or any concerns I should address first. Thanks!

@tdcmeehan
Copy link
Contributor

@yangbin09 thanks for your contribution! Please take a look at the compilation failure. This approach looks good to me. CC: @jaystarshot

@yangbin09 yangbin09 force-pushed the fix-explain-analyze-cte-materialization branch from a2dbb72 to 8d11215 Compare August 20, 2025 12:57
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 21, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

- Fix left brace placement for testViewWithUUID, testExplainAnalyzeWithCTEMaterialization, and assertExplainAnalyze methods
- Split long lines to comply with 80-character limit
- Add proper Javadoc comments
- Remove trailing whitespace
@yangbin09 yangbin09 force-pushed the fix-explain-analyze-cte-materialization branch from b2e04ec to 2864942 Compare August 21, 2025 07:40
- Changed parameter name from 'transaction' to 'transactionHandle' in getMetadata method
- This fixes the @OverRide annotation error that was causing compilation failure
- The parameter name must match the interface definition in Connector.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EXPLAIN ANALYZE fails on queries with CTE materialization

2 participants