Skip to content

Commit 3d90216

Browse files
Atri SharmaAtri Sharma
authored andcommitted
Make spotless changes
Signed-off-by: Atri Sharma <atrisharma@Atris-Mac-Studio.local>
1 parent dfcbbed commit 3d90216

9 files changed

+42
-60
lines changed

server/src/main/java/org/opensearch/action/search/StreamSearchTransportService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import org.apache.logging.log4j.LogManager;
1212
import org.apache.logging.log4j.Logger;
1313
import org.opensearch.action.OriginalIndices;
14+
import org.opensearch.action.support.StreamSearchChannelListener;
1415
import org.opensearch.cluster.node.DiscoveryNode;
1516
import org.opensearch.common.Nullable;
16-
import org.opensearch.action.support.StreamSearchChannelListener;
1717
import org.opensearch.common.settings.Setting;
1818
import org.opensearch.core.action.ActionListener;
1919
import org.opensearch.core.common.io.stream.StreamInput;
@@ -267,10 +267,10 @@ public FetchSearchResult read(StreamInput in) throws IOException {
267267
}
268268
};
269269
transportService.sendChildRequest(
270-
connection,
271-
FETCH_ID_ACTION_NAME,
272-
request,
273-
task,
270+
connection,
271+
FETCH_ID_ACTION_NAME,
272+
request,
273+
task,
274274
TransportRequestOptions.builder().withType(TransportRequestOptions.Type.STREAM).build(),
275275
transportHandler
276276
);

server/src/main/java/org/opensearch/action/search/TransportSearchAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ AbstractSearchAsyncAction<? extends SearchPhaseResult> searchAsyncAction(
12471247
// Check if streaming transport is actually available and enabled
12481248
final boolean streamingEnabledSetting = clusterService.getClusterSettings().get(StreamSearchTransportService.STREAM_SEARCH_ENABLED);
12491249
final boolean canUseStreamingTransport = (streamSearchTransportService != null) && streamingEnabledSetting;
1250-
1250+
12511251
// Use streaming transport for streaming search requests
12521252
final boolean useStreamingTransport = isStreamingCandidate && canUseStreamingTransport;
12531253

server/src/test/java/org/opensearch/action/search/StreamSearchActionListenerTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import org.opensearch.action.OriginalIndices;
1212
import org.opensearch.core.index.shard.ShardId;
13-
import org.opensearch.search.SearchPhaseResult;
1413
import org.opensearch.search.SearchShardTarget;
1514
import org.opensearch.search.internal.ShardSearchContextId;
1615
import org.opensearch.search.query.QuerySearchResult;

server/src/test/java/org/opensearch/action/search/StreamSearchIntegrationTests.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818
import org.opensearch.action.bulk.BulkRequest;
1919
import org.opensearch.action.bulk.BulkResponse;
2020
import org.opensearch.action.index.IndexRequest;
21-
import org.opensearch.action.search.SearchAction;
22-
import org.opensearch.action.search.StreamSearchAction;
2321
import org.opensearch.common.network.NetworkService;
2422
import org.opensearch.common.settings.Settings;
2523
import org.opensearch.common.unit.TimeValue;
26-
import org.opensearch.common.util.BigArrays;
2724
import org.opensearch.common.util.PageCacheRecycler;
2825
import org.opensearch.common.xcontent.XContentType;
2926
import org.opensearch.core.common.io.stream.NamedWriteableRegistry;
@@ -32,12 +29,10 @@
3229
import org.opensearch.plugins.NetworkPlugin;
3330
import org.opensearch.plugins.Plugin;
3431
import org.opensearch.search.SearchHit;
35-
import org.opensearch.search.SearchHits;
3632
import org.opensearch.search.aggregations.AggregationBuilders;
3733
import org.opensearch.search.aggregations.bucket.terms.StringTerms;
3834
import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
3935
import org.opensearch.search.aggregations.metrics.Max;
40-
import org.opensearch.search.query.StreamingSearchMode;
4136
import org.opensearch.search.sort.SortOrder;
4237
import org.opensearch.telemetry.tracing.Tracer;
4338
import org.opensearch.test.OpenSearchIntegTestCase;
@@ -53,7 +48,6 @@
5348
import java.util.Map;
5449
import java.util.function.Supplier;
5550

56-
5751
/**
5852
* Integration tests for streaming search functionality.
5953
*

server/src/test/java/org/opensearch/action/search/StreamTransportResponseHandlerContractTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
import org.opensearch.action.OriginalIndices;
1212
import org.opensearch.core.common.io.stream.StreamInput;
13-
import org.opensearch.core.transport.TransportResponse;
1413
import org.opensearch.core.index.shard.ShardId;
14+
import org.opensearch.core.transport.TransportResponse;
1515
import org.opensearch.search.SearchPhaseResult;
1616
import org.opensearch.search.SearchShardTarget;
1717
import org.opensearch.search.internal.ShardSearchContextId;
@@ -267,7 +267,8 @@ public void testHandlerClosesStreamAfterProcessing() throws IOException {
267267
public void handleStreamResponse(StreamTransportResponse<SearchPhaseResult> response) {
268268
try {
269269
SearchPhaseResult result;
270-
while ((result = response.nextResponse()) != null) {}
270+
while ((result = response.nextResponse()) != null) {
271+
}
271272
response.close();
272273
} catch (Exception e) {
273274
response.cancel("Error", e);

server/src/test/java/org/opensearch/search/DefaultSearchContextStreamingTests.java

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
import org.opensearch.action.search.SearchRequest;
1919
import org.opensearch.action.search.SearchType;
2020
import org.opensearch.common.UUIDs;
21+
import org.opensearch.common.settings.Settings;
2122
import org.opensearch.common.util.BigArrays;
2223
import org.opensearch.common.util.MockBigArrays;
2324
import org.opensearch.common.util.MockPageCacheRecycler;
24-
import org.opensearch.common.settings.Settings;
2525
import org.opensearch.core.index.shard.ShardId;
2626
import org.opensearch.core.indices.breaker.NoneCircuitBreakerService;
2727
import org.opensearch.index.IndexService;
@@ -72,15 +72,17 @@ public void testStreamingFlagsSetWhenStreamingRequested() throws Exception {
7272
when(indexShard.getQueryCachingPolicy()).thenReturn(queryCachingPolicy);
7373
when(indexShard.getThreadPool()).thenReturn(threadPool);
7474

75-
org.opensearch.cluster.metadata.IndexMetadata indexMetadata =
76-
org.opensearch.cluster.metadata.IndexMetadata.builder("test-index")
77-
.settings(Settings.builder()
75+
org.opensearch.cluster.metadata.IndexMetadata indexMetadata = org.opensearch.cluster.metadata.IndexMetadata.builder(
76+
"test-index"
77+
)
78+
.settings(
79+
Settings.builder()
7880
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED, org.opensearch.Version.CURRENT)
7981
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
80-
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0))
81-
.build();
82-
org.opensearch.index.IndexSettings indexSettings =
83-
new org.opensearch.index.IndexSettings(indexMetadata, Settings.EMPTY);
82+
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
83+
)
84+
.build();
85+
org.opensearch.index.IndexSettings indexSettings = new org.opensearch.index.IndexSettings(indexMetadata, Settings.EMPTY);
8486
when(indexShard.indexSettings()).thenReturn(indexSettings);
8587

8688
IndexService indexService = mock(IndexService.class);
@@ -161,15 +163,17 @@ public void testStreamingFlagsScoredUnsortedMode() throws Exception {
161163
when(indexShard.getQueryCachingPolicy()).thenReturn(queryCachingPolicy);
162164
when(indexShard.getThreadPool()).thenReturn(threadPool);
163165

164-
org.opensearch.cluster.metadata.IndexMetadata indexMetadata =
165-
org.opensearch.cluster.metadata.IndexMetadata.builder("test-index")
166-
.settings(Settings.builder()
166+
org.opensearch.cluster.metadata.IndexMetadata indexMetadata = org.opensearch.cluster.metadata.IndexMetadata.builder(
167+
"test-index"
168+
)
169+
.settings(
170+
Settings.builder()
167171
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED, org.opensearch.Version.CURRENT)
168172
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
169-
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0))
170-
.build();
171-
org.opensearch.index.IndexSettings indexSettings =
172-
new org.opensearch.index.IndexSettings(indexMetadata, Settings.EMPTY);
173+
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
174+
)
175+
.build();
176+
org.opensearch.index.IndexSettings indexSettings = new org.opensearch.index.IndexSettings(indexMetadata, Settings.EMPTY);
173177
when(indexShard.indexSettings()).thenReturn(indexSettings);
174178

175179
IndexService indexService = mock(IndexService.class);
@@ -250,15 +254,17 @@ public void testNonStreamingDoesNotSetStreamingFlags() throws Exception {
250254
when(indexShard.getQueryCachingPolicy()).thenReturn(queryCachingPolicy);
251255
when(indexShard.getThreadPool()).thenReturn(threadPool);
252256

253-
org.opensearch.cluster.metadata.IndexMetadata indexMetadata =
254-
org.opensearch.cluster.metadata.IndexMetadata.builder("test-index")
255-
.settings(Settings.builder()
257+
org.opensearch.cluster.metadata.IndexMetadata indexMetadata = org.opensearch.cluster.metadata.IndexMetadata.builder(
258+
"test-index"
259+
)
260+
.settings(
261+
Settings.builder()
256262
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED, org.opensearch.Version.CURRENT)
257263
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
258-
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0))
259-
.build();
260-
org.opensearch.index.IndexSettings indexSettings =
261-
new org.opensearch.index.IndexSettings(indexMetadata, Settings.EMPTY);
264+
.put(org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
265+
)
266+
.build();
267+
org.opensearch.index.IndexSettings indexSettings = new org.opensearch.index.IndexSettings(indexMetadata, Settings.EMPTY);
262268
when(indexShard.indexSettings()).thenReturn(indexSettings);
263269

264270
IndexService indexService = mock(IndexService.class);

server/src/test/java/org/opensearch/search/query/StreamingCollectorContextsTests.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ public void setUp() throws Exception {
3636
}
3737

3838
public void testStreamingUnsortedCollectorContextInstantiation() throws IOException {
39-
StreamingUnsortedCollectorContext context1 = new StreamingUnsortedCollectorContext(
40-
"test_unsorted",
41-
10,
42-
mockSearchContext
43-
);
39+
StreamingUnsortedCollectorContext context1 = new StreamingUnsortedCollectorContext("test_unsorted", 10, mockSearchContext);
4440
assertNotNull(context1);
4541
assertEquals(10, context1.numHits());
4642

@@ -86,11 +82,7 @@ public void testStreamingScoredUnsortedCollectorContextInstantiation() throws IO
8682
}
8783

8884
public void testStreamingSortedCollectorContextInstantiation() throws IOException {
89-
StreamingSortedCollectorContext context1 = new StreamingSortedCollectorContext(
90-
"test_sorted",
91-
10,
92-
mockSearchContext
93-
);
85+
StreamingSortedCollectorContext context1 = new StreamingSortedCollectorContext("test_sorted", 10, mockSearchContext);
9486
assertNotNull(context1);
9587
assertEquals(10, context1.numHits());
9688

server/src/test/java/org/opensearch/search/query/StreamingQuerySelectionTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.opensearch.common.util.BigArrays;
1313
import org.opensearch.core.common.breaker.CircuitBreaker;
1414
import org.opensearch.core.common.breaker.NoopCircuitBreaker;
15-
import org.opensearch.search.query.StreamingSearchMode;
1615
import org.opensearch.search.internal.SearchContext;
1716
import org.opensearch.search.sort.SortAndFormats;
1817
import org.opensearch.test.OpenSearchTestCase;

server/src/test/java/org/opensearch/search/query/TopDocsCollectorContextEntrypointTests.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ public void testStreamingBranchSelectedWhenStreamingEnabled() throws IOException
3131
when(mockSearchContext.size()).thenReturn(10);
3232
when(mockSearchContext.bigArrays()).thenReturn(mockBigArrays);
3333

34-
TopDocsCollectorContext context = TopDocsCollectorContext.createTopDocsCollectorContext(
35-
mockSearchContext,
36-
false
37-
);
34+
TopDocsCollectorContext context = TopDocsCollectorContext.createTopDocsCollectorContext(mockSearchContext, false);
3835

3936
assertNotNull(context);
4037
assertTrue(context instanceof StreamingUnsortedCollectorContext);
@@ -51,10 +48,7 @@ public void testStreamingBranchSelectedForScoredSorted() throws IOException {
5148
when(mockSearchContext.bigArrays()).thenReturn(mockBigArrays);
5249
when(mockSearchContext.sort()).thenReturn(null);
5350

54-
TopDocsCollectorContext context = TopDocsCollectorContext.createTopDocsCollectorContext(
55-
mockSearchContext,
56-
false
57-
);
51+
TopDocsCollectorContext context = TopDocsCollectorContext.createTopDocsCollectorContext(mockSearchContext, false);
5852

5953
assertNotNull(context);
6054
assertTrue(context instanceof StreamingSortedCollectorContext);
@@ -70,10 +64,7 @@ public void testStreamingBranchSelectedForScoredUnsorted() throws IOException {
7064
when(mockSearchContext.size()).thenReturn(10);
7165
when(mockSearchContext.bigArrays()).thenReturn(mockBigArrays);
7266

73-
TopDocsCollectorContext context = TopDocsCollectorContext.createTopDocsCollectorContext(
74-
mockSearchContext,
75-
false
76-
);
67+
TopDocsCollectorContext context = TopDocsCollectorContext.createTopDocsCollectorContext(mockSearchContext, false);
7768

7869
assertNotNull(context);
7970
assertTrue(context instanceof StreamingScoredUnsortedCollectorContext);

0 commit comments

Comments
 (0)