forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7692eb1
commit 77f1f6e
Showing
15 changed files
with
357 additions
and
19 deletions.
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
core/src/main/java/org/opensearch/sql/ast/expression/FieldList.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,34 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.ast.expression; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
|
||
import java.util.List; | ||
|
||
/** Expression node that includes a list of fields nodes. */ | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = false) | ||
@AllArgsConstructor | ||
public class FieldList extends UnresolvedExpression { | ||
private final List<Field> fieldList; | ||
|
||
@Override | ||
public List<UnresolvedExpression> getChild() { | ||
return ImmutableList.copyOf(fieldList); | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitFieldList(this, context); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
core/src/main/java/org/opensearch/sql/ast/tree/FieldSummary.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,49 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.ast.tree; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
import org.opensearch.sql.ast.Node; | ||
import org.opensearch.sql.ast.expression.Argument; | ||
import org.opensearch.sql.ast.expression.AttributeList; | ||
import org.opensearch.sql.ast.expression.UnresolvedExpression; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = false) | ||
public class FieldSummary extends UnresolvedPlan { | ||
private List<UnresolvedExpression> includeFields; | ||
private UnresolvedPlan child; | ||
|
||
public FieldSummary(List<UnresolvedExpression> collect) { | ||
collect.forEach(exp -> { | ||
if (exp instanceof AttributeList) { | ||
this.includeFields = ((AttributeList)exp).getAttrList(); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public List<? extends Node> getChild() { | ||
return child == null ? List.of() : List.of(child); | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitFieldSummary(this, context); | ||
} | ||
|
||
@Override | ||
public FieldSummary attach(UnresolvedPlan child) { | ||
this.child = child; | ||
return this; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
core/src/main/java/org/opensearch/sql/planner/logical/LogicalFieldSummary.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,27 @@ | ||
package org.opensearch.sql.planner.logical; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.opensearch.sql.expression.NamedExpression; | ||
import org.opensearch.sql.expression.aggregation.NamedAggregator; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** Logical Field Summary. */ | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = true) | ||
public class LogicalFieldSummary extends LogicalAggregation { | ||
|
||
Map<String, String> aggregationToFieldNameMap; | ||
|
||
public LogicalFieldSummary( | ||
LogicalPlan child, List<NamedAggregator> aggregatorList, List<NamedExpression> groupByList, Map<String, String> aggregationToFieldNameMap) { | ||
super(child, aggregatorList, groupByList); | ||
this.aggregationToFieldNameMap = aggregationToFieldNameMap; | ||
} | ||
} |
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.