-
Notifications
You must be signed in to change notification settings - Fork 145
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
#3016 New expand
PPL command
#3305
Draft
currantw
wants to merge
81
commits into
opensearch-project:main
Choose a base branch
from
Bit-Quill:#3016_expand_command
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
f462e2a
Add flatten command to ANTLR lexer and parser.
currantw 69f0b1a
Skeleton implementation, tests, and documents with lots of TODOs.
currantw c1ac737
Initial implementation
currantw 366e162
Fix typo
currantw 0cbd8d4
Initial implementation
currantw 26e9443
Update/fix tests.
currantw 237b69e
Update integration tests to align with doc tests.
currantw 3981c38
Minor cleanup.
currantw 2ca7194
Add `ExplainIT` tests for flatten
currantw 9ddfc4a
Revert recursive flattening, add documentation, more test updates
currantw c54c1f5
One more doctest fix
currantw 8993e11
Fix `ExplainIT` error
currantw 288add2
Add additional test case to `flatten.rst`
currantw eca3154
Fix `FlattenCommandIT`, add additional test case.
currantw c89a302
Fix `PhysicalPlanNodeVisitor` test coverage.
currantw 9b2e9ce
Review: use `StringUtils.format` instead of `String.format`.
currantw 82c8ccb
Fix `LogicalFlattenTest`.
currantw b7d8794
Simplify algorithm for `Analyzer`.
currantw ca013ef
Update to support flattening nested structs.
currantw 7920bd8
Fix unrelated bug in `IPFUnctionsTest`.
currantw 9d6459f
Update `IPFUnctionsTest` to anchor at start.
currantw 6d040eb
Minor cleanup.
currantw 43c0902
Fix doctest formatting.
currantw 40362bf
Address minor review comments.
currantw b0a6710
Fix doc tests.
currantw be26660
Update integratation tests to align with doc tests.
currantw b3e4401
Review - minor documentation updates.
currantw 4099f10
Remove double periods
currantw b96cefa
Add comment on `Map.equals`.
currantw 72d98ed
Remove unnecessary error checks.
currantw 4632c03
Update to maintain existing field.
currantw d755208
Update for test coverage
currantw 09563ab
Simplify `Analyzer` implementation
currantw 1d391ce
Rename `cities` dataset to `flatten`
currantw ef750f4
SpotlessApply
currantw 14e005e
Minor doc cleanup.
currantw 73885a7
Fix failing IT
currantw 4fbd320
Update incorrect documentation in `Analyzer.visitFlatten`.
currantw 337fb01
Update integ and doc tests to add another example of original field b…
currantw abe5c6c
Review comment - move example to `Analyzer.visitFlatten` Javadoc.
currantw a0022f4
Review comment - update `Analyzer.visitFlatten` Javadoc to specify th…
currantw df99d37
Review comment - remove unnecessary @Getter
currantw 6883214
Review comments - add `testStructNestedDeep` test case
currantw 94a4c8a
Review comments - add `testStructNestedDeep` test case
currantw 26563c9
Woops! Fix failing test.
currantw bfb51a5
Review comments - extract `PathUtils` constants
currantw 22eccaf
Review comments - update `Analyzer` to not use `Optional`.
currantw dcd241a
Bunch of additional review comments.
currantw befe55b
Spotless
currantw eb93cb1
Spotless
currantw 1f05e85
Additional review comments, including move constants to `ExprValueUti…
currantw db96c51
Review comments - update tests for exception msg
currantw c1666ee
Review comments - simplify `FlattenOperator.flattenExprValueAtPath`.
currantw 6e176a3
Change braces in documentation.
currantw ab5a2fe
Initial implementation of skeleton classes and methods.
currantw e7e5a5a
Implement some of the `expand` logic
currantw a8f6855
Add `PathUtils` and unit tests.
currantw cf357ea
Update `ExpandOperator` and unit tests.
currantw c260f6b
Implement integration tests, update `Expand` logic, rename data set.
currantw 0d3c33c
Implement integration tests, update `Expand` logic, rename data set.
currantw 209326d
Add `expand.rst` documentation and further updates to tests/implement…
currantw dd9a024
Unrelated typo fix
currantw e31df37
Cleanup, modify to return `null` for an empty array.
currantw 274719d
Fix `test_docs.py` typo, order alphabetically.
currantw 459ca24
Minor cleanup, mostly alphabetizing constants.
currantw eef907f
Add new doc and integration tests
currantw 77afac7
Fix missing test coverage
currantw 49078e9
Move `PathUtils` to `ExprValueUtils` and update tests.
currantw ff0d5ae
Use `ExprValueUtils` to simplify `FlattenOperator`
currantw 790104c
Simplify and make consistent flatten and expand operators.
currantw ec47f8f
Update `ExprValueUtils` and unit tests.
currantw 101b653
Make constants private
currantw ec0f44f
Spotless
currantw da7738a
Add hashCode unit tests
currantw 4284f6f
Trivial documentation cleanup.
currantw 1e51881
Fix doctest
currantw c4f732e
General cleanup, combine flatten and expand datasets.
currantw 582fdaa
Spotless
currantw e8494f2
Fix failing doctests
currantw 028e074
Fix `ExplainIT` test
currantw 01569ae
Handle empty collections.
currantw 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
207 changes: 176 additions & 31 deletions
207
core/src/main/java/org/opensearch/sql/analysis/Analyzer.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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
40 changes: 40 additions & 0 deletions
40
core/src/main/java/org/opensearch/sql/ast/tree/Expand.java
This file contains 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,40 @@ | ||
/* | ||
* 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.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
import org.opensearch.sql.ast.expression.Field; | ||
|
||
/** AST node representing an {@code expand <field>} operation. */ | ||
@Getter | ||
@ToString | ||
@RequiredArgsConstructor | ||
public class Expand extends UnresolvedPlan { | ||
|
||
private UnresolvedPlan child; | ||
@Getter private final Field field; | ||
|
||
@Override | ||
public Expand attach(UnresolvedPlan child) { | ||
this.child = child; | ||
return this; | ||
} | ||
|
||
@Override | ||
public List<UnresolvedPlan> getChild() { | ||
return ImmutableList.of(child); | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitExpand(this, context); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
core/src/main/java/org/opensearch/sql/ast/tree/Flatten.java
This file contains 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,39 @@ | ||
/* | ||
* 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.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
import org.opensearch.sql.ast.expression.Field; | ||
|
||
/** AST node representing a {@code flatten <field>} operation. */ | ||
@ToString | ||
@RequiredArgsConstructor | ||
public class Flatten extends UnresolvedPlan { | ||
|
||
private UnresolvedPlan child; | ||
@Getter private final Field field; | ||
|
||
@Override | ||
public Flatten attach(UnresolvedPlan child) { | ||
this.child = child; | ||
return this; | ||
} | ||
|
||
@Override | ||
public List<UnresolvedPlan> getChild() { | ||
return ImmutableList.of(child); | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitFlatten(this, context); | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change pulled from
flatten
PR. See discussion there.#3267