Skip to content

Conversation

@LantaoJin
Copy link
Member

@LantaoJin LantaoJin commented Apr 7, 2025

Description

New output format for explain endpoint, see #3519

Related Issues

Resolves #3519

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
@LantaoJin LantaoJin added the calcite calcite migration releated label Apr 7, 2025
@LantaoJin LantaoJin changed the title Explain endpoint output for V3 New output for explain endpoint with Calcite engine Apr 7, 2025
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Comment on lines 48 to 50
if (Strings.isBlank(format)) {
return ExplainFormat.STANDARD; // Default value
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does catch already cover this edge case?

Comment on lines 21 to 24
// format of explain response
SIMPLE("simple"),
STANDARD("standard"),
CODEGEN("codegen");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Explain response format is always JSON?

Copy link
Member Author

Choose a reason for hiding this comment

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

Using format is not particularly appropriate, mainly because I want to avoid adding an extra parameter.
_ppl/_explain?format=simple
Do you think should we add a new parameter for it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if I understand this right. In Calcite, explain format is actually referring to JSON, XML, DOT? Ref: https://calcite.apache.org/docs/reference.html. If so, I feel making different explain content as different response format is a little confusing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dai-chen You are refering to Calcite SQL? IMO, it is out of scope of this PR.
@LantaoJin We should consider to add explain command in PPL in future.

Comment on lines 85 to 88
// used in Calcite plan explain
private final String logical;
private final String physical;
private final String codegen;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm thinking shall we fit all these into existing ExplainResponseNode structure?

Copy link
Member Author

Choose a reason for hiding this comment

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

How about add a ExplainResponseNodeV2? The new explain response is plain but ExplainResponseNode is nested.

Copy link
Collaborator

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

could u update explain API doc?

Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
@LantaoJin
Copy link
Member Author

could u update explain API doc?

updated the endpoint.rst

Signed-off-by: Lantao Jin <ltjin@amazon.com>
@penghuo penghuo merged commit 98cee32 into opensearch-project:main Apr 9, 2025
22 checks passed
penghuo pushed a commit that referenced this pull request Jun 16, 2025
---------

Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: xinyual <xinyual@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

calcite calcite migration releated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Explain endpoint output for V3

3 participants