mirror of https://github.com/apache/druid.git
fix some intellij inspections in druid-processing (#13823)
fix some intellij inspections in druid-processing
This commit is contained in:
parent
46eafa57e1
commit
614205f3bc
|
@ -25,6 +25,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||
/**
|
||||
* Annotation for suppressing spotbugs checks when necessary.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface SuppressFBWarnings
|
||||
{
|
||||
|
|
|
@ -86,6 +86,7 @@ public interface FirehoseFactory<T extends InputRowParser>
|
|||
return connect(parser, temporaryDirectory);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@JsonIgnore
|
||||
default boolean isSplittable()
|
||||
{
|
||||
|
|
|
@ -45,11 +45,6 @@ public class FirehoseFactoryToInputSourceAdaptor extends AbstractInputSource imp
|
|||
return firehoseFactory;
|
||||
}
|
||||
|
||||
public InputRowParser getInputRowParser()
|
||||
{
|
||||
return inputRowParser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSplittable()
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ public interface InputFormat
|
|||
* This method is not being used anywhere for now, but should be considered
|
||||
* in {@link SplittableInputSource#createSplits} in the future.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@JsonIgnore
|
||||
boolean isSplittable();
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.druid.indexer;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import org.apache.druid.java.util.common.IAE;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -133,12 +132,4 @@ public class TaskLocation
|
|||
{
|
||||
return Objects.hash(host, port, tlsPort);
|
||||
}
|
||||
|
||||
public HostAndPort toHostAndPort()
|
||||
{
|
||||
if (tlsPort >= 0) {
|
||||
return HostAndPort.fromParts(host, tlsPort);
|
||||
}
|
||||
return HostAndPort.fromParts(host, port);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,10 @@ import java.util.Map;
|
|||
|
||||
public interface TaskMetricsGetter
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
List<String> getKeys();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Nullable
|
||||
Map<String, Number> getTotalMetrics();
|
||||
}
|
||||
|
|
|
@ -171,11 +171,6 @@ public class DefineClassUtils
|
|||
return defineClass;
|
||||
}
|
||||
|
||||
static int getArrayLength(byte[] bytes)
|
||||
{
|
||||
return bytes.length;
|
||||
}
|
||||
|
||||
public static Class defineClass(
|
||||
Class<?> targetClass,
|
||||
byte[] byteCode,
|
||||
|
|
|
@ -47,6 +47,7 @@ import java.lang.annotation.Target;
|
|||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@SuppressWarnings("unused")
|
||||
@Constraint(validatedBy = HumanReadableBytesRange.HumanReadableBytesRangeValidator.class)
|
||||
public @interface HumanReadableBytesRange
|
||||
{
|
||||
|
@ -66,9 +67,11 @@ public @interface HumanReadableBytesRange
|
|||
//ConstraintValidator requires
|
||||
String message() default "value must be in the range of [{min}, {max}]";
|
||||
|
||||
|
||||
//ConstraintValidator requires
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
class HumanReadableBytesRangeValidator implements ConstraintValidator<HumanReadableBytesRange, Object>
|
||||
{
|
||||
private HumanReadableBytesRange range;
|
||||
|
|
|
@ -200,21 +200,13 @@ public final class Numbers
|
|||
return lobj;
|
||||
}
|
||||
// try as a double, for "ddd.dd" , Longs.tryParse(..) returns null
|
||||
Double dobj = Doubles.tryParse((String) val);
|
||||
Double dobj = Doubles.tryParse(val);
|
||||
if (dobj != null) {
|
||||
return dobj.longValue();
|
||||
}
|
||||
throw new NumberFormatException("Cannot parse string to long");
|
||||
}
|
||||
|
||||
public static int toIntExact(long value, String error)
|
||||
{
|
||||
if ((int) value != value) {
|
||||
throw new ArithmeticException(error);
|
||||
}
|
||||
return (int) value;
|
||||
}
|
||||
|
||||
private Numbers()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -21,12 +21,10 @@ package org.apache.druid.java.util.common;
|
|||
|
||||
import com.google.common.base.Strings;
|
||||
import it.unimi.dsi.fastutil.bytes.ByteArrayList;
|
||||
import it.unimi.dsi.fastutil.bytes.ByteList;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
@ -268,11 +266,6 @@ public class StringUtils
|
|||
return StringUtils.fromUtf8(buffer.elements(), 0, buffer.size());
|
||||
}
|
||||
|
||||
public static String fromUtf8(final ByteList buffer)
|
||||
{
|
||||
return StringUtils.fromUtf8(buffer.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* If buffer is Decodes a UTF-8 string from the remaining bytes of a buffer.
|
||||
* Advances the position of the buffer by {@link ByteBuffer#remaining()}.
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ParallelMergeCombiningSequence<T> extends YieldingSequenceBase<T>
|
|||
BinaryOperator<T> combineFn,
|
||||
boolean hasTimeout,
|
||||
long timeoutMillis,
|
||||
int queryPriority,
|
||||
@SuppressWarnings("unused") int queryPriority,
|
||||
int parallelism,
|
||||
int yieldAfter,
|
||||
int batchSize,
|
||||
|
|
|
@ -130,18 +130,6 @@ public final class Closer implements Closeable
|
|||
return closeable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a list of {@code Closeable} to be closed when this {@code Closer} is
|
||||
* {@linkplain #close closed}.
|
||||
*
|
||||
* @return the supplied list of {@code Closeable}
|
||||
*/
|
||||
public <C extends Closeable> Iterable<C> registerAll(Iterable<C> closeables)
|
||||
{
|
||||
closeables.forEach(this::register);
|
||||
return closeables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the given throwable and rethrows it. It will be rethrown as is if it is an
|
||||
* {@code IOException}, {@code RuntimeException} or {@code Error}. Otherwise, it will be rethrown
|
||||
|
|
|
@ -63,6 +63,7 @@ public class Logger
|
|||
return log;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
|
@ -79,15 +79,6 @@ public class EventMap extends HashMap<String, Object>
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds map entry to the map
|
||||
*/
|
||||
public Builder put(Map.Entry<String, Object> entry)
|
||||
{
|
||||
map.put(entry.getKey(), entry.getValue());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all key -> value pairs from other map
|
||||
*/
|
||||
|
|
|
@ -26,9 +26,9 @@ import org.apache.druid.java.util.emitter.core.HttpEmitterConfig;
|
|||
import org.apache.druid.java.util.emitter.core.HttpPostEmitter;
|
||||
import org.asynchttpclient.AsyncHttpClient;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class HttpEmitterFactory extends HttpEmitterConfig implements EmitterFactory
|
||||
{
|
||||
|
||||
@Override
|
||||
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)
|
||||
{
|
||||
|
|
|
@ -26,12 +26,9 @@ import org.apache.druid.java.util.emitter.core.LoggingEmitter;
|
|||
import org.apache.druid.java.util.emitter.core.LoggingEmitterConfig;
|
||||
import org.asynchttpclient.AsyncHttpClient;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class LoggingEmitterFactory extends LoggingEmitterConfig implements EmitterFactory
|
||||
{
|
||||
public LoggingEmitterFactory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.druid.java.util.emitter.core.Emitter;
|
|||
import org.apache.druid.java.util.emitter.core.NoopEmitter;
|
||||
import org.asynchttpclient.AsyncHttpClient;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NoopEmitterFactory implements EmitterFactory
|
||||
{
|
||||
@Override
|
||||
|
|
|
@ -26,9 +26,9 @@ import org.apache.druid.java.util.emitter.core.ParametrizedUriEmitter;
|
|||
import org.apache.druid.java.util.emitter.core.ParametrizedUriEmitterConfig;
|
||||
import org.asynchttpclient.AsyncHttpClient;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ParametrizedUriEmitterFactory extends ParametrizedUriEmitterConfig implements EmitterFactory
|
||||
{
|
||||
|
||||
@Override
|
||||
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ public class HttpClientProxyConfig
|
|||
@JsonProperty("password")
|
||||
private String password;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public HttpClientProxyConfig()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -49,5 +49,6 @@ public abstract class FullResponseHolder<T>
|
|||
/**
|
||||
* Get the data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public abstract T getContent();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ public abstract class AbstractMonitor implements Monitor
|
|||
started = false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public boolean isStarted()
|
||||
{
|
||||
return started;
|
||||
|
|
|
@ -21,5 +21,6 @@ package org.apache.druid.java.util.metrics;
|
|||
|
||||
public interface PidDiscoverer
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
long getPid();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ public class ProcFsReader
|
|||
private final File procDir;
|
||||
|
||||
private static final Logger LOG = new Logger(ProcFsReader.class);
|
||||
public static final Path DEFAULT_PROC_FS_ROOT = Paths.get("/proc/");
|
||||
private static final String BOOT_ID_PATH = "sys/kernel/random/boot_id";
|
||||
private static final String CPUINFO_PATH = "cpuinfo";
|
||||
|
||||
|
|
|
@ -1249,12 +1249,6 @@ public abstract class ExprEval<T>
|
|||
return new ArrayExpr(arrayType, value);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Object getIndex(int index)
|
||||
{
|
||||
return value == null ? null : value[index];
|
||||
}
|
||||
|
||||
protected boolean isScalar()
|
||||
{
|
||||
return value != null && value.length == 1;
|
||||
|
|
|
@ -34,7 +34,6 @@ public abstract class BivariateDoubleFunctionVectorValueProcessor<TLeftInput, TR
|
|||
{
|
||||
final ExprVectorProcessor<TLeftInput> left;
|
||||
final ExprVectorProcessor<TRightInput> right;
|
||||
final int maxVectorSize;
|
||||
final boolean[] outNulls;
|
||||
final double[] outValues;
|
||||
|
||||
|
@ -46,7 +45,6 @@ public abstract class BivariateDoubleFunctionVectorValueProcessor<TLeftInput, TR
|
|||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.maxVectorSize = maxVectorSize;
|
||||
this.outValues = new double[maxVectorSize];
|
||||
this.outNulls = new boolean[maxVectorSize];
|
||||
}
|
||||
|
|
|
@ -35,20 +35,17 @@ public abstract class BivariateFunctionVectorObjectProcessor<TLeftInput, TRightI
|
|||
{
|
||||
final ExprVectorProcessor<TLeftInput> left;
|
||||
final ExprVectorProcessor<TRightInput> right;
|
||||
final int maxVectorSize;
|
||||
final TOutput outValues;
|
||||
final boolean sqlCompatible = NullHandling.sqlCompatible();
|
||||
|
||||
protected BivariateFunctionVectorObjectProcessor(
|
||||
ExprVectorProcessor<TLeftInput> left,
|
||||
ExprVectorProcessor<TRightInput> right,
|
||||
int maxVectorSize,
|
||||
TOutput outValues
|
||||
)
|
||||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.maxVectorSize = maxVectorSize;
|
||||
this.outValues = outValues;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ public abstract class BivariateLongFunctionVectorValueProcessor<TLeftInput, TRig
|
|||
{
|
||||
final ExprVectorProcessor<TLeftInput> left;
|
||||
final ExprVectorProcessor<TRightInput> right;
|
||||
final int maxVectorSize;
|
||||
final boolean[] outNulls;
|
||||
final long[] outValues;
|
||||
|
||||
|
@ -46,7 +45,6 @@ public abstract class BivariateLongFunctionVectorValueProcessor<TLeftInput, TRig
|
|||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.maxVectorSize = maxVectorSize;
|
||||
this.outValues = new long[maxVectorSize];
|
||||
this.outNulls = new boolean[maxVectorSize];
|
||||
}
|
||||
|
|
|
@ -27,8 +27,6 @@ import org.apache.druid.math.expr.ExpressionType;
|
|||
public abstract class LongOutObjectInFunctionVectorProcessor
|
||||
extends UnivariateFunctionVectorObjectProcessor<Object[], long[]>
|
||||
{
|
||||
final ExpressionType inputType;
|
||||
|
||||
public LongOutObjectInFunctionVectorProcessor(
|
||||
ExprVectorProcessor<Object[]> processor,
|
||||
int maxVectorSize,
|
||||
|
@ -36,7 +34,6 @@ public abstract class LongOutObjectInFunctionVectorProcessor
|
|||
)
|
||||
{
|
||||
super(CastToTypeVectorProcessor.cast(processor, inputType), maxVectorSize, new long[maxVectorSize]);
|
||||
this.inputType = inputType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,6 @@ public abstract class LongOutObjectsInFunctionVectorProcessor
|
|||
super(
|
||||
CastToTypeVectorProcessor.cast(left, inputType),
|
||||
CastToTypeVectorProcessor.cast(right, inputType),
|
||||
maxVectorSize,
|
||||
new long[maxVectorSize]
|
||||
);
|
||||
this.outNulls = new boolean[maxVectorSize];
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.druid.math.expr.ExpressionType;
|
|||
public abstract class ObjectOutMultiObjectInVectorProcessor implements ExprVectorProcessor<Object[]>
|
||||
{
|
||||
final ExprVectorProcessor<Object[]>[] inputs;
|
||||
final int maxVectorSize;
|
||||
final Object[] outValues;
|
||||
|
||||
final ExpressionType expressionType;
|
||||
|
@ -40,7 +39,6 @@ public abstract class ObjectOutMultiObjectInVectorProcessor implements ExprVecto
|
|||
)
|
||||
{
|
||||
this.inputs = inputs;
|
||||
this.maxVectorSize = maxVectorSize;
|
||||
this.outValues = new Object[maxVectorSize];
|
||||
this.expressionType = objectType;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ public abstract class ObjectOutObjectsInFunctionVectorProcessor
|
|||
super(
|
||||
CastToTypeVectorProcessor.cast(left, expressionType),
|
||||
CastToTypeVectorProcessor.cast(right, expressionType),
|
||||
maxVectorSize,
|
||||
new Object[maxVectorSize]
|
||||
);
|
||||
this.expressionType = expressionType;
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.druid.math.expr.Expr;
|
|||
public abstract class UnivariateDoubleFunctionVectorValueProcessor<TInput> implements ExprVectorProcessor<double[]>
|
||||
{
|
||||
final ExprVectorProcessor<TInput> processor;
|
||||
final int maxVectorSize;
|
||||
final boolean[] outNulls;
|
||||
final double[] outValues;
|
||||
|
||||
|
@ -42,7 +41,6 @@ public abstract class UnivariateDoubleFunctionVectorValueProcessor<TInput> imple
|
|||
)
|
||||
{
|
||||
this.processor = processor;
|
||||
this.maxVectorSize = maxVectorSize;
|
||||
this.outNulls = new boolean[maxVectorSize];
|
||||
this.outValues = new double[maxVectorSize];
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.druid.math.expr.Expr;
|
|||
public abstract class UnivariateFunctionVectorObjectProcessor<TInput, TOutput> implements ExprVectorProcessor<TOutput>
|
||||
{
|
||||
final ExprVectorProcessor<TInput> processor;
|
||||
final int maxVectorSize;
|
||||
final boolean[] outNulls;
|
||||
final TOutput outValues;
|
||||
|
||||
|
@ -39,7 +38,6 @@ public abstract class UnivariateFunctionVectorObjectProcessor<TInput, TOutput> i
|
|||
)
|
||||
{
|
||||
this.processor = processor;
|
||||
this.maxVectorSize = maxVectorSize;
|
||||
this.outNulls = new boolean[maxVectorSize];
|
||||
this.outValues = outValues;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.druid.math.expr.Expr;
|
|||
public abstract class UnivariateLongFunctionVectorValueProcessor<TInput> implements ExprVectorProcessor<long[]>
|
||||
{
|
||||
final ExprVectorProcessor<TInput> processor;
|
||||
final int maxVectorSize;
|
||||
final boolean[] outNulls;
|
||||
final long[] outValues;
|
||||
|
||||
|
@ -42,7 +41,6 @@ public abstract class UnivariateLongFunctionVectorValueProcessor<TInput> impleme
|
|||
)
|
||||
{
|
||||
this.processor = processor;
|
||||
this.maxVectorSize = maxVectorSize;
|
||||
this.outNulls = new boolean[maxVectorSize];
|
||||
this.outValues = new long[maxVectorSize];
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||
*/
|
||||
public interface PasswordProviderRedactionMixIn
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
@JsonIgnore
|
||||
String getPassword();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.google.common.collect.Iterables;
|
|||
import com.google.common.primitives.Ints;
|
||||
import org.apache.druid.guice.annotations.PublicApi;
|
||||
import org.apache.druid.java.util.common.DateTimes;
|
||||
import org.apache.druid.java.util.common.IAE;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.query.SegmentDescriptor;
|
||||
import org.apache.druid.timeline.partition.ShardSpec;
|
||||
|
@ -41,7 +40,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
|
@ -233,18 +231,6 @@ public final class SegmentId implements Comparable<SegmentId>
|
|||
}
|
||||
}
|
||||
|
||||
public static Function<String, Interval> makeIntervalExtractor(final String dataSource)
|
||||
{
|
||||
return identifier -> {
|
||||
SegmentId segmentIdentifierParts = tryParse(dataSource, identifier);
|
||||
if (segmentIdentifierParts == null) {
|
||||
throw new IAE("Invalid identifier [%s]", identifier);
|
||||
}
|
||||
|
||||
return segmentIdentifierParts.getInterval();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a dummy SegmentId with the given data source. This method is useful in benchmark and test code.
|
||||
*/
|
||||
|
|
|
@ -79,17 +79,20 @@ public class BuildingSingleDimensionShardSpec extends BuildingDimensionRangeShar
|
|||
return jsonMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getDimension()
|
||||
{
|
||||
return dimension;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Nullable
|
||||
public String getStart()
|
||||
{
|
||||
return start;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Nullable
|
||||
public String getEnd()
|
||||
{
|
||||
|
|
|
@ -93,6 +93,7 @@ public class SingleDimensionShardSpec extends DimensionRangeShardSpec
|
|||
return jsonMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getDimension()
|
||||
{
|
||||
return dimension;
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.google.common.base.Preconditions;
|
|||
*/
|
||||
public class CircularBuffer<E>
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
public E[] getBuffer()
|
||||
{
|
||||
return buffer;
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.druid.guice.annotations.PublicApi;
|
|||
@PublicApi
|
||||
public class Runnables
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
public static Runnable getNoopRunnable()
|
||||
{
|
||||
return () -> {};
|
||||
|
|
Loading…
Reference in New Issue