prestodb/presto

EXPLAIN ANALYZE fails on queries with CTE materialization

开放

#23,798 创建于 2024年10月9日

 (0 条评论) (0 个反应) (1 位负责人)Java (5,240 个派生)batch import
bugcte_materializationgood first issue

仓库指标

星标
 (15,558 个星标)
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.

贡献者指南