From 8e6ec1bdbc1dbbef31a7b1c331cd24cbfed344df Mon Sep 17 00:00:00 2001 From: YANGDB Date: Mon, 2 Dec 2024 13:16:43 -0800 Subject: [PATCH] update appendonly with overwrite for test names Signed-off-by: YANGDB --- .../opensearch/sql/planner/logical/LogicalPlanDSL.java | 4 ++-- .../opensearch/sql/planner/physical/PhysicalPlanDSL.java | 4 ++-- docs/user/ppl/cmd/lookup.rst | 8 ++++---- .../test/java/org/opensearch/sql/ppl/LookupCommandIT.java | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanDSL.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanDSL.java index f2dfdfe661..2ab7aeb533 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanDSL.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanDSL.java @@ -143,8 +143,8 @@ public static LogicalPlan lookup( LogicalPlan input, String indexName, Map matchFieldMap, - Boolean appendOnly, + Boolean overwrite, Map copyFields) { - return new LogicalLookup(input, indexName, matchFieldMap, appendOnly, copyFields); + return new LogicalLookup(input, indexName, matchFieldMap, overwrite, copyFields); } } 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 acb7df9f0b..ed95cd8dbd 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 @@ -88,11 +88,11 @@ public static LookupOperator lookup( PhysicalPlan input, String indexName, Map matchFieldMap, - Boolean appendOnly, + Boolean overwrite, Map copyFieldMap, BiFunction, Map> lookupFunction) { return new LookupOperator( - input, indexName, matchFieldMap, appendOnly, copyFieldMap, lookupFunction); + input, indexName, matchFieldMap, overwrite, copyFieldMap, lookupFunction); } public WindowOperator window( diff --git a/docs/user/ppl/cmd/lookup.rst b/docs/user/ppl/cmd/lookup.rst index 03cb089b5c..3e64fd46f1 100644 --- a/docs/user/ppl/cmd/lookup.rst +++ b/docs/user/ppl/cmd/lookup.rst @@ -15,12 +15,12 @@ Description Syntax ============ -lookup [AS ] ["," [AS ]]... [appendonly=] [ [AS ]] ["," [AS ]]... +lookup [AS ] ["," [AS ]]... [overwrite=] [ [AS ]] ["," [AS ]]... * lookup-index: mandatory. the name of the lookup index. If more than one is provided, all of them must match. * lookup-field: mandatory. the name of the lookup field. Must be existing in the lookup-index. It is used to match to a local field (in the current search) to get the lookup document. When there is no lookup document matching it is a no-op. If there is more than one an exception is thrown. * local-lookup-field: optional. the name of a field in the current search to match against the lookup-field. **Default:** value of lookup-field. -* appendonly: optional. indicates if the values to copy over to the search result from the lookup document should overwrite existing values. If true no existing values are overwritten. **Default:** false. +* overwrite: optional. indicates if the values to copy over to the search result from the lookup document should overwrite existing values. If true no existing values are overwritten. **Default:** false. * source-field: optional. the fields to copy over from the lookup document to the search result. If no such fields are given all fields are copied. **Default:** all fields * local-source-field: optional. the final name of the field in the search result (if different from the field name in the lookup document). **Default:** value of source-field. @@ -125,7 +125,7 @@ PPL query:: | 21 | NULL | finance | false | +------------------+--------------+------------+--------+ - os> source=accounts | lookup hr employee_number AS account_number, dep AS department appendonly=true; + os> source=accounts | lookup hr employee_number AS account_number, dep AS department overwrite=true; fetched rows / total rows = 4/4 +------------------+----------+------------------+------------+-----------+---------+-----------------+ | account_number | gender | name | department | active | dep | employee_number | @@ -136,7 +136,7 @@ PPL query:: | 21 | F | Mandy Smith | it | NULL | it | 21 | +------------------+----------+------------------+------------+-----------+---------+-----------------+ - os> source=accounts | lookup hr employee_number AS account_number, dep AS department appendonly=false; + os> source=accounts | lookup hr employee_number AS account_number, dep AS department overwrite=false; fetched rows / total rows = 4/4 +------------------+----------+------------------+------------+-----------+---------+-----------------+ | account_number | gender | name | department | active | dep | employee_number | diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/LookupCommandIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/LookupCommandIT.java index d6a85f4687..1353cf7ddf 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/LookupCommandIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/LookupCommandIT.java @@ -170,7 +170,7 @@ public void testLookupSelectedMultipleAttributes() throws IOException { } @Test - public void testLookupShouldAppendOnlyShouldBeFalseByDefault() throws IOException { + public void testLookupShouldOverwriteShouldBeFalseByDefault() throws IOException { JSONObject result = executeQuery( String.format( @@ -212,11 +212,11 @@ public void testLookupShouldAppendOnlyShouldBeFalseByDefault() throws IOExceptio } @Test - public void testLookupWithAppendOnlyFalse() throws IOException { + public void testLookupWithOverwriteFalse() throws IOException { JSONObject result = executeQuery( String.format( - "source=%s | rename temperature as vendor | lookup %s did as device-id appendonly =" + "source=%s | rename temperature as vendor | lookup %s did as device-id overwrite =" + " true | sort @timestamp", TEST_INDEX_IOT_READINGS, TEST_INDEX_IOT_SENSORS)); verifyDataRows(