-
Notifications
You must be signed in to change notification settings - Fork 220
Xyseries command implementation #5343
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bccf9f2
xy series implmentation
asifabashar 8ca6a57
xy series implmentation
asifabashar 7823512
xy series implmentation
asifabashar 48da273
xy series implmentation
asifabashar 9057493
xy series implmentation
asifabashar 033181c
index.md updated
asifabashar c7e3b31
removed duplicate format added during merging
asifabashar f9cc584
fix compile issue
asifabashar 48ec5c1
fix test failure
asifabashar ae0ee9f
added missing explain expection output files missed during merge conf…
asifabashar 09cfc39
removed extra formatting changes
asifabashar ea1ea99
removed extra formatting changes
asifabashar cf5afad
fix explain test failure
asifabashar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
core/src/main/java/org/opensearch/sql/ast/tree/Xyseries.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.ast.tree; | ||
|
|
||
| import com.google.common.collect.ImmutableList; | ||
| import java.util.List; | ||
| import lombok.EqualsAndHashCode; | ||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.Setter; | ||
| import lombok.ToString; | ||
| import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
| import org.opensearch.sql.ast.expression.UnresolvedExpression; | ||
|
|
||
| /** | ||
| * AST node representing the xyseries command. Converts row-oriented grouped results into a wide | ||
| * table where one field is the X axis (row key), one field provides pivot values for column naming, | ||
| * and one or more data fields fill the pivoted cells. | ||
| */ | ||
| @Getter | ||
| @ToString | ||
| @EqualsAndHashCode(callSuper = false) | ||
| @RequiredArgsConstructor | ||
| public class Xyseries extends UnresolvedPlan { | ||
|
|
||
| /** The x-axis field (row key in output). */ | ||
| private final UnresolvedExpression xField; | ||
|
|
||
| /** The y-name field whose values become part of the output column names. */ | ||
| private final UnresolvedExpression yNameField; | ||
|
|
||
| /** Explicit pivot values from the IN (...) clause. */ | ||
| private final List<String> pivotValues; | ||
|
|
||
| /** One or more y-data fields whose values fill the pivoted cells. */ | ||
| private final List<UnresolvedExpression> yDataFields; | ||
|
|
||
| /** Separator between y-data-field name and pivot value in column names. Default ":". */ | ||
| private final String separator; | ||
|
|
||
| /** Optional format template for output column names using $AGG$ and $VAL$ placeholders. */ | ||
| private final String format; | ||
|
|
||
| @Setter private UnresolvedPlan child; | ||
|
|
||
| @Override | ||
| public Xyseries attach(UnresolvedPlan child) { | ||
| this.child = child; | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public List<UnresolvedPlan> getChild() { | ||
| return this.child == null ? ImmutableList.of() : ImmutableList.of(this.child); | ||
| } | ||
|
|
||
| @Override | ||
| public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
| return nodeVisitor.visitXyseries(this, context); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.