diff --git a/core/src/main/java/org/opensearch/sql/ast/expression/AggregateFunction.java b/core/src/main/java/org/opensearch/sql/ast/expression/AggregateFunction.java index 5335e3dfa2..6e837e90cc 100644 --- a/core/src/main/java/org/opensearch/sql/ast/expression/AggregateFunction.java +++ b/core/src/main/java/org/opensearch/sql/ast/expression/AggregateFunction.java @@ -5,9 +5,6 @@ package org.opensearch.sql.ast.expression; -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -44,7 +41,7 @@ public class AggregateFunction extends UnresolvedExpression { public AggregateFunction(String funcName, UnresolvedExpression field) { this.funcName = funcName; this.field = field; - this.argList = emptyList(); + this.argList = List.of(); } /** @@ -57,13 +54,13 @@ public AggregateFunction(String funcName, UnresolvedExpression field) { public AggregateFunction(String funcName, UnresolvedExpression field, Boolean distinct) { this.funcName = funcName; this.field = field; - this.argList = emptyList(); + this.argList = List.of(); this.distinct = distinct; } @Override public List getChild() { - return singletonList(field); + return List.of(field); } @Override diff --git a/core/src/main/java/org/opensearch/sql/ast/expression/Argument.java b/core/src/main/java/org/opensearch/sql/ast/expression/Argument.java index f187dcd1d9..b4e860811f 100644 --- a/core/src/main/java/org/opensearch/sql/ast/expression/Argument.java +++ b/core/src/main/java/org/opensearch/sql/ast/expression/Argument.java @@ -5,8 +5,6 @@ package org.opensearch.sql.ast.expression; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -26,7 +24,7 @@ public class Argument extends UnresolvedExpression { // private final DataType valueType; @Override public List getChild() { - return singletonList(value); + return List.of(value); } @Override diff --git a/core/src/main/java/org/opensearch/sql/ast/expression/In.java b/core/src/main/java/org/opensearch/sql/ast/expression/In.java index 78c958a93e..00f4150242 100644 --- a/core/src/main/java/org/opensearch/sql/ast/expression/In.java +++ b/core/src/main/java/org/opensearch/sql/ast/expression/In.java @@ -5,8 +5,6 @@ package org.opensearch.sql.ast.expression; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -29,7 +27,7 @@ public class In extends UnresolvedExpression { @Override public List getChild() { - return singletonList(field); + return List.of(field); } @Override diff --git a/core/src/main/java/org/opensearch/sql/ast/expression/Interval.java b/core/src/main/java/org/opensearch/sql/ast/expression/Interval.java index 82ff1b93cf..6ffc86497d 100644 --- a/core/src/main/java/org/opensearch/sql/ast/expression/Interval.java +++ b/core/src/main/java/org/opensearch/sql/ast/expression/Interval.java @@ -5,8 +5,6 @@ package org.opensearch.sql.ast.expression; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -30,7 +28,7 @@ public Interval(UnresolvedExpression value, String unit) { @Override public List getChild() { - return singletonList(value); + return List.of(value); } @Override diff --git a/core/src/main/java/org/opensearch/sql/ast/expression/Not.java b/core/src/main/java/org/opensearch/sql/ast/expression/Not.java index 1dcb59c4b8..1794c75080 100644 --- a/core/src/main/java/org/opensearch/sql/ast/expression/Not.java +++ b/core/src/main/java/org/opensearch/sql/ast/expression/Not.java @@ -5,8 +5,6 @@ package org.opensearch.sql.ast.expression; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -24,7 +22,7 @@ public class Not extends UnresolvedExpression { @Override public List getChild() { - return singletonList(expression); + return List.of(expression); } @Override diff --git a/core/src/main/java/org/opensearch/sql/ast/expression/UnresolvedArgument.java b/core/src/main/java/org/opensearch/sql/ast/expression/UnresolvedArgument.java index 18fd13a4e7..cd826e8d90 100644 --- a/core/src/main/java/org/opensearch/sql/ast/expression/UnresolvedArgument.java +++ b/core/src/main/java/org/opensearch/sql/ast/expression/UnresolvedArgument.java @@ -5,8 +5,6 @@ package org.opensearch.sql.ast.expression; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -28,7 +26,7 @@ public UnresolvedArgument(String argName, UnresolvedExpression value) { @Override public List getChild() { - return singletonList(value); + return List.of(value); } @Override diff --git a/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java b/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java index 05f3a178a9..6c0d203a00 100644 --- a/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java +++ b/core/src/main/java/org/opensearch/sql/ast/tree/RareTopN.java @@ -5,8 +5,6 @@ package org.opensearch.sql.ast.tree; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; @@ -42,7 +40,7 @@ public RareTopN attach(UnresolvedPlan child) { @Override public List getChild() { - return singletonList(this.child); + return List.of(this.child); } @Override diff --git a/core/src/main/java/org/opensearch/sql/expression/text/TextFunctions.java b/core/src/main/java/org/opensearch/sql/expression/text/TextFunctions.java index 1c99af789a..b555c8c05c 100644 --- a/core/src/main/java/org/opensearch/sql/expression/text/TextFunctions.java +++ b/core/src/main/java/org/opensearch/sql/expression/text/TextFunctions.java @@ -5,7 +5,6 @@ package org.opensearch.sql.expression.text; -import static java.util.Collections.singletonList; import static org.opensearch.sql.data.type.ExprCoreType.ARRAY; import static org.opensearch.sql.data.type.ExprCoreType.INTEGER; import static org.opensearch.sql.data.type.ExprCoreType.STRING; @@ -176,7 +175,7 @@ private DefaultFunctionResolver concat() { concatFuncName, funcName -> Pair.of( - new FunctionSignature(concatFuncName, singletonList(ARRAY)), + new FunctionSignature(concatFuncName, List.of(ARRAY)), (funcProp, args) -> new FunctionExpression(funcName, args) { @Override diff --git a/core/src/main/java/org/opensearch/sql/expression/window/ranking/RankingWindowFunction.java b/core/src/main/java/org/opensearch/sql/expression/window/ranking/RankingWindowFunction.java index c119629cda..87f4b7de15 100644 --- a/core/src/main/java/org/opensearch/sql/expression/window/ranking/RankingWindowFunction.java +++ b/core/src/main/java/org/opensearch/sql/expression/window/ranking/RankingWindowFunction.java @@ -5,8 +5,6 @@ package org.opensearch.sql.expression.window.ranking; -import static java.util.Collections.emptyList; - import java.util.List; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.Pair; @@ -35,7 +33,7 @@ public abstract class RankingWindowFunction extends FunctionExpression protected int rank; public RankingWindowFunction(FunctionName functionName) { - super(functionName, emptyList()); + super(functionName, List.of()); } @Override diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalAggregation.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalAggregation.java index 450a4fe415..d40feb7dff 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalAggregation.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalAggregation.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -26,7 +24,7 @@ public class LogicalAggregation extends LogicalPlan { /** Constructor of LogicalAggregation. */ public LogicalAggregation( LogicalPlan child, List aggregatorList, List groupByList) { - super(singletonList(child)); + super(List.of(child)); this.aggregatorList = aggregatorList; this.groupByList = groupByList; } diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalDedupe.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalDedupe.java index 368dc3314f..33fbdfd00e 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalDedupe.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalDedupe.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -31,7 +29,7 @@ public LogicalDedupe( Integer allowedDuplication, Boolean keepEmpty, Boolean consecutive) { - super(singletonList(child)); + super(List.of(child)); this.dedupeList = dedupeList; this.allowedDuplication = allowedDuplication; this.keepEmpty = keepEmpty; diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalEval.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalEval.java index 2a79a0ad44..b93b80202e 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalEval.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalEval.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -28,7 +26,7 @@ public class LogicalEval extends LogicalPlan { /** Constructor of LogicalEval. */ public LogicalEval(LogicalPlan child, List> expressions) { - super(singletonList(child)); + super(List.of(child)); this.expressions = expressions; } diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalNested.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalNested.java index 24d768865b..91eae51599 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalNested.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalNested.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import java.util.Map; import lombok.EqualsAndHashCode; @@ -28,7 +26,7 @@ public LogicalNested( LogicalPlan childPlan, List> fields, List projectList) { - super(singletonList(childPlan)); + super(List.of(childPlan)); this.fields = fields; this.projectList = projectList; } diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalProject.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalProject.java index 58576d2e59..37320f8428 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalProject.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalProject.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -26,7 +24,7 @@ public LogicalProject( LogicalPlan child, List projectList, List namedParseExpressions) { - super(singletonList(child)); + super(List.of(child)); this.projectList = projectList; this.namedParseExpressions = namedParseExpressions; } diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalRareTopN.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalRareTopN.java index 787350b5cb..17bb090f60 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalRareTopN.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalRareTopN.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -32,7 +30,7 @@ public LogicalRareTopN( Integer noOfResults, List fieldList, List groupByList) { - super(singletonList(child)); + super(List.of(child)); this.commandType = commandType; this.noOfResults = noOfResults; this.fieldList = fieldList; diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalSort.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalSort.java index 17f6ff0a97..f5b9164e59 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalSort.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalSort.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -25,7 +23,7 @@ public class LogicalSort extends LogicalPlan { /** Constructor of LogicalSort. */ public LogicalSort(LogicalPlan child, List> sortList) { - super(singletonList(child)); + super(List.of(child)); this.sortList = sortList; } diff --git a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalWrite.java b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalWrite.java index 1f4d0ff108..76d75972d8 100644 --- a/core/src/main/java/org/opensearch/sql/planner/logical/LogicalWrite.java +++ b/core/src/main/java/org/opensearch/sql/planner/logical/LogicalWrite.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.logical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -27,7 +25,7 @@ public class LogicalWrite extends LogicalPlan { /** Construct a logical write with given child node, table and column name list. */ public LogicalWrite(LogicalPlan child, Table table, List columns) { - super(singletonList(child)); + super(List.of(child)); this.table = table; this.columns = columns; } diff --git a/core/src/main/java/org/opensearch/sql/planner/physical/FilterOperator.java b/core/src/main/java/org/opensearch/sql/planner/physical/FilterOperator.java index 291b267484..02cfd127e7 100644 --- a/core/src/main/java/org/opensearch/sql/planner/physical/FilterOperator.java +++ b/core/src/main/java/org/opensearch/sql/planner/physical/FilterOperator.java @@ -5,8 +5,6 @@ package org.opensearch.sql.planner.physical; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -37,7 +35,7 @@ public R accept(PhysicalPlanNodeVisitor visitor, C context) { @Override public List getChild() { - return singletonList(input); + return List.of(input); } @Override diff --git a/core/src/main/java/org/opensearch/sql/storage/write/TableWriteOperator.java b/core/src/main/java/org/opensearch/sql/storage/write/TableWriteOperator.java index 82607eaa65..b11eb35f0e 100644 --- a/core/src/main/java/org/opensearch/sql/storage/write/TableWriteOperator.java +++ b/core/src/main/java/org/opensearch/sql/storage/write/TableWriteOperator.java @@ -5,8 +5,6 @@ package org.opensearch.sql.storage.write; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.RequiredArgsConstructor; import org.opensearch.sql.planner.physical.PhysicalPlan; @@ -30,7 +28,7 @@ public R accept(PhysicalPlanNodeVisitor visitor, C context) { @Override public List getChild() { - return singletonList(input); + return List.of(input); } /** diff --git a/core/src/test/java/org/opensearch/sql/analysis/SelectExpressionAnalyzerTest.java b/core/src/test/java/org/opensearch/sql/analysis/SelectExpressionAnalyzerTest.java index 8898b0b7db..590f18f96f 100644 --- a/core/src/test/java/org/opensearch/sql/analysis/SelectExpressionAnalyzerTest.java +++ b/core/src/test/java/org/opensearch/sql/analysis/SelectExpressionAnalyzerTest.java @@ -5,7 +5,6 @@ package org.opensearch.sql.analysis; -import static java.util.Collections.singletonList; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; @@ -77,11 +76,11 @@ protected List analyze(UnresolvedExpression unresolvedExpressio .when(optimizer) .optimize(any(), any()); return new SelectExpressionAnalyzer(expressionAnalyzer) - .analyze(singletonList(unresolvedExpression), analysisContext, optimizer); + .analyze(List.of(unresolvedExpression), analysisContext, optimizer); } protected void assertAnalyzeEqual( NamedExpression expected, UnresolvedExpression unresolvedExpression) { - assertEquals(singletonList(expected), analyze(unresolvedExpression)); + assertEquals(List.of(expected), analyze(unresolvedExpression)); } } diff --git a/core/src/test/java/org/opensearch/sql/executor/ExplainTest.java b/core/src/test/java/org/opensearch/sql/executor/ExplainTest.java index eaeae07242..bf6b1cca68 100644 --- a/core/src/test/java/org/opensearch/sql/executor/ExplainTest.java +++ b/core/src/test/java/org/opensearch/sql/executor/ExplainTest.java @@ -5,8 +5,6 @@ package org.opensearch.sql.executor; -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opensearch.sql.ast.tree.RareTopN.CommandType.TOP; import static org.opensearch.sql.ast.tree.Sort.SortOption.DEFAULT_ASC; @@ -78,11 +76,11 @@ void can_explain_project_filter_table_scan() { new ExplainResponseNode( "ProjectOperator", Map.of("fields", "[name, age]"), - singletonList( + List.of( new ExplainResponseNode( "FilterOperator", Map.of("conditions", "and(=(balance, 10000), >(age, 30))"), - singletonList(tableScan.explainNode()))))), + List.of(tableScan.explainNode()))))), explain.apply(plan)); } @@ -101,7 +99,7 @@ void can_explain_aggregations() { Map.of( "aggregators", "[avg(balance)]", "groupBy", "[state]"), - singletonList(tableScan.explainNode()))), + List.of(tableScan.explainNode()))), explain.apply(plan)); } @@ -109,13 +107,13 @@ void can_explain_aggregations() { void can_explain_rare_top_n() { Expression field = ref("state", STRING); - PhysicalPlan plan = rareTopN(tableScan, TOP, emptyList(), field); + PhysicalPlan plan = rareTopN(tableScan, TOP, List.of(), field); assertEquals( new ExplainResponse( new ExplainResponseNode( "RareTopNOperator", Map.of("commandType", TOP, "noOfResults", 10, "fields", "[state]", "groupBy", "[]"), - singletonList(tableScan.explainNode()))), + List.of(tableScan.explainNode()))), explain.apply(plan)); } @@ -145,7 +143,7 @@ void can_explain_window() { Map.of( "sortOrder", "ASC", "nullOrder", "NULL_FIRST")))), - singletonList(tableScan.explainNode()))), + List.of(tableScan.explainNode()))), explain.apply(plan)); } @@ -171,15 +169,15 @@ void can_explain_other_operators() { new ExplainResponseNode( "RemoveOperator", Map.of("removeList", "[state]"), - singletonList( + List.of( new ExplainResponseNode( "RenameOperator", Map.of("mapping", Map.of("state", "s")), - singletonList( + List.of( new ExplainResponseNode( "EvalOperator", Map.of("expressions", Map.of("age", "+(age, 2)")), - singletonList( + List.of( new ExplainResponseNode( "DedupeOperator", Map.of( @@ -191,7 +189,7 @@ void can_explain_other_operators() { false, "consecutive", false), - singletonList( + List.of( new ExplainResponseNode( "SortOperator", Map.of( @@ -201,11 +199,11 @@ void can_explain_other_operators() { Map.of( "sortOrder", "ASC", "nullOrder", "NULL_FIRST"))), - singletonList( + List.of( new ExplainResponseNode( "ValuesOperator", Map.of("values", List.of(values)), - emptyList())))))))))))), + List.of())))))))))))), explain.apply(plan)); } @@ -217,7 +215,7 @@ void can_explain_limit() { new ExplainResponseNode( "LimitOperator", Map.of("limit", 10, "offset", 5), - singletonList(tableScan.explainNode()))), + List.of(tableScan.explainNode()))), explain.apply(plan)); } @@ -237,7 +235,7 @@ void can_explain_takeOrdered() { 5, "sortList", Map.of("a", Map.of("sortOrder", "ASC", "nullOrder", "NULL_FIRST"))), - singletonList(tableScan.explainNode()))), + List.of(tableScan.explainNode()))), explain.apply(plan)); } @@ -252,7 +250,7 @@ void can_explain_nested() { new ExplainResponseNode( "NestedOperator", Map.of("nested", Set.of("message.info", "message")), - singletonList(tableScan.explainNode()))), + List.of(tableScan.explainNode()))), explain.apply(plan)); } @@ -275,7 +273,7 @@ public String toString() { /** Used to ignore table scan which is duplicate but required for each operator test. */ public ExplainResponseNode explainNode() { return new ExplainResponseNode( - "FakeTableScan", Map.of("request", "Fake DSL request"), emptyList()); + "FakeTableScan", Map.of("request", "Fake DSL request"), List.of()); } public String explain() { diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/DeleteResultSet.java b/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/DeleteResultSet.java index 6d6b05a3e3..9cfe8c9ec7 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/DeleteResultSet.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/executor/format/DeleteResultSet.java @@ -5,9 +5,6 @@ package org.opensearch.sql.legacy.executor.format; -import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; - import java.util.List; import java.util.Map; import org.opensearch.client.Client; @@ -29,14 +26,14 @@ public DeleteResultSet(Client client, Delete query, Object queryResult) { } private List loadColumns() { - return singletonList(new Schema.Column(DELETED, null, Schema.Type.LONG)); + return List.of(new Schema.Column(DELETED, null, Schema.Type.LONG)); } private List loadRows() { - return singletonList(new DataRows.Row(loadDeletedData())); + return List.of(new DataRows.Row(loadDeletedData())); } private Map loadDeletedData() { - return singletonMap(DELETED, ((BulkByScrollResponse) queryResult).getDeleted()); + return Map.of(DELETED, ((BulkByScrollResponse) queryResult).getDeleted()); } } diff --git a/legacy/src/main/java/org/opensearch/sql/legacy/expression/core/builder/UnaryExpressionBuilder.java b/legacy/src/main/java/org/opensearch/sql/legacy/expression/core/builder/UnaryExpressionBuilder.java index de726d7e19..d7682d7bf3 100644 --- a/legacy/src/main/java/org/opensearch/sql/legacy/expression/core/builder/UnaryExpressionBuilder.java +++ b/legacy/src/main/java/org/opensearch/sql/legacy/expression/core/builder/UnaryExpressionBuilder.java @@ -5,8 +5,6 @@ package org.opensearch.sql.legacy.expression.core.builder; -import static java.util.Collections.singletonList; - import java.util.List; import lombok.RequiredArgsConstructor; import org.opensearch.sql.legacy.expression.core.Expression; @@ -32,7 +30,7 @@ public Expression build(List expressionList) { return new Expression() { @Override public ExprValue valueOf(BindingTuple tuple) { - return op.apply(singletonList(expression.valueOf(tuple))); + return op.apply(List.of(expression.valueOf(tuple))); } @Override diff --git a/opensearch/src/test/java/org/opensearch/sql/opensearch/request/OpenSearchRequestBuilderTest.java b/opensearch/src/test/java/org/opensearch/sql/opensearch/request/OpenSearchRequestBuilderTest.java index 1e6bb6b171..0d0b0c3e67 100644 --- a/opensearch/src/test/java/org/opensearch/sql/opensearch/request/OpenSearchRequestBuilderTest.java +++ b/opensearch/src/test/java/org/opensearch/sql/opensearch/request/OpenSearchRequestBuilderTest.java @@ -5,7 +5,6 @@ package org.opensearch.sql.opensearch.request; -import static java.util.Collections.singletonList; import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; @@ -349,7 +348,7 @@ void test_push_down_query() { void test_push_down_aggregation() { AggregationBuilder aggBuilder = AggregationBuilders.composite( - "composite_buckets", singletonList(new TermsValuesSourceBuilder("longA"))); + "composite_buckets", List.of(new TermsValuesSourceBuilder("longA"))); OpenSearchAggregationResponseParser responseParser = new CompositeAggregationParser(new SingleValueParser("AVG(intA)")); requestBuilder.pushDownAggregation(Pair.of(List.of(aggBuilder), responseParser)); @@ -368,7 +367,7 @@ void test_push_down_aggregation() { void test_push_down_percentile_aggregation() { AggregationBuilder aggBuilder = AggregationBuilders.composite( - "composite_buckets", singletonList(new TermsValuesSourceBuilder("longA"))); + "composite_buckets", List.of(new TermsValuesSourceBuilder("longA"))); OpenSearchAggregationResponseParser responseParser = new CompositeAggregationParser(new SinglePercentileParser("PERCENTILE(intA, 50)")); requestBuilder.pushDownAggregation(Pair.of(List.of(aggBuilder), responseParser));