Skip to content

Commit

Permalink
Address static checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
gianm committed Mar 19, 2024
1 parent 6b7d766 commit 75376ce
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
import org.apache.druid.msq.input.stage.StageInputSpec;
import org.apache.druid.msq.input.stage.StageInputSpecSlicer;
import org.apache.druid.msq.input.table.TableInputSpec;
import org.apache.druid.msq.kernel.GlobalSortShuffleSpec;
import org.apache.druid.msq.kernel.QueryDefinition;
import org.apache.druid.msq.kernel.QueryDefinitionBuilder;
import org.apache.druid.msq.kernel.StageDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.apache.druid.msq.kernel;

import com.google.common.base.Preconditions;
import org.apache.druid.java.util.common.ISE;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void onFailure(Throwable t)
/**
* Create a client to communicate with a given worker ID.
*/
protected abstract ServiceClient getClient(final String workerId);
protected abstract ServiceClient getClient(String workerId);

/**
* Deserialize a {@link BytesFullResponseHolder} as JSON.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,16 @@ public void testReplaceTombstonesWithTooManyBucketsThrowsFault()
.dataSource("foo1")
.build();

Mockito.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);
Mockito
.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);

String expectedError = new TooManyBucketsFault(Limits.MAX_PARTITION_BUCKETS).getErrorMessage();

Expand Down Expand Up @@ -560,15 +561,16 @@ public void testReplaceTombstonesWithTooManyBucketsThrowsFault2()
.dataSource("foo1")
.build();

Mockito.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);
Mockito
.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);

String expectedError = new TooManyBucketsFault(Limits.MAX_PARTITION_BUCKETS).getErrorMessage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1412,15 +1412,16 @@ public void testEmptyReplaceAllOverEternitySegment()
.dataSource("foo1")
.build();

Mockito.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);
Mockito
.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);

// Insert with a condition which results in 0 rows being inserted -- do nothing.
testIngestQuery().setSql(
Expand Down Expand Up @@ -1450,15 +1451,16 @@ public void testEmptyReplaceAllWithAllGrainOverFiniteIntervalSegment()
.version(MSQTestTaskActionClient.VERSION)
.dataSource("foo1")
.build();
Mockito.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);
Mockito
.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);

// Insert with a condition which results in 0 rows being inserted -- do nothing.
testIngestQuery().setSql(
Expand Down Expand Up @@ -1488,15 +1490,16 @@ public void testEmptyReplaceAllWithAllGrainOverEternitySegment()
.dataSource("foo1")
.build();

Mockito.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);
Mockito
.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);

// Insert with a condition which results in 0 rows being inserted -- do nothing.
testIngestQuery().setSql(
Expand Down Expand Up @@ -1575,15 +1578,16 @@ public void testEmptyReplaceIntervalOverEternitySegment()
.dataSource("foo1")
.build();

Mockito.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);
Mockito
.doReturn(ImmutableSet.of(existingDataSegment))
.when(testTaskActionClient)
.submit(
ArgumentMatchers.argThat(
(ArgumentMatcher<TaskAction<?>>) argument ->
argument instanceof RetrieveUsedSegmentsAction
&& "foo1".equals(((RetrieveUsedSegmentsAction) argument).getDataSource())
)
);

// Insert with a condition which results in 0 rows being inserted -- do nothing!
testIngestQuery().setSql(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void setUp() throws IOException
{
@Override
@SuppressWarnings("unchecked")
public <RetType> RetType submit(TaskAction<RetType> taskAction) throws IOException
public <RetType> RetType submit(TaskAction<RetType> taskAction)
{
if (taskAction instanceof RetrieveUsedSegmentsAction) {
final RetrieveUsedSegmentsAction retrieveUsedSegmentsAction = (RetrieveUsedSegmentsAction) taskAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;

public class MockQueryDefinitionBuilder
{
Expand Down Expand Up @@ -173,10 +172,6 @@ public MockQueryDefinitionBuilder defineStage(
final List<InputSpec> inputSpecs = new ArrayList<>();
final IntSet broadcastInputNumbers = new IntOpenHashSet();

adjacencyList.getOrDefault(stageNumber, new HashSet<>())
.stream()
.map(pair -> new StageInputSpec(pair.leftInt())).collect(Collectors.toList());

int inputNumber = 0;
for (final IntBooleanPair pair : adjacencyList.getOrDefault(stageNumber, Collections.emptySet())) {
inputSpecs.add(new StageInputSpec(pair.leftInt()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ public ListenableFuture<Void> postResultPartitionBoundaries(
)
{
try {
inMemoryWorkers.get(workerTaskId)
.postResultPartitionBoundaries(
partitionBoundaries,
stageId.getQueryId(),
stageId.getStageNumber()
);
inMemoryWorkers
.get(workerTaskId)
.postResultPartitionBoundaries(
partitionBoundaries,
stageId.getQueryId(),
stageId.getStageNumber()
);
return Futures.immediateFuture(null);
}
catch (Exception e) {
Expand Down

0 comments on commit 75376ce

Please sign in to comment.