prestodb/presto

EXPLAIN ANALYZE fails on queries with CTE materialization

Open

#23,798 建立於 2024年10月9日

在 GitHub 查看
 (0 留言) (0 反應) (1 負責人)Java (5,240 fork)batch import
bugcte_materializationgood first issue

倉庫指標

Star
 (15,558 star)
PR 合併指標
 (平均合併 34天 14小時) (30 天內合併 120 個 PR)

描述

When running a simple query that uses CTE materialization, EXPLAIN ANALYZE on the query will fail

presto:tpcds> SET SESSION cte_materialization_strategy = 'ALL';
presto:tpcds> SET SESSION cte_partitioning_provider_catalog='hive';
presto:tpcds> SET SESSION hive.temporary_table_storage_format = 'PARQUET';
presto:tpcds> SET SESSION hive.temporary_table_schema = '__temp_ctes__';
presto:tpcds> EXPLAIN ANALYZE WITH t as (VALUES 1, 2, 3) SELECT * FROM t;

Query 20241009_221616_00054_s2xu9, FAILED, 4 nodes
Splits: 61 total, 52 done (85.25%)
[Latency: client-side: 178ms, server-side: 150ms] [6 rows, 692B] [40 rows/s, 4.5KB/s]

Query 20241009_221616_00054_s2xu9 failed: Expected one sub stage of explain node

Your Environment

  • HiveQueryRunner on MacOS

Session configuration

SET SESSION cte_materialization_strategy = 'ALL';
SET SESSION cte_partitioning_provider_catalog='hive';
SET SESSION hive.temporary_table_storage_format = 'PARQUET';
SET SESSION hive.temporary_table_schema = '__temp_ctes__';

Expected Behavior

We should get a valid EXPLAIN ANALYZE output

Possible Solution

We can probably generate a plan for each output stage and render them together? At least for json format it could be an array. In text format we could add some kind of separator?

Steps to Reproduce

  1. Start HiveQueryRunner
  2. Set session properties in description
  3. Execute SQL query in description

Context

EXPLAIN ANALYZE is useful for debugging queries. It should work when we turn on CTE materialization.

貢獻者指南