-
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
#3030 Add flatten
Command for Objects to PPL
#3267
base: main
Are you sure you want to change the base?
#3030 Add flatten
Command for Objects to PPL
#3267
Conversation
flatten
Command for Objects to PPL
core/src/main/java/org/opensearch/sql/planner/physical/FlattenOperator.java
Outdated
Show resolved
Hide resolved
ppl/src/test/java/org/opensearch/sql/ppl/parser/AstBuilderTest.java
Outdated
Show resolved
Hide resolved
ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/ip/IPFunctionsTest.java
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/planner/DefaultImplementorTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
…eing preserved. Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
…at it also updates env, plus Javadoc formatting. Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
…ls`. Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
Signed-off-by: currantw <[email protected]>
4e6da8d
to
6e176a3
Compare
@@ -277,7 +282,7 @@ public LogicalPlan visitRename(Rename node, AnalysisContext context) { | |||
LogicalPlan child = node.getChild().get(0).accept(this, context); | |||
ImmutableMap.Builder<ReferenceExpression, ReferenceExpression> renameMapBuilder = | |||
new ImmutableMap.Builder<>(); | |||
for (Map renameMap : node.getRenameList()) { | |||
for (org.opensearch.sql.ast.expression.Map renameMap : node.getRenameList()) { |
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.
Why getRenameList
returns a map? Shouldn't we rename it?
@@ -448,6 +449,107 @@ public LogicalPlan visitEval(Eval node, AnalysisContext context) { | |||
return new LogicalEval(child, expressionsBuilder.build()); | |||
} | |||
|
|||
/** | |||
* Builds and returns a {@link org.opensearch.sql.planner.logical.LogicalFlatten} corresponding to |
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.
nit: You can add import and
* Builds and returns a {@link org.opensearch.sql.planner.logical.LogicalFlatten} corresponding to | |
* Builds and returns a {@link LogicalFlatten} corresponding to |
(and rerun spotlesssss)
* struct: { | ||
* integer: 0, | ||
* nested_struct: { string: "value" } | ||
* }, |
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.
Isn't removing flattened struct? Why?
if (!duplicateFieldNames.isEmpty()) { | ||
throw new SemanticCheckException( | ||
StringUtils.format( | ||
"Flatten command cannot overwrite fields: %s", |
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.
Just to confirm that you have IT to cover that case
Signed-off-by: currantw [email protected]
Description
Implements
flatten
command for objects only.Out of scope
Does not implement flattening for arrays or aliasing. This will come in a follow-up PR.
Related Issues
Part of scope of #3030.
Check List
--signoff
.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.