presto icon indicating copy to clipboard operation
presto copied to clipboard

Support format arguments in EXPLAIN ANALYZE

Open ZacBlanco opened this issue 9 months ago • 0 comments

Description

This change adds two features:

  1. Support for format <X> in EXPLAIN ANALYZE
  2. Adds support for a stats field in each plan node representation

This allows the user to get a computer-friendly representation of the plan with the statistics. This can be useful for visualization or as input to other systems for plan node-level performance analysis.

Motivation and Context

  • Additional execution analysis capabilities through query plan JSON

Impact

  • The JSON representation of a plan from now includes a "stats" field representation statistics at runtime. Its contents map to PlanNodeStats.java
    • This effects the plans sent from the event listener framework
    • Backwards compatibility should be preserved as the change only introduces a new field in the JSON representation without modifying previously-present fields.

Test Plan

  • New tests in the parser and statement analyzer to verify user-supplied arguments.

Contributor checklist

  • [x] Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • [x] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • [x] Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • [x] If release notes are required, they follow the release notes guidelines.
  • [x] Adequate tests were added if applicable.
  • [x] CI passed.

Release Notes

== RELEASE NOTES ==

General Changes
* EXPLAIN ANALYZE statements now support a `format` argument with values of <TEXT|JSON|GRAPHVIZ> :pr:`22733`

ZacBlanco avatar May 13 '24 21:05 ZacBlanco