Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): support xml, yaml format in explain output #19400

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

lyang24
Copy link
Contributor

@lyang24 lyang24 commented Nov 15, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Please do not leave this empty!

Please explain IN DETAIL what the changes are in this PR and why they are needed:

  • Summarize your change (mandatory)
    support xml yaml output formats in explain
  • How does this PR work? Need a brief introduction for the changed logic (optional)
    adding two keywords and two methods to serialize plan output
  • Describe clearly one logical change and avoid lazy messages (optional)
  • Describe any limitations of the current code (optional)
  • Refer to a related PR or issue link (optional)
    support explain format yaml, xml #19123

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Release note
Public Preview: Do note that the structure and format of EXPLAIN FORMAT YAML, XML is considered unstable, and may change overtime.

After this PR, two new explain option are supported
FORMAT (XML | YAML)
For FORMAT XML, it will output xml for logical and physical plans.
For FORMAT YAML, it will output xml for logical and physical plans.
examples:
YAML

CREATE TABLE t (v1 int);
    explain (physical, format yaml) create materialized view m1 as SELECT approx_percentile(0.5) WITHIN GROUP (order by v1) from t;

YAML result

    name: StreamMaterialize
    fields:
      columns:
      - approx_percentile
      pk_columns: []
      pk_conflict: NoCheck
      stream_key: []
    children:
    - name: StreamGlobalApproxPercentile
      fields:
        quantile: 0.5:Float64
        relative_error: 0.01:Float64
      children:
      - name: StreamExchange
        fields:
          dist: Single
        children:
        - name: StreamLocalApproxPercentile
          fields:
            percentile_col: $expr1
            quantile: 0.5:Float64
            relative_error: 0.01:Float64
          children:
          - name: StreamProject
            fields:
              exprs:
              - t.v1::Float64 as $expr1
              - t._row_id
            children:
            - name: StreamTableScan
              fields:
                columns:
                - v1
                - _row_id
                table: t
              children: []

XML

 CREATE TABLE t (v1 int);
   explain (physical, format xml) create materialized view m1 as SELECT approx_percentile(0.5) WITHIN GROUP (order by v1) from t;

XML RESULT

<XmlNode><name>StreamMaterialize</name><fields><columns>approx_percentile</columns><pk_conflict>NoCheck</pk_conflict></fields><children><name>StreamGlobalApproxPercentile</name><fields><quantile>0.5:Float64</quantile><relative_error>0.01:Float64</relative_error></fields><children><name>StreamExchange</name><fields><dist>Single</dist></fields><children><name>StreamLocalApproxPercentile</name><fields><percentile_col>$expr1</percentile_col><quantile>0.5:Float64</quantile><relative_error>0.01:Float64</relative_error></fields><children><name>StreamProject</name><fields><exprs>t.v1::Float64 as $expr1</exprs><exprs>t._row_id</exprs></fields><children><name>StreamTableScan</name><fields><columns>v1</columns><columns>_row_id</columns><table>t</table></fields></children></children></children></children></children></XmlNode>

@lyang24 lyang24 changed the title feat: support xml, yaml format in explain output feat(frontend): support xml, yaml format in explain output Nov 15, 2024
@lyang24 lyang24 requested a review from kwannoel November 15, 2024 16:47
@lyang24 lyang24 marked this pull request as ready for review November 15, 2024 16:47
@lyang24 lyang24 requested a review from a team as a code owner November 15, 2024 16:47
@lyang24 lyang24 requested a review from cyliu0 November 15, 2024 16:47
@kwannoel
Copy link
Contributor

Thanks for your contribution!

There are more related issues for EXPLAIN: #19361. If you're interested, feel free to contribute for these as well.

@kwannoel
Copy link
Contributor

kwannoel commented Nov 16, 2024

Could you also add a Release Note, since this is a new feature.
You can copy the Release Note from #19041, and adapt it for yaml and xml formats.

@kwannoel kwannoel added the user-facing-changes Contains changes that are visible to users label Nov 16, 2024
@lyang24
Copy link
Contributor Author

lyang24 commented Nov 16, 2024

Could you also add a Release Note, since this is a new feature. You can copy the Release Note from #19041, and adapt it for yaml and xml formats.

Yes i mirrored the release note with the example pr, do we also need the release note in commit msg?

@kwannoel kwannoel added this pull request to the merge queue Nov 17, 2024
Merged via the queue into risingwavelabs:main with commit 7a9679b Nov 17, 2024
38 of 39 checks passed
@kwannoel
Copy link
Contributor

Could you also add a Release Note, since this is a new feature. You can copy the Release Note from #19041, and adapt it for yaml and xml formats.

Yes i mirrored the release note with the example pr, do we also need the release note in commit msg?

No just PR description is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-facing-changes Contains changes that are visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants