Skip to content

Commit

Permalink
continue update according to PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: YANGDB <[email protected]>
  • Loading branch information
YANG-DB committed Sep 21, 2023
1 parent af6a068 commit 90ffacf
Showing 1 changed file with 63 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
import org.opensearch.sql.ast.expression.AllFields;
import org.opensearch.sql.ast.expression.And;
import org.opensearch.sql.ast.expression.Argument;
import org.opensearch.sql.ast.expression.Case;
import org.opensearch.sql.ast.expression.Compare;
import org.opensearch.sql.ast.expression.Field;
import org.opensearch.sql.ast.expression.Function;
import org.opensearch.sql.ast.expression.In;
import org.opensearch.sql.ast.expression.Interval;
import org.opensearch.sql.ast.expression.Let;
import org.opensearch.sql.ast.expression.Literal;
Expand All @@ -48,7 +50,9 @@
import org.opensearch.sql.ast.tree.Eval;
import org.opensearch.sql.ast.tree.Filter;
import org.opensearch.sql.ast.tree.Head;
import org.opensearch.sql.ast.tree.Kmeans;
import org.opensearch.sql.ast.tree.Project;
import org.opensearch.sql.ast.tree.RareTopN;
import org.opensearch.sql.ast.tree.Relation;
import org.opensearch.sql.ast.tree.Sort;
import org.opensearch.sql.ppl.utils.AggregatorTranslator;
Expand Down Expand Up @@ -223,20 +227,6 @@ public String visitSort(Sort node, CatalystPlanContext context) {
return format("%s | sort %s", child, sortList);
}

@Override
public String visitDedupe(Dedupe node, CatalystPlanContext context) {
String child = node.getChild().get(0).accept(this, context);
String fields = visitFieldList(node.getFields(), context);
List<Argument> options = node.getOptions();
Integer allowedDuplication = (Integer) options.get(0).getValue().getValue();
Boolean keepEmpty = (Boolean) options.get(1).getValue().getValue();
Boolean consecutive = (Boolean) options.get(2).getValue().getValue();

return format(
"%s | dedup %s %d keepempty=%b consecutive=%b",
child, fields, allowedDuplication, keepEmpty, consecutive);
}

@Override
public String visitHead(Head node, CatalystPlanContext context) {
String child = node.getChild().get(0).accept(this, context);
Expand Down Expand Up @@ -264,6 +254,35 @@ private String groupBy(String groupBy) {
return isNullOrEmpty(groupBy) ? "" : format("by %s", groupBy);
}

@Override
public String visitKmeans(Kmeans node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : Kmeans" );
}

@Override
public String visitIn(In node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : In" );
}

@Override
public String visitCase(Case node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : Case" );
}

@Override
public String visitRareTopN(RareTopN node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : RareTopN" );
}

@Override
public String visitWindowFunction(WindowFunction node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : WindowFunction" );
}

@Override
public String visitDedupe(Dedupe node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : dedupe " );
}
/**
* Expression Analyzer.
*/
Expand Down Expand Up @@ -379,11 +398,6 @@ public String visitAllFields(AllFields node, CatalystPlanContext context) {
}
}

@Override
public String visitWindowFunction(WindowFunction node, CatalystPlanContext context) {
return super.visitWindowFunction(node, context);
}

@Override
public String visitAlias(Alias node, CatalystPlanContext context) {
String expr = node.getDelegated().accept(this, context);
Expand All @@ -397,5 +411,35 @@ public String visitAlias(Alias node, CatalystPlanContext context) {
asScalaBufferConverter(new java.util.ArrayList<String>()).asScala().seq()));
return format("%s", expr);
}

@Override
public String visitDedupe(Dedupe node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : Dedupe" );
}

@Override
public String visitIn(In node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : In");
}

@Override
public String visitKmeans(Kmeans node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : Kmeans");
}

@Override
public String visitCase(Case node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : Case" );
}

@Override
public String visitRareTopN(RareTopN node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : RareTopN");
}

@Override
public String visitWindowFunction(WindowFunction node, CatalystPlanContext context) {
throw new IllegalStateException("Not Supported operation : WindowFunction");
}
}
}

0 comments on commit 90ffacf

Please sign in to comment.