-
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.
PPL integration with AD and ml-commons (#468)
Signed-off-by: jackieyanghan <[email protected]>
- Loading branch information
1 parent
10a9846
commit eb1ede4
Showing
36 changed files
with
1,177 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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.Map; | ||
import lombok.AllArgsConstructor; | ||
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.Literal; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = true) | ||
@RequiredArgsConstructor | ||
@AllArgsConstructor | ||
public class AD extends UnresolvedPlan { | ||
private UnresolvedPlan child; | ||
|
||
private final Map<String, Literal> arguments; | ||
|
||
@Override | ||
public UnresolvedPlan attach(UnresolvedPlan child) { | ||
this.child = child; | ||
return this; | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitAD(this, context); | ||
} | ||
|
||
@Override | ||
public List<UnresolvedPlan> getChild() { | ||
return ImmutableList.of(this.child); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
core/src/main/java/org/opensearch/sql/ast/tree/Kmeans.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,46 @@ | ||
/* | ||
* 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.AllArgsConstructor; | ||
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.Argument; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = true) | ||
@RequiredArgsConstructor | ||
@AllArgsConstructor | ||
public class Kmeans extends UnresolvedPlan { | ||
private UnresolvedPlan child; | ||
|
||
private final List<Argument> options; | ||
|
||
@Override | ||
public UnresolvedPlan attach(UnresolvedPlan child) { | ||
this.child = child; | ||
return this; | ||
} | ||
|
||
@Override | ||
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) { | ||
return nodeVisitor.visitKmeans(this, context); | ||
} | ||
|
||
@Override | ||
public List<UnresolvedPlan> getChild() { | ||
return ImmutableList.of(this.child); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
core/src/main/java/org/opensearch/sql/planner/logical/LogicalAD.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,33 @@ | ||
package org.opensearch.sql.planner.logical; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.expression.Literal; | ||
|
||
/* | ||
* AD logical plan. | ||
*/ | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = true) | ||
public class LogicalAD extends LogicalPlan { | ||
private final Map<String, Literal> arguments; | ||
|
||
/** | ||
* Constructor of LogicalAD. | ||
* @param child child logical plan | ||
* @param arguments arguments of the algorithm | ||
*/ | ||
public LogicalAD(LogicalPlan child, Map<String, Literal> arguments) { | ||
super(Collections.singletonList(child)); | ||
this.arguments = arguments; | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(LogicalPlanNodeVisitor<R, C> visitor, C context) { | ||
return visitor.visitAD(this, context); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
core/src/main/java/org/opensearch/sql/planner/logical/LogicalMLCommons.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,38 @@ | ||
package org.opensearch.sql.planner.logical; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.opensearch.sql.ast.expression.Argument; | ||
|
||
/** | ||
* ml-commons logical plan. | ||
*/ | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = true) | ||
public class LogicalMLCommons extends LogicalPlan { | ||
private final String algorithm; | ||
|
||
private final List<Argument> arguments; | ||
|
||
/** | ||
* Constructor of LogicalMLCommons. | ||
* @param child child logical plan | ||
* @param algorithm algorithm name | ||
* @param arguments arguments of the algorithm | ||
*/ | ||
public LogicalMLCommons(LogicalPlan child, String algorithm, | ||
List<Argument> arguments) { | ||
super(Collections.singletonList(child)); | ||
this.algorithm = algorithm; | ||
this.arguments = arguments; | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(LogicalPlanNodeVisitor<R, C> visitor, C context) { | ||
return visitor.visitMLCommons(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
13 changes: 13 additions & 0 deletions
13
core/src/main/java/org/opensearch/sql/utils/MLCommonsConstants.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,13 @@ | ||
package org.opensearch.sql.utils; | ||
|
||
public class MLCommonsConstants { | ||
|
||
public static final String SHINGLE_SIZE = "shingle_size"; | ||
public static final String TIME_DECAY = "time_decay"; | ||
public static final String TIME_FIELD = "time_field"; | ||
|
||
public static final String RCF_SCORE = "score"; | ||
public static final String RCF_ANOMALOUS = "anomalous"; | ||
public static final String RCF_ANOMALY_GRADE = "anomaly_grade"; | ||
public static final String RCF_TIMESTAMP = "timestamp"; | ||
} |
Oops, something went wrong.