Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Only - Replace calls to Arrays.asList with too few arguments. #3193

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
## Current Maintainers

| Maintainer | GitHub ID | Affiliation |
| ----------------- | ------------------------------------------------- | ----------- |
| ----------------- |-----------------------------------------------------| ----------- |
| Eric Wei | [mengweieric](https://github.com/mengweieric) | Amazon |
| Joshua Li | [joshuali925](https://github.com/joshuali925) | Amazon |
| Shenoy Pratik | [ps48](https://github.com/ps48) | Amazon |
Expand All @@ -16,7 +16,7 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
| Peter Fitzgibbons | [pjfitzgibbons](https://github.com/pjfitzgibbons) | Amazon |
| Simeon Widdis | [swiddis](https://github.com/swiddis) | Amazon |
| Chen Dai | [dai-chen](https://github.com/dai-chen) | Amazon |
| Vamsi Manohar | [vamsi-amazon](https://github.com/vamsi-amazon) | Amazon |
currantw marked this conversation as resolved.
Show resolved Hide resolved
| Vamsi Manohar | [vamsi-amazon](https://github.com/vmmusings) | Amazon |
| Peng Huo | [penghuo](https://github.com/penghuo) | Amazon |
| Sean Kao | [seankao-az](https://github.com/seankao-az) | Amazon |
| Anirudha Jadhav | [anirudha](https://github.com/anirudha) | Amazon |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.google.common.annotations.VisibleForTesting;
import java.time.Clock;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import org.opensearch.client.Client;
import org.opensearch.cluster.LocalNodeClusterManagerListener;
Expand Down Expand Up @@ -183,7 +182,7 @@ private void cancel(Cancellable cron) {

@VisibleForTesting
public List<Cancellable> getFlintIndexRetentionCron() {
return Arrays.asList(flintIndexRetentionCron);
return List.of(flintIndexRetentionCron);
}

private String executorName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -137,7 +136,7 @@ public class AsyncQueryExecutorServiceSpec extends OpenSearchIntegTestCase {

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Arrays.asList(TestSettingPlugin.class);
return List.of(TestSettingPlugin.class);
acarbonetto marked this conversation as resolved.
Show resolved Hide resolved
}

public static class TestSettingPlugin extends Plugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static org.opensearch.sql.data.type.ExprCoreType.STRING;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -94,7 +93,7 @@ public LogicalPlan visitFunction(Function node, AnalysisContext context) {
generatePath(nestedField.toString()));
}

return mergeChildIfLogicalNested(new ArrayList<>(Arrays.asList(args)));
return mergeChildIfLogicalNested(new ArrayList<>(List.of(args)));
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.opensearch.sql.ast.expression;

import java.util.Arrays;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand All @@ -25,7 +24,7 @@ public class Argument extends UnresolvedExpression {
// private final DataType valueType;
@Override
public List<UnresolvedExpression> getChild() {
return Arrays.asList(value);
return List.of(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.opensearch.sql.ast.expression;

import java.util.Arrays;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand All @@ -28,7 +27,7 @@ public class In extends UnresolvedExpression {

@Override
public List<UnresolvedExpression> getChild() {
return Arrays.asList(field);
return List.of(field);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.opensearch.sql.ast.expression;

import java.util.Arrays;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand All @@ -23,7 +22,7 @@ public class Not extends UnresolvedExpression {

@Override
public List<UnresolvedExpression> getChild() {
return Arrays.asList(expression);
return List.of(expression);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.opensearch.sql.ast.expression;

import java.util.Arrays;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand All @@ -27,7 +26,7 @@ public UnresolvedArgument(String argName, UnresolvedExpression value) {

@Override
public List<UnresolvedExpression> getChild() {
return Arrays.asList(value);
return List.of(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.opensearch.sql.ast.tree;

import com.google.common.collect.ImmutableList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
Expand All @@ -32,7 +31,7 @@ public Relation(UnresolvedExpression tableName) {
}

public Relation(UnresolvedExpression tableName, String alias) {
this.tableName = Arrays.asList(tableName);
this.tableName = List.of(tableName);
this.alias = alias;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import static org.opensearch.sql.data.type.ExprCoreType.UNKNOWN;

import java.util.Arrays;
import java.util.List;
import org.opensearch.sql.data.model.ExprValue;
import org.opensearch.sql.expression.Expression;
Expand Down Expand Up @@ -44,7 +43,7 @@ default boolean shouldCast(ExprType other) {

/** Get the parent type. */
default List<ExprType> getParent() {
return Arrays.asList(UNKNOWN);
return List.of(UNKNOWN);
}

/** Get the type name. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package org.opensearch.sql.planner.logical;

import java.util.Arrays;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand All @@ -30,7 +29,7 @@ public LogicalDedupe(
Integer allowedDuplication,
Boolean keepEmpty,
Boolean consecutive) {
super(Arrays.asList(child));
super(List.of(child));
this.dedupeList = dedupeList;
this.allowedDuplication = allowedDuplication;
this.keepEmpty = keepEmpty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import static org.opensearch.sql.data.type.ExprCoreType.INTEGER;
import static org.opensearch.sql.data.type.ExprCoreType.STRUCT;

import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -77,11 +76,11 @@ protected List<NamedExpression> analyze(UnresolvedExpression unresolvedExpressio
.when(optimizer)
.optimize(any(), any());
return new SelectExpressionAnalyzer(expressionAnalyzer)
.analyze(Arrays.asList(unresolvedExpression), analysisContext, optimizer);
.analyze(List.of(unresolvedExpression), analysisContext, optimizer);
}

protected void assertAnalyzeEqual(
NamedExpression expected, UnresolvedExpression unresolvedExpression) {
assertEquals(Arrays.asList(expected), analyze(unresolvedExpression));
assertEquals(List.of(expected), analyze(unresolvedExpression));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void testFullyQualifiedName() {
@Test
void defaultDataSourceNameResolve() {
when(dataSourceService.dataSourceExists(any())).thenReturn(Boolean.FALSE);
identifierOf(Arrays.asList("tables"), dataSourceService)
identifierOf(List.of("tables"), dataSourceService)
.datasource(DEFAULT_DATASOURCE_NAME)
.schema(DEFAULT_SCHEMA_NAME)
.name("tables");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static Stream<Arguments> getValueTestArgumentStream() {
1D,
"1",
true,
Arrays.asList(integerValue(1)),
List.of(integerValue(1)),
ImmutableMap.of("1", integerValue(1)),
LocalDate.parse("2012-08-07"),
LocalTime.parse("18:00:00"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.opensearch.sql.expression.function.BuiltinFunctionName.CAST_TO_BOOLEAN;

import com.google.common.collect.ImmutableList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -73,7 +72,7 @@ void register() {
@Test
void compile() {
when(mockExpression.type()).thenReturn(UNDEFINED);
when(functionSignature.getParamTypeList()).thenReturn(Arrays.asList(UNDEFINED));
when(functionSignature.getParamTypeList()).thenReturn(List.of(UNDEFINED));
when(mockfunctionResolver.getFunctionName()).thenReturn(mockFunctionName);
when(mockfunctionResolver.resolve(any()))
.thenReturn(Pair.of(functionSignature, functionExpressionBuilder));
Expand All @@ -82,15 +81,15 @@ void compile() {
BuiltinFunctionRepository repo = new BuiltinFunctionRepository(mockMap);
repo.register(mockfunctionResolver);

repo.compile(functionProperties, mockFunctionName, Arrays.asList(mockExpression));
repo.compile(functionProperties, mockFunctionName, List.of(mockExpression));
verify(functionExpressionBuilder, times(1)).apply(eq(functionProperties), any());
}

@Test
void compile_datasource_defined_function() {
DefaultFunctionResolver dataSourceFunctionResolver = mock(DefaultFunctionResolver.class);
when(mockExpression.type()).thenReturn(UNDEFINED);
when(functionSignature.getParamTypeList()).thenReturn(Arrays.asList(UNDEFINED));
when(functionSignature.getParamTypeList()).thenReturn(List.of(UNDEFINED));
when(dataSourceFunctionResolver.getFunctionName()).thenReturn(mockFunctionName);
when(dataSourceFunctionResolver.resolve(any()))
.thenReturn(Pair.of(functionSignature, functionExpressionBuilder));
Expand All @@ -100,7 +99,7 @@ void compile_datasource_defined_function() {
functionProperties,
Collections.singletonList(dataSourceFunctionResolver),
mockFunctionName,
Arrays.asList(mockExpression));
List.of(mockExpression));
verify(functionExpressionBuilder, times(1)).apply(eq(functionProperties), any());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import static org.opensearch.sql.planner.logical.LogicalPlanDSL.window;

import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -92,12 +91,12 @@ public void visit_should_return_default_physical_operator() {
ReferenceExpression exclude = ref("name", STRING);
ReferenceExpression dedupeField = ref("name", STRING);
Expression filterExpr = literal(ExprBooleanValue.of(true));
List<NamedExpression> groupByExprs = Arrays.asList(DSL.named("age", ref("age", INTEGER)));
List<Expression> aggExprs = Arrays.asList(ref("age", INTEGER));
List<NamedExpression> groupByExprs = List.of(DSL.named("age", ref("age", INTEGER)));
List<Expression> aggExprs = List.of(ref("age", INTEGER));
ReferenceExpression rareTopNField = ref("age", INTEGER);
List<Expression> topByExprs = Arrays.asList(ref("age", INTEGER));
List<Expression> topByExprs = List.of(ref("age", INTEGER));
List<NamedAggregator> aggregators =
Arrays.asList(DSL.named("avg(age)", new AvgAggregator(aggExprs, ExprCoreType.DOUBLE)));
List.of(DSL.named("avg(age)", new AvgAggregator(aggExprs, ExprCoreType.DOUBLE)));
Map<ReferenceExpression, ReferenceExpression> mappings =
ImmutableMap.of(ref("name", STRING), ref("lastname", STRING));
Pair<ReferenceExpression, Expression> newEvalField =
Expand Down
Loading
Loading