-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # core/src/test/java/org/opensearch/sql/analysis/AnalyzerTest.java # core/src/test/java/org/opensearch/sql/executor/ExplainTest.java # core/src/test/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitorTest.java # core/src/test/java/org/opensearch/sql/planner/physical/PhysicalPlanNodeVisitorTest.java # ppl/src/test/java/org/opensearch/sql/ppl/parser/AstBuilderTest.java # ppl/src/test/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizerTest.java
- Loading branch information
Showing
36 changed files
with
1,708 additions
and
28 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
71 changes: 71 additions & 0 deletions
71
core/src/main/java/org/opensearch/sql/ast/tree/Trendline.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,71 @@ | ||
/* | ||
* 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 java.util.Optional; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.AbstractNodeVisitor; | ||
import org.opensearch.sql.ast.Node; | ||
import org.opensearch.sql.ast.expression.Field; | ||
import org.opensearch.sql.ast.expression.UnresolvedExpression; | ||
|
||
@ToString | ||
@Getter | ||
@RequiredArgsConstructor | ||
@EqualsAndHashCode(callSuper = false) | ||
public class Trendline extends UnresolvedPlan { | ||
|
||
private UnresolvedPlan child; | ||
private final Optional<Field> sortByField; | ||
private final List<TrendlineComputation> computations; | ||
|
||
@Override | ||
public Trendline attach(UnresolvedPlan child) { | ||
this.child = child; | ||
return this; | ||
} | ||
|
||
@Override | ||
public List<? extends Node> getChild() { | ||
return ImmutableList.of(child); | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> visitor, C context) { | ||
return visitor.visitTrendline(this, context); | ||
} | ||
|
||
@Getter | ||
public static class TrendlineComputation extends UnresolvedExpression { | ||
|
||
private final Integer numberOfDataPoints; | ||
private final Field dataField; | ||
private final String alias; | ||
private final TrendlineType computationType; | ||
|
||
public TrendlineComputation( | ||
Integer numberOfDataPoints, Field dataField, String alias, TrendlineType computationType) { | ||
this.numberOfDataPoints = numberOfDataPoints; | ||
this.dataField = dataField; | ||
this.alias = alias; | ||
this.computationType = computationType; | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitTrendlineComputation(this, context); | ||
} | ||
} | ||
|
||
public enum TrendlineType { | ||
SMA | ||
} | ||
} |
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.