[SPARK-36362][CORE][SQL][FOLLOWUP] Fix java linter errors

### What changes were proposed in this pull request?

This is a follow-up of #33594 to fix the Java linter error.

### Why are the changes needed?

To recover GitHub Action.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the GitHub Action.

Closes #33601 from dongjoon-hyun/SPARK-36362.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
This commit is contained in:
Dongjoon Hyun 2021-08-01 21:40:03 +09:00 committed by Hyukjin Kwon
parent c0d1860f25
commit 22c49226f7
8 changed files with 30 additions and 19 deletions

View file

@ -73,7 +73,8 @@ public abstract class DBIteratorSuite {
private static final BaseComparator NATURAL_ORDER = (t1, t2) -> t1.key.compareTo(t2.key);
private static final BaseComparator REF_INDEX_ORDER = (t1, t2) -> t1.id.compareTo(t2.id);
private static final BaseComparator COPY_INDEX_ORDER = (t1, t2) -> t1.name.compareTo(t2.name);
private static final BaseComparator NUMERIC_INDEX_ORDER = (t1, t2) -> Integer.compare(t1.num, t2.num);
private static final BaseComparator NUMERIC_INDEX_ORDER =
(t1, t2) -> Integer.compare(t1.num, t2.num);
private static final BaseComparator CHILD_INDEX_ORDER = (t1, t2) -> t1.child.compareTo(t2.child);
/**

View file

@ -305,7 +305,8 @@ public class RpcIntegrationSuite {
@Test
public void sendOneWayMessage() throws Exception {
final String message = "no reply";
try (TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
try (TransportClient client =
clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
client.send(JavaUtils.stringToBytes(message));
assertEquals(0, client.getHandler().numOutstandingRequests());

View file

@ -24,7 +24,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
@ -109,7 +108,8 @@ public class StreamSuite {
@Test
public void testZeroLengthStream() throws Throwable {
try (TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
try (TransportClient client =
clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
StreamTask task = new StreamTask(client, "emptyBuffer", TimeUnit.SECONDS.toMillis(5));
task.run();
task.check();
@ -118,7 +118,8 @@ public class StreamSuite {
@Test
public void testSingleStream() throws Throwable {
try (TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
try (TransportClient client =
clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
StreamTask task = new StreamTask(client, "largeBuffer", TimeUnit.SECONDS.toMillis(5));
task.run();
task.check();
@ -127,7 +128,8 @@ public class StreamSuite {
@Test
public void testMultipleStreams() throws Throwable {
try (TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
try (TransportClient client =
clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
for (int i = 0; i < 20; i++) {
StreamTask task = new StreamTask(client, STREAMS[i % STREAMS.length],
TimeUnit.SECONDS.toMillis(5));
@ -141,7 +143,8 @@ public class StreamSuite {
public void testConcurrentStreams() throws Throwable {
ExecutorService executor = Executors.newFixedThreadPool(20);
try (TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
try (TransportClient client =
clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
List<StreamTask> tasks = new ArrayList<>();
for (int i = 0; i < 20; i++) {
StreamTask task = new StreamTask(client, STREAMS[i % STREAMS.length],

View file

@ -19,7 +19,6 @@ package org.apache.spark.network.crypto;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;
import java.util.Arrays;
import java.util.Map;
import java.security.InvalidKeyException;
import java.util.Random;

View file

@ -108,7 +108,8 @@ public class NettyMemoryMetricsSuite {
Assert.assertNotNull(clientMetricMap.get(
MetricRegistry.name("shuffle-client", directMemoryMetric)));
try (TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
try (TransportClient client =
clientFactory.createClient(TestUtils.getLocalHost(), server.getPort())) {
Assert.assertTrue(client.isActive());
Assert.assertTrue(((Gauge<Long>)serverMetricMap.get(

View file

@ -906,7 +906,8 @@ public final class UTF8String implements Comparable<UTF8String>, Externalizable,
// the partial string of the padding
UTF8String remain = pad.substring(0, spaces - padChars * count);
int resultSize = Math.toIntExact((long) numBytes + (long) pad.numBytes * count + remain.numBytes);
int resultSize =
Math.toIntExact((long) numBytes + (long) pad.numBytes * count + remain.numBytes);
byte[] data = new byte[resultSize];
copyMemory(this.base, this.offset, data, BYTE_ARRAY_OFFSET, this.numBytes);
int offset = this.numBytes;
@ -939,7 +940,8 @@ public final class UTF8String implements Comparable<UTF8String>, Externalizable,
// the partial string of the padding
UTF8String remain = pad.substring(0, spaces - padChars * count);
int resultSize = Math.toIntExact((long) numBytes + (long) pad.numBytes * count + remain.numBytes);
int resultSize =
Math.toIntExact((long) numBytes + (long) pad.numBytes * count + remain.numBytes);
byte[] data = new byte[resultSize];
int offset = 0;

View file

@ -400,8 +400,12 @@ public class UTF8StringSuite {
public void split() {
UTF8String[] negativeAndZeroLimitCase =
new UTF8String[]{fromString("ab"), fromString("def"), fromString("ghi"), fromString("")};
assertArrayEquals(negativeAndZeroLimitCase, fromString("ab,def,ghi,").split(fromString(","), 0));
assertArrayEquals(negativeAndZeroLimitCase, fromString("ab,def,ghi,").split(fromString(","), -1));
assertArrayEquals(
negativeAndZeroLimitCase,
fromString("ab,def,ghi,").split(fromString(","), 0));
assertArrayEquals(
negativeAndZeroLimitCase,
fromString("ab,def,ghi,").split(fromString(","), -1));
assertArrayEquals(
new UTF8String[]{fromString("ab"), fromString("def,ghi,")},
fromString("ab,def,ghi,").split(fromString(","), 2));