Skip to content

Conversation

@ahahaha-luo
Copy link

@ahahaha-luo ahahaha-luo commented Sep 30, 2025

Why I'm doing:

What I'm doing:

Fixes #63716

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.0
    • 3.5
    • 3.4
    • 3.3

Note

Introduces EXPLAIN TYPE to output query result column names/types as JSON, with parser, executor, plan support, and tests.

  • Explain output enhancements:
    • Add new explain level TYPE to output query result column schema as JSON.
    • StmtExecutor.buildExplainString(...): when level is TYPE, returns column types JSON; suppresses "EXECUTE IN FE" prefix for TYPE.
  • Parser/Grammar:
    • Extend grammar (StarRocks.g4) to accept TYPE in EXPLAIN.
    • AstBuilder: map EXPLAIN TYPE to StatementBase.ExplainLevel.TYPE.
    • StatementBase: add TYPE to ExplainLevel enum.
  • Plan/Utilities:
    • ExecPlan.getColumnTypeExplain(...): produce JSON array of {columnName,columnType} from output expressions; logs non-slot refs.
    • New model QueryColumnType (name/type with Gson annotations).
  • Tests:
    • GetQueryColumnPlanTest: validates JSON schema output and explain type path.

Written by Cursor Bugbot for commit 13d073a. This will update automatically on new commits. Configure here.

@ahahaha-luo ahahaha-luo requested a review from a team as a code owner September 30, 2025 02:11
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


luoyuanluoyuan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sonarqubecloud
Copy link

@github-actions
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

@github-actions
Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@alvin-celerdata
Copy link
Contributor

@cursor review

}
return GsonUtils.GSON.newBuilder().disableHtmlEscaping()
.create().toJson(queryColumnTypes);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incomplete Type Information in EXPLAIN Output

The getColumnTypeExplain method only adds type information for SlotRef expressions. This omits non-SlotRef expressions (e.g., computed columns, literals, function calls) from the result, leading to an incomplete and inconsistent EXPLAIN TYPE output that doesn't match the query's actual columns.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] surport explain return type

4 participants