diff --git a/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java b/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java index aa51d7483f..1d8bdaf30e 100644 --- a/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java +++ b/core/src/main/java/org/opensearch/sql/analysis/Analyzer.java @@ -50,7 +50,7 @@ import org.opensearch.sql.ast.tree.Head; import org.opensearch.sql.ast.tree.Kmeans; import org.opensearch.sql.ast.tree.Limit; -import org.opensearch.sql.ast.tree.Lukk; +import org.opensearch.sql.ast.tree.Lookup; import org.opensearch.sql.ast.tree.ML; import org.opensearch.sql.ast.tree.Paginate; import org.opensearch.sql.ast.tree.Parse; @@ -91,7 +91,7 @@ import org.opensearch.sql.planner.logical.LogicalFetchCursor; import org.opensearch.sql.planner.logical.LogicalFilter; import org.opensearch.sql.planner.logical.LogicalLimit; -import org.opensearch.sql.planner.logical.LogicalLukk; +import org.opensearch.sql.planner.logical.LogicalLookup; import org.opensearch.sql.planner.logical.LogicalML; import org.opensearch.sql.planner.logical.LogicalMLCommons; import org.opensearch.sql.planner.logical.LogicalPaginate; @@ -510,9 +510,9 @@ public LogicalPlan visitDedupe(Dedupe node, AnalysisContext context) { consecutive); } - /** Build {@link LogicalLukk}. */ + /** Build {@link LogicalLookup}. */ @Override - public LogicalPlan visitLukk(Lukk node, AnalysisContext context) { + public LogicalPlan visitLookup(Lookup node, AnalysisContext context) { LogicalPlan child = node.getChild().get(0).accept(this, context); List options = node.getOptions(); // Todo, refactor the option. @@ -529,15 +529,15 @@ public LogicalPlan visitLukk(Lukk node, AnalysisContext context) { String.format("no such lookup index %s", node.getIndexName())); } - return new LogicalLukk( + return new LogicalLookup( child, node.getIndexName(), - analyzeLukkMatchFields(node.getMatchFieldList(), context), + analyzeLookupMatchFields(node.getMatchFieldList(), context), appendOnly, - analyzeLukkCopyFields(node.getCopyFieldList(), context, table)); + analyzeLookupCopyFields(node.getCopyFieldList(), context, table)); } - private ImmutableMap analyzeLukkMatchFields( + private ImmutableMap analyzeLookupMatchFields( List inputMap, AnalysisContext context) { ImmutableMap.Builder copyMapBuilder = new ImmutableMap.Builder<>(); @@ -561,7 +561,7 @@ private ImmutableMap analyzeLukkMatchF return copyMapBuilder.build(); } - private ImmutableMap analyzeLukkCopyFields( + private ImmutableMap analyzeLookupCopyFields( List inputMap, AnalysisContext context, Table table) { TypeEnvironment curEnv = context.peek(); diff --git a/core/src/main/java/org/opensearch/sql/ast/AbstractNodeVisitor.java b/core/src/main/java/org/opensearch/sql/ast/AbstractNodeVisitor.java index 7a901771e8..16ebf45854 100644 --- a/core/src/main/java/org/opensearch/sql/ast/AbstractNodeVisitor.java +++ b/core/src/main/java/org/opensearch/sql/ast/AbstractNodeVisitor.java @@ -49,7 +49,7 @@ import org.opensearch.sql.ast.tree.Head; import org.opensearch.sql.ast.tree.Kmeans; import org.opensearch.sql.ast.tree.Limit; -import org.opensearch.sql.ast.tree.Lukk; +import org.opensearch.sql.ast.tree.Lookup; import org.opensearch.sql.ast.tree.ML; import org.opensearch.sql.ast.tree.Paginate; import org.opensearch.sql.ast.tree.Parse; @@ -218,7 +218,7 @@ public T visitDedupe(Dedupe node, C context) { return visitChildren(node, context); } - public T visitLukk(Lukk node, C context) { + public T visitLookup(Lookup node, C context) { return visitChildren(node, context); } diff --git a/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java b/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java index 0ac3d4b031..9b435a627d 100644 --- a/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java +++ b/core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java @@ -50,7 +50,7 @@ import org.opensearch.sql.ast.tree.Filter; import org.opensearch.sql.ast.tree.Head; import org.opensearch.sql.ast.tree.Limit; -import org.opensearch.sql.ast.tree.Lukk; +import org.opensearch.sql.ast.tree.Lookup; import org.opensearch.sql.ast.tree.Parse; import org.opensearch.sql.ast.tree.Project; import org.opensearch.sql.ast.tree.RareTopN; @@ -443,13 +443,13 @@ public static Dedupe dedupe(UnresolvedPlan input, List options, Field. return new Dedupe(input, options, Arrays.asList(fields)); } - public static Lukk lukk( + public static Lookup lookup( UnresolvedPlan input, String indexName, List matchFieldList, List options, List copyFieldList) { - return new Lukk(input, indexName, matchFieldList, options, copyFieldList); + return new Lookup(input, indexName, matchFieldList, options, copyFieldList); } public static List fieldMap(String field, String asField, String... more) { diff --git a/core/src/main/java/org/opensearch/sql/ast/tree/Lukk.java b/core/src/main/java/org/opensearch/sql/ast/tree/Lookup.java similarity index 85% rename from core/src/main/java/org/opensearch/sql/ast/tree/Lukk.java rename to core/src/main/java/org/opensearch/sql/ast/tree/Lookup.java index b066b4c8d3..d9b22cbd26 100644 --- a/core/src/main/java/org/opensearch/sql/ast/tree/Lukk.java +++ b/core/src/main/java/org/opensearch/sql/ast/tree/Lookup.java @@ -17,14 +17,14 @@ import org.opensearch.sql.ast.expression.Argument; import org.opensearch.sql.ast.expression.Map; -/** AST node represent Lukk operation. */ +/** AST node represent Lookup operation. */ @Getter @Setter @ToString @EqualsAndHashCode(callSuper = false) @RequiredArgsConstructor @AllArgsConstructor -public class Lukk extends UnresolvedPlan { +public class Lookup extends UnresolvedPlan { private UnresolvedPlan child; private final String indexName; private final List matchFieldList; @@ -32,7 +32,7 @@ public class Lukk extends UnresolvedPlan { private final List copyFieldList; @Override - public Lukk attach(UnresolvedPlan child) { + public Lookup attach(UnresolvedPlan child) { this.child = child; return this; } @@ -44,6 +44,6 @@ public List getChild() { @Override public T accept(AbstractNodeVisitor nodeVisitor, C context) { - return nodeVisitor.visitLukk(this, context); + return nodeVisitor.visitLookup(this, context); } } diff --git a/core/src/main/java/org/opensearch/sql/executor/Explain.java b/core/src/main/java/org/opensearch/sql/executor/Explain.java index 79e44b513f..d4b15a1cdc 100644 --- a/core/src/main/java/org/opensearch/sql/executor/Explain.java +++ b/core/src/main/java/org/opensearch/sql/executor/Explain.java @@ -22,7 +22,7 @@ import org.opensearch.sql.planner.physical.EvalOperator; import org.opensearch.sql.planner.physical.FilterOperator; import org.opensearch.sql.planner.physical.LimitOperator; -import org.opensearch.sql.planner.physical.LukkOperator; +import org.opensearch.sql.planner.physical.LookupOperator; import org.opensearch.sql.planner.physical.NestedOperator; import org.opensearch.sql.planner.physical.PhysicalPlan; import org.opensearch.sql.planner.physical.PhysicalPlanNodeVisitor; @@ -159,7 +159,7 @@ public ExplainResponseNode visitDedupe(DedupeOperator node, Object context) { } @Override - public ExplainResponseNode visitLukk(LukkOperator node, Object context) { + public ExplainResponseNode visitLookup(LookupOperator node, Object context) { return explain( node, context, diff --git a/core/src/main/java/org/opensearch/sql/planner/DefaultImplementor.java b/core/src/main/java/org/opensearch/sql/planner/DefaultImplementor.java index c08e219f7a..96a3be1f69 100644 --- a/core/src/main/java/org/opensearch/sql/planner/DefaultImplementor.java +++ b/core/src/main/java/org/opensearch/sql/planner/DefaultImplementor.java @@ -13,7 +13,7 @@ import org.opensearch.sql.planner.logical.LogicalFetchCursor; import org.opensearch.sql.planner.logical.LogicalFilter; import org.opensearch.sql.planner.logical.LogicalLimit; -import org.opensearch.sql.planner.logical.LogicalLukk; +import org.opensearch.sql.planner.logical.LogicalLookup; import org.opensearch.sql.planner.logical.LogicalNested; import org.opensearch.sql.planner.logical.LogicalPaginate; import org.opensearch.sql.planner.logical.LogicalPlan; @@ -32,7 +32,7 @@ import org.opensearch.sql.planner.physical.EvalOperator; import org.opensearch.sql.planner.physical.FilterOperator; import org.opensearch.sql.planner.physical.LimitOperator; -import org.opensearch.sql.planner.physical.LukkOperator; +import org.opensearch.sql.planner.physical.LookupOperator; import org.opensearch.sql.planner.physical.NestedOperator; import org.opensearch.sql.planner.physical.PhysicalPlan; import org.opensearch.sql.planner.physical.ProjectOperator; @@ -77,8 +77,8 @@ public PhysicalPlan visitDedupe(LogicalDedupe node, C context) { } @Override - public PhysicalPlan visitLukk(LogicalLukk node, C context) { - return new LukkOperator( + public PhysicalPlan visitLookup(LogicalLookup node, C context) { + return new LookupOperator( visitChild(node, context), node.getIndexName(), node.getMatchFieldMap(), diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalLukk.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalLookup.java similarity index 90% rename from core/src/main/java/org/opensearch/sql/planner/logical/LogicalLukk.java rename to core/src/main/java/org/opensearch/sql/planner/logical/LogicalLookup.java index 2638db221e..6269b56e37 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalLukk.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalLookup.java @@ -16,7 +16,7 @@ @Getter @ToString @EqualsAndHashCode(callSuper = true) -public class LogicalLukk extends LogicalPlan { +public class LogicalLookup extends LogicalPlan { private final String indexName; private final Map matchFieldMap; @@ -24,7 +24,7 @@ public class LogicalLukk extends LogicalPlan { private final Boolean appendOnly; /** Constructor of LogicalDedupe. */ - public LogicalLukk( + public LogicalLookup( LogicalPlan child, String indexName, Map matchFieldMap, @@ -39,6 +39,6 @@ public LogicalLukk( @Override public R accept(LogicalPlanNodeVisitor visitor, C context) { - return visitor.visitLukk(this, context); + return visitor.visitLookup(this, context); } } diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitor.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitor.java index a3201508eb..c05f8c91f6 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitor.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitor.java @@ -52,7 +52,7 @@ public R visitDedupe(LogicalDedupe plan, C context) { return visitNode(plan, context); } - public R visitLukk(LogicalLukk plan, C context) { + public R visitLookup(LogicalLookup plan, C context) { return visitNode(plan, context); } diff --git a/core/src/main/java/org/opensearch/sql/planner/physical/LukkOperator.java b/core/src/main/java/org/opensearch/sql/planner/physical/LookupOperator.java similarity index 94% rename from core/src/main/java/org/opensearch/sql/planner/physical/LukkOperator.java rename to core/src/main/java/org/opensearch/sql/planner/physical/LookupOperator.java index 2058515743..ad7a82559d 100644 --- a/core/src/main/java/org/opensearch/sql/planner/physical/LukkOperator.java +++ b/core/src/main/java/org/opensearch/sql/planner/physical/LookupOperator.java @@ -20,10 +20,10 @@ import org.opensearch.sql.data.model.ExprValueUtils; import org.opensearch.sql.expression.ReferenceExpression; -/** Lukk operator. Perform lookup on another OpenSearch index and enrich the results. */ +/** Lookup operator. Perform lookup on another OpenSearch index and enrich the results. */ @Getter @EqualsAndHashCode(callSuper = false) -public class LukkOperator extends PhysicalPlan { +public class LookupOperator extends PhysicalPlan { @Getter private final PhysicalPlan input; @Getter private final String indexName; @Getter private final Map matchFieldMap; @@ -31,9 +31,9 @@ public class LukkOperator extends PhysicalPlan { @Getter private final Boolean appendOnly; private final BiFunction, Map> lookup; - /** Lukk Constructor. */ + /** Lookup Constructor. */ @NonNull - public LukkOperator( + public LookupOperator( PhysicalPlan input, String indexName, Map matchFieldMap, @@ -50,7 +50,7 @@ public LukkOperator( @Override public R accept(PhysicalPlanNodeVisitor visitor, C context) { - return visitor.visitLukk(this, context); + return visitor.visitLookup(this, context); } @Override diff --git a/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanDSL.java b/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanDSL.java index b7ecda48ea..2ab3f08106 100644 --- a/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanDSL.java +++ b/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanDSL.java @@ -78,13 +78,13 @@ public static DedupeOperator dedupe( input, Arrays.asList(expressions), allowedDuplication, keepEmpty, consecutive); } - public static LukkOperator lukk( + public static LookupOperator lookup( PhysicalPlan input, String indexName, Map matchFieldMap, Boolean appendOnly, Map copyFieldMap) { - return new LukkOperator( + return new LookupOperator( input, indexName, matchFieldMap, diff --git a/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanNodeVisitor.java b/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanNodeVisitor.java index a1fd8d0fca..0a58b018cd 100644 --- a/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanNodeVisitor.java +++ b/core/src/main/java/org/opensearch/sql/planner/physical/PhysicalPlanNodeVisitor.java @@ -64,7 +64,7 @@ public R visitDedupe(DedupeOperator node, C context) { return visitNode(node, context); } - public R visitLukk(LukkOperator node, C context) { + public R visitLookup(LookupOperator node, C context) { return visitNode(node, context); } diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/LukkCommandIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/LookupCommandIT.java similarity index 93% rename from integ-test/src/test/java/org/opensearch/sql/ppl/LukkCommandIT.java rename to integ-test/src/test/java/org/opensearch/sql/ppl/LookupCommandIT.java index e0588238af..cb05285ea3 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/LukkCommandIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/LookupCommandIT.java @@ -14,7 +14,7 @@ import org.json.JSONObject; import org.junit.jupiter.api.Test; -public class LukkCommandIT extends PPLIntegTestCase { +public class LookupCommandIT extends PPLIntegTestCase { @Override public void init() throws IOException { @@ -23,8 +23,8 @@ public void init() throws IOException { } @Test - public void testLukk() throws IOException { - JSONObject result = executeQuery(String.format("source=%s | lukk %s male", TEST_INDEX_BANK)); + public void testLookup() throws IOException { + JSONObject result = executeQuery(String.format("source=%s | lookup %s male", TEST_INDEX_BANK)); verifyDataRows(result, rows(true), rows(false)); } diff --git a/opensearch/src/main/java/org/opensearch/sql/opensearch/executor/protector/OpenSearchExecutionProtector.java b/opensearch/src/main/java/org/opensearch/sql/opensearch/executor/protector/OpenSearchExecutionProtector.java index 158c17b602..cb86978168 100644 --- a/opensearch/src/main/java/org/opensearch/sql/opensearch/executor/protector/OpenSearchExecutionProtector.java +++ b/opensearch/src/main/java/org/opensearch/sql/opensearch/executor/protector/OpenSearchExecutionProtector.java @@ -28,7 +28,7 @@ import org.opensearch.sql.planner.physical.EvalOperator; import org.opensearch.sql.planner.physical.FilterOperator; import org.opensearch.sql.planner.physical.LimitOperator; -import org.opensearch.sql.planner.physical.LukkOperator; +import org.opensearch.sql.planner.physical.LookupOperator; import org.opensearch.sql.planner.physical.NestedOperator; import org.opensearch.sql.planner.physical.PhysicalPlan; import org.opensearch.sql.planner.physical.ProjectOperator; @@ -135,8 +135,8 @@ public PhysicalPlan visitDedupe(DedupeOperator node, Object context) { } @Override - public PhysicalPlan visitLukk(LukkOperator node, Object context) { - return new LukkOperator( + public PhysicalPlan visitLookup(LookupOperator node, Object context) { + return new LookupOperator( visitInput(node.getInput(), context), node.getIndexName(), node.getMatchFieldMap(), diff --git a/ppl/src/main/antlr/OpenSearchPPLLexer.g4 b/ppl/src/main/antlr/OpenSearchPPLLexer.g4 index 833a57fdb4..f9c8382004 100644 --- a/ppl/src/main/antlr/OpenSearchPPLLexer.g4 +++ b/ppl/src/main/antlr/OpenSearchPPLLexer.g4 @@ -35,7 +35,6 @@ NEW_FIELD: 'NEW_FIELD'; KMEANS: 'KMEANS'; AD: 'AD'; ML: 'ML'; -LUKK: 'LUKK'; // COMMAND ASSIST KEYWORDS AS: 'AS'; diff --git a/ppl/src/main/antlr/OpenSearchPPLParser.g4 b/ppl/src/main/antlr/OpenSearchPPLParser.g4 index 864cead088..32fa477dfc 100644 --- a/ppl/src/main/antlr/OpenSearchPPLParser.g4 +++ b/ppl/src/main/antlr/OpenSearchPPLParser.g4 @@ -38,7 +38,7 @@ commands | renameCommand | statsCommand | dedupCommand - | lukkCommand + | lookupCommand | sortCommand | evalCommand | headCommand @@ -94,8 +94,8 @@ copyFieldWithOptAs : orignalCopyField = fieldExpression (AS asCopyField = fieldExpression)? ; -lukkCommand - : LUKK tableSource matchFieldWithOptAs (COMMA matchFieldWithOptAs)* (APPENDONLY EQUAL appendonly = booleanLiteral)? (copyFieldWithOptAs (COMMA copyFieldWithOptAs)*)* +lookupCommand + : LOOKUP tableSource matchFieldWithOptAs (COMMA matchFieldWithOptAs)* (APPENDONLY EQUAL appendonly = booleanLiteral)? (copyFieldWithOptAs (COMMA copyFieldWithOptAs)*)* ; sortCommand @@ -845,7 +845,7 @@ keywordsCanBeId | RENAME | STATS | DEDUP - | LUKK + | LOOKUP | SORT | EVAL | HEAD diff --git a/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java b/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java index 6642fccb13..30a448924e 100644 --- a/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java +++ b/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java @@ -12,7 +12,7 @@ import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.FieldsCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.FromClauseContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.HeadCommandContext; -import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.LukkCommandContext; +import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.LookupCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.RareCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.RenameCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.SearchFilterFromContext; @@ -55,7 +55,7 @@ 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.Lukk; +import org.opensearch.sql.ast.tree.Lookup; import org.opensearch.sql.ast.tree.ML; import org.opensearch.sql.ast.tree.Parse; import org.opensearch.sql.ast.tree.Project; @@ -216,12 +216,12 @@ public UnresolvedPlan visitDedupCommand(DedupCommandContext ctx) { /** Lookup command */ @Override - public UnresolvedPlan visitLukkCommand(LukkCommandContext ctx) { + public UnresolvedPlan visitLookupCommand(LookupCommandContext ctx) { ArgumentFactory.getArgumentList(ctx); ctx.tableSource(); ctx.copyFieldWithOptAs(); ctx.matchFieldWithOptAs(); - return new Lukk( + return new Lookup( ctx.tableSource().tableQualifiedName().getText(), ctx.matchFieldWithOptAs().stream() .map( diff --git a/ppl/src/main/java/org/opensearch/sql/ppl/utils/ArgumentFactory.java b/ppl/src/main/java/org/opensearch/sql/ppl/utils/ArgumentFactory.java index 50379929da..44c90b4d89 100644 --- a/ppl/src/main/java/org/opensearch/sql/ppl/utils/ArgumentFactory.java +++ b/ppl/src/main/java/org/opensearch/sql/ppl/utils/ArgumentFactory.java @@ -9,7 +9,7 @@ import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.DedupCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.FieldsCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.IntegerLiteralContext; -import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.LukkCommandContext; +import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.LookupCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.RareCommandContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.SortFieldContext; import static org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser.StatsCommandContext; @@ -81,7 +81,7 @@ public static List getArgumentList(DedupCommandContext ctx) { : new Argument("consecutive", new Literal(false, DataType.BOOLEAN))); } - public static List getArgumentList(LukkCommandContext ctx) { + public static List getArgumentList(LookupCommandContext ctx) { return Arrays.asList( ctx.appendonly != null ? new Argument("appendonly", getArgumentValue(ctx.appendonly)) diff --git a/ppl/src/main/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizer.java b/ppl/src/main/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizer.java index ff5aae500b..649d090c9d 100644 --- a/ppl/src/main/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizer.java +++ b/ppl/src/main/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizer.java @@ -216,14 +216,14 @@ public String visitDedupe(Dedupe node, String context) { // Todo: do we need anonymization for lookups? /* @Override - public String visitLukk(Lukk node, String context) { + public String visitLookup(Lookup node, String context) { String child = node.getChild().get(0).accept(this, context); String fields = visitFieldList(node.getFields()); List options = node.getOptions(); Boolean appendonly = (Boolean) options.get(0).getValue().getValue(); return StringUtils.format( - "%s | lukk %s %d appendonly=%b ...", + "%s | lookup %s %d appendonly=%b ...", child, fields, appendonly); }*/ diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstBuilderTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstBuilderTest.java index 47cf3585a4..6440ed49d0 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstBuilderTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstBuilderTest.java @@ -27,7 +27,7 @@ import static org.opensearch.sql.ast.dsl.AstDSL.head; import static org.opensearch.sql.ast.dsl.AstDSL.intLiteral; import static org.opensearch.sql.ast.dsl.AstDSL.let; -import static org.opensearch.sql.ast.dsl.AstDSL.lukk; +import static org.opensearch.sql.ast.dsl.AstDSL.lookup; import static org.opensearch.sql.ast.dsl.AstDSL.map; import static org.opensearch.sql.ast.dsl.AstDSL.nullLiteral; import static org.opensearch.sql.ast.dsl.AstDSL.parse; @@ -382,10 +382,10 @@ public void testDedupCommandWithSortby() { } @Test - public void testLukkCommand() { + public void testLookupCommand() { assertEqual( - "source=t | lukk a field", - lukk( + "source=t | lookup a field", + lookup( relation("t"), "a", fieldMap("field", "field"), diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java index f2e1b7c9f2..769b6bd0a9 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java @@ -616,8 +616,8 @@ public void functionNameCanBeUsedAsIdentifier() { + " | LOG10 | LOG2 | MOD | PI |POW | POWER | RAND | ROUND | SIGN | SQRT | TRUNCATE " + "| ACOS | ASIN | ATAN | ATAN2 | COS | COT | DEGREES | RADIANS | SIN | TAN"); assertFunctionNameCouldBeId( - "SEARCH | DESCRIBE | SHOW | FROM | WHERE | FIELDS | RENAME | STATS | DEDUP | LUKK | SORT |" - + " EVAL | HEAD | TOP | RARE | PARSE | METHOD | REGEX | PUNCT | GROK | PATTERN |" + "SEARCH | DESCRIBE | SHOW | FROM | WHERE | FIELDS | RENAME | STATS | DEDUP | LOOKUP | SORT" + + " | EVAL | HEAD | TOP | RARE | PARSE | METHOD | REGEX | PUNCT | GROK | PATTERN |" + " PATTERNS | NEW_FIELD | KMEANS | AD | ML | SOURCE | INDEX | D | DESC | DATASOURCES"); } diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/utils/ArgumentFactoryTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/utils/ArgumentFactoryTest.java index c4c15fb992..102f9591fe 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/utils/ArgumentFactoryTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/utils/ArgumentFactoryTest.java @@ -16,7 +16,7 @@ import static org.opensearch.sql.ast.dsl.AstDSL.field; import static org.opensearch.sql.ast.dsl.AstDSL.fieldMap; import static org.opensearch.sql.ast.dsl.AstDSL.intLiteral; -import static org.opensearch.sql.ast.dsl.AstDSL.lukk; +import static org.opensearch.sql.ast.dsl.AstDSL.lookup; import static org.opensearch.sql.ast.dsl.AstDSL.projectWithArg; import static org.opensearch.sql.ast.dsl.AstDSL.relation; import static org.opensearch.sql.ast.dsl.AstDSL.sort; @@ -107,10 +107,10 @@ public void testNoArgConstructorForArgumentFactoryShouldPass() { } @Test - public void testLukkCommandRequiredArguments() { + public void testLookupCommandRequiredArguments() { assertEqual( - "source=t | lukk a field", - lukk( + "source=t | lookup a field", + lookup( relation("t"), "a", fieldMap("field", "field"), @@ -119,11 +119,11 @@ public void testLukkCommandRequiredArguments() { } @Test - public void testLukkCommandFieldArguments() { + public void testLookupCommandFieldArguments() { assertEqual( - "source=t | lukk a field AS field1,field2 AS field3 destfield AS destfield1, destfield2 AS" - + " destfield3", - lukk( + "source=t | lookup a field AS field1,field2 AS field3 destfield AS destfield1, destfield2" + + " AS destfield3", + lookup( relation("t"), "a", fieldMap("field", "field1", "field2", "field3"), @@ -132,10 +132,10 @@ public void testLukkCommandFieldArguments() { } @Test - public void testLukkCommandAppendTrueArgument() { + public void testLookupCommandAppendTrueArgument() { assertEqual( - "source=t | lukk a field appendonly=true", - lukk( + "source=t | lookup a field appendonly=true", + lookup( relation("t"), "a", fieldMap("field", "field"), @@ -144,10 +144,10 @@ public void testLukkCommandAppendTrueArgument() { } @Test - public void testLukkCommandAppendFalseArgument() { + public void testLookupCommandAppendFalseArgument() { assertEqual( - "source=t | lukk a field appendonly=false", - lukk( + "source=t | lookup a field appendonly=false", + lookup( relation("t"), "a", fieldMap("field", "field"), diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizerTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizerTest.java index 8cb8f86ba7..b7001adaab 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizerTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizerTest.java @@ -90,8 +90,8 @@ public void testDedupCommand() { } @Test - public void testLukkCommand() { - assertEquals("source=t | lukk ", anonymize("source=t | lukk a field1, field2")); + public void testLookupCommand() { + assertEquals("source=t | lookup ", anonymize("source=t | lookup a field1, field2")); } @Test