diff --git a/codestyle/pmd-ruleset.xml b/codestyle/pmd-ruleset.xml index 7d7285d0a51..f10d4f3da19 100644 --- a/codestyle/pmd-ruleset.xml +++ b/codestyle/pmd-ruleset.xml @@ -29,4 +29,5 @@ This ruleset defines the PMD rules for the Apache Druid project. + diff --git a/extensions-contrib/aliyun-oss-extensions/src/main/java/org/apache/druid/storage/aliyun/OssUtils.java b/extensions-contrib/aliyun-oss-extensions/src/main/java/org/apache/druid/storage/aliyun/OssUtils.java index c9ec689ecca..b369870ed8c 100644 --- a/extensions-contrib/aliyun-oss-extensions/src/main/java/org/apache/druid/storage/aliyun/OssUtils.java +++ b/extensions-contrib/aliyun-oss-extensions/src/main/java/org/apache/druid/storage/aliyun/OssUtils.java @@ -227,7 +227,7 @@ public class OssUtils throws Exception { DeleteObjectsRequest deleteRequest = new DeleteObjectsRequest(bucket).withKeys(keysToDelete); - OssUtils.retry(() -> { + retry(() -> { client.deleteObjects(deleteRequest); return null; }); diff --git a/extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/Utils.java b/extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/Utils.java index a214bfd057a..b02765f92cc 100644 --- a/extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/Utils.java +++ b/extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/Utils.java @@ -128,7 +128,7 @@ public class Utils boolean strictNumberParse ) { - CompressedBigDecimal compressedBigDecimal = Utils.objToCompressedBigDecimal(obj, strictNumberParse); + CompressedBigDecimal compressedBigDecimal = objToCompressedBigDecimal(obj, strictNumberParse); if (compressedBigDecimal != null) { return scaleIfNeeded(compressedBigDecimal, scale); diff --git a/extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/PeonPhase.java b/extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/PeonPhase.java index 6efcd34872b..db155269d4f 100644 --- a/extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/PeonPhase.java +++ b/extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/PeonPhase.java @@ -34,7 +34,7 @@ public enum PeonPhase UNKNOWN("Unknown"), RUNNING("Running"); - private static final Map PHASE_MAP = Arrays.stream(PeonPhase.values()) + private static final Map PHASE_MAP = Arrays.stream(values()) .collect(Collectors.toMap( PeonPhase::getPhase, Function.identity() diff --git a/extensions-contrib/rabbit-stream-indexing-service/src/main/java/org/apache/druid/indexing/rabbitstream/supervisor/RabbitStreamSupervisorTuningConfig.java b/extensions-contrib/rabbit-stream-indexing-service/src/main/java/org/apache/druid/indexing/rabbitstream/supervisor/RabbitStreamSupervisorTuningConfig.java index a2667026fff..6b864014485 100644 --- a/extensions-contrib/rabbit-stream-indexing-service/src/main/java/org/apache/druid/indexing/rabbitstream/supervisor/RabbitStreamSupervisorTuningConfig.java +++ b/extensions-contrib/rabbit-stream-indexing-service/src/main/java/org/apache/druid/indexing/rabbitstream/supervisor/RabbitStreamSupervisorTuningConfig.java @@ -173,9 +173,7 @@ public class RabbitStreamSupervisorTuningConfig extends RabbitStreamIndexTaskTun public Duration getRepartitionTransitionDuration() { // just return a default for now. - return SeekableStreamSupervisorTuningConfig.defaultDuration( - null, - SeekableStreamSupervisorTuningConfig.DEFAULT_REPARTITION_TRANSITION_DURATION); + return SeekableStreamSupervisorTuningConfig.defaultDuration(null, DEFAULT_REPARTITION_TRANSITION_DURATION); } @Override diff --git a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchHolder.java b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchHolder.java index df0b884eaae..a79c4a5c4ab 100644 --- a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchHolder.java +++ b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchHolder.java @@ -38,15 +38,15 @@ public class HllSketchHolder if (obj instanceof HllSketchHolder) { return (HllSketchHolder) obj; } else if (obj instanceof HllSketch) { - return HllSketchHolder.of((HllSketch) obj); + return of((HllSketch) obj); } else if (obj instanceof Union) { - return HllSketchHolder.of((Union) obj); + return of((Union) obj); } else if (obj instanceof byte[]) { - return HllSketchHolder.of(HllSketch.heapify((byte[]) obj)); + return of(HllSketch.heapify((byte[]) obj)); } else if (obj instanceof Memory) { - return HllSketchHolder.of(HllSketch.wrap((Memory) obj)); + return of(HllSketch.wrap((Memory) obj)); } else if (obj instanceof String) { - return HllSketchHolder.of(HllSketch.heapify(StringUtils.decodeBase64(StringUtils.toUtf8((String) obj)))); + return of(HllSketch.heapify(StringUtils.decodeBase64(StringUtils.toUtf8((String) obj)))); } throw new ISE("Object is not of a type[%s] that can be deserialized to sketch.", obj.getClass()); diff --git a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchHolder.java b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchHolder.java index 0d1ac2f1bec..a2445590ecb 100644 --- a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchHolder.java +++ b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/theta/SketchHolder.java @@ -45,7 +45,7 @@ import java.util.Comparator; */ public class SketchHolder { - public static final SketchHolder EMPTY = SketchHolder.of( + public static final SketchHolder EMPTY = of( Sketches.updateSketchBuilder() .build() .compact(true, null) @@ -195,7 +195,7 @@ public class SketchHolder Union union = (Union) SetOperation.builder().setNominalEntries(nomEntries).build(Family.UNION); holder1.updateUnion(union); holder2.updateUnion(union); - return SketchHolder.of(union); + return of(union); } } @@ -208,15 +208,15 @@ public class SketchHolder public static SketchHolder deserialize(Object serializedSketch) { if (serializedSketch instanceof String) { - return SketchHolder.of(deserializeFromBase64EncodedString((String) serializedSketch)); + return of(deserializeFromBase64EncodedString((String) serializedSketch)); } else if (serializedSketch instanceof byte[]) { - return SketchHolder.of(deserializeFromByteArray((byte[]) serializedSketch)); + return of(deserializeFromByteArray((byte[]) serializedSketch)); } else if (serializedSketch instanceof SketchHolder) { return (SketchHolder) serializedSketch; } else if (serializedSketch instanceof Sketch || serializedSketch instanceof Union || serializedSketch instanceof Memory) { - return SketchHolder.of(serializedSketch); + return of(serializedSketch); } throw new ISE( @@ -228,9 +228,9 @@ public class SketchHolder public static SketchHolder deserializeSafe(Object serializedSketch) { if (serializedSketch instanceof String) { - return SketchHolder.of(deserializeFromBase64EncodedStringSafe((String) serializedSketch)); + return of(deserializeFromBase64EncodedStringSafe((String) serializedSketch)); } else if (serializedSketch instanceof byte[]) { - return SketchHolder.of(deserializeFromByteArraySafe((byte[]) serializedSketch)); + return of(deserializeFromByteArraySafe((byte[]) serializedSketch)); } return deserialize(serializedSketch); @@ -285,13 +285,13 @@ public class SketchHolder for (Object o : holders) { ((SketchHolder) o).updateUnion(union); } - return SketchHolder.of(union); + return of(union); case INTERSECT: Intersection intersection = (Intersection) SetOperation.builder().setNominalEntries(sketchSize).build(Family.INTERSECTION); for (Object o : holders) { intersection.intersect(((SketchHolder) o).getSketch()); } - return SketchHolder.of(intersection.getResult(false, null)); + return of(intersection.getResult(false, null)); case NOT: if (holders.length < 1) { throw new IllegalArgumentException("A-Not-B requires at least 1 sketch"); @@ -306,7 +306,7 @@ public class SketchHolder AnotB anotb = (AnotB) SetOperation.builder().setNominalEntries(sketchSize).build(Family.A_NOT_B); result = anotb.aNotB(result, ((SketchHolder) holders[i]).getSketch()); } - return SketchHolder.of(result); + return of(result); default: throw new IllegalArgumentException("Unknown sketch operation " + func); } diff --git a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/BasicAuthUtils.java b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/BasicAuthUtils.java index 5169ae56d8e..410fb679c61 100644 --- a/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/BasicAuthUtils.java +++ b/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/BasicAuthUtils.java @@ -172,7 +172,7 @@ public class BasicAuthUtils userMap = new HashMap<>(); } else { try { - userMap = objectMapper.readValue(userMapBytes, BasicAuthUtils.AUTHORIZER_USER_MAP_TYPE_REFERENCE); + userMap = objectMapper.readValue(userMapBytes, AUTHORIZER_USER_MAP_TYPE_REFERENCE); } catch (IOException ioe) { throw new RuntimeException("Couldn't deserialize authorizer userMap!", ioe); @@ -201,7 +201,7 @@ public class BasicAuthUtils groupMappingMap = new HashMap<>(); } else { try { - groupMappingMap = objectMapper.readValue(groupMappingMapBytes, BasicAuthUtils.AUTHORIZER_GROUP_MAPPING_MAP_TYPE_REFERENCE); + groupMappingMap = objectMapper.readValue(groupMappingMapBytes, AUTHORIZER_GROUP_MAPPING_MAP_TYPE_REFERENCE); } catch (IOException ioe) { throw new RuntimeException("Couldn't deserialize authorizer groupMappingMap!", ioe); @@ -230,7 +230,7 @@ public class BasicAuthUtils roleMap = new HashMap<>(); } else { try { - roleMap = objectMapper.readValue(roleMapBytes, BasicAuthUtils.AUTHORIZER_ROLE_MAP_TYPE_REFERENCE); + roleMap = objectMapper.readValue(roleMapBytes, AUTHORIZER_ROLE_MAP_TYPE_REFERENCE); } catch (IOException ioe) { throw new RuntimeException("Couldn't deserialize authorizer roleMap!", ioe); diff --git a/extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/CatalogException.java b/extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/CatalogException.java index c09fe35a5a1..e7a7d63e1ec 100644 --- a/extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/CatalogException.java +++ b/extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/CatalogException.java @@ -79,7 +79,7 @@ public class CatalogException extends Exception public static CatalogException badRequest(String msg, Object...args) { return new CatalogException( - CatalogException.INVALID_ERROR, + INVALID_ERROR, Response.Status.BAD_REQUEST, msg, args diff --git a/extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsStorageDruidModule.java b/extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsStorageDruidModule.java index e2c79785fe4..159c247becc 100644 --- a/extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsStorageDruidModule.java +++ b/extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsStorageDruidModule.java @@ -65,9 +65,9 @@ public class HdfsStorageDruidModule implements DruidModule { return Collections.singletonList( new SimpleModule().registerSubtypes( - new NamedType(HdfsLoadSpec.class, HdfsStorageDruidModule.SCHEME), - new NamedType(HdfsInputSource.class, HdfsStorageDruidModule.SCHEME), - new NamedType(HdfsInputSourceFactory.class, HdfsStorageDruidModule.SCHEME) + new NamedType(HdfsLoadSpec.class, SCHEME), + new NamedType(HdfsInputSource.class, SCHEME), + new NamedType(HdfsInputSourceFactory.class, SCHEME) ) ); } diff --git a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorTuningConfig.java b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorTuningConfig.java index 1e0b3587409..4186837bbb0 100644 --- a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorTuningConfig.java +++ b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorTuningConfig.java @@ -169,7 +169,7 @@ public class KafkaSupervisorTuningConfig extends KafkaIndexTaskTuningConfig // just return a default for now. return SeekableStreamSupervisorTuningConfig.defaultDuration( null, - SeekableStreamSupervisorTuningConfig.DEFAULT_REPARTITION_TRANSITION_DURATION + DEFAULT_REPARTITION_TRANSITION_DURATION ); } diff --git a/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/DefaultK8sApiClient.java b/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/DefaultK8sApiClient.java index 00ad6b76abb..04ee4683274 100644 --- a/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/DefaultK8sApiClient.java +++ b/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/DefaultK8sApiClient.java @@ -131,7 +131,7 @@ public class DefaultK8sApiClient implements K8sApiClient try { while (watch.hasNext()) { Watch.Response item = watch.next(); - if (item != null && item.type != null && !item.type.equals(WatchResult.BOOKMARK)) { + if (item != null && item.type != null && !BOOKMARK.equals(item.type)) { DiscoveryDruidNodeAndResourceVersion result = null; if (item.object != null) { result = new DiscoveryDruidNodeAndResourceVersion( @@ -150,7 +150,7 @@ public class DefaultK8sApiClient implements K8sApiClient result ); return true; - } else if (item != null && item.type != null && item.type.equals(WatchResult.BOOKMARK)) { + } else if (item != null && item.type != null && BOOKMARK.equals(item.type)) { // Events with type BOOKMARK will only contain resourceVersion and no metadata. See // Kubernetes API documentation for details. LOGGER.debug("BOOKMARK event fired, no nothing, only update resourceVersion"); diff --git a/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/K8sDruidNodeAnnouncer.java b/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/K8sDruidNodeAnnouncer.java index f47fcfc0c9a..184b766128f 100644 --- a/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/K8sDruidNodeAnnouncer.java +++ b/extensions-core/kubernetes-extensions/src/main/java/org/apache/druid/k8s/discovery/K8sDruidNodeAnnouncer.java @@ -208,8 +208,8 @@ public class K8sDruidNodeAnnouncer implements DruidNodeAnnouncer "%s=%s,%s=%s", getClusterIdentifierAnnouncementLabel(), discoveryConfig.getClusterIdentifier(), - K8sDruidNodeAnnouncer.getRoleAnnouncementLabel(nodeRole), - K8sDruidNodeAnnouncer.ANNOUNCEMENT_DONE + getRoleAnnouncementLabel(nodeRole), + ANNOUNCEMENT_DONE ); } @@ -219,9 +219,9 @@ public class K8sDruidNodeAnnouncer implements DruidNodeAnnouncer "%s=%s,%s=%s,%s=%s", getClusterIdentifierAnnouncementLabel(), discoveryConfig.getClusterIdentifier(), - K8sDruidNodeAnnouncer.getRoleAnnouncementLabel(nodeRole), - K8sDruidNodeAnnouncer.ANNOUNCEMENT_DONE, - K8sDruidNodeAnnouncer.getIdHashAnnouncementLabel(), + getRoleAnnouncementLabel(nodeRole), + ANNOUNCEMENT_DONE, + getIdHashAnnouncementLabel(), hashEncodeStringForLabelValue(node.getHostAndPortToUse()) ); } diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/processor/SegmentGeneratorFrameProcessorFactory.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/processor/SegmentGeneratorFrameProcessorFactory.java index 1796df89bf7..039fb233e4c 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/processor/SegmentGeneratorFrameProcessorFactory.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/processor/SegmentGeneratorFrameProcessorFactory.java @@ -287,7 +287,7 @@ public class SegmentGeneratorFrameProcessorFactory @Override public AppendableIndexSpec getAppendableIndexSpec() { - return TuningConfig.DEFAULT_APPENDABLE_INDEX; + return DEFAULT_APPENDABLE_INDEX; } @Override @@ -346,7 +346,7 @@ public class SegmentGeneratorFrameProcessorFactory @Override public boolean isSkipBytesInMemoryOverheadCheck() { - return TuningConfig.DEFAULT_SKIP_BYTES_IN_MEMORY_OVERHEAD_CHECK; + return DEFAULT_SKIP_BYTES_IN_MEMORY_OVERHEAD_CHECK; } @Override diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java index bc0c64c251a..ea6b00a8c86 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java @@ -111,7 +111,7 @@ public class QueryKitUtils return clusterBy; } else { final List newColumns = new ArrayList<>(clusterBy.getColumns().size() + 1); - newColumns.add(new KeyColumn(QueryKitUtils.SEGMENT_GRANULARITY_COLUMN, KeyOrder.ASCENDING)); + newColumns.add(new KeyColumn(SEGMENT_GRANULARITY_COLUMN, KeyOrder.ASCENDING)); newColumns.addAll(clusterBy.getColumns()); return new ClusterBy(newColumns, 1); } @@ -123,10 +123,10 @@ public class QueryKitUtils */ public static void verifyRowSignature(final RowSignature signature) { - if (signature.contains(QueryKitUtils.PARTITION_BOOST_COLUMN)) { - throw new MSQException(new ColumnNameRestrictedFault(QueryKitUtils.PARTITION_BOOST_COLUMN)); - } else if (signature.contains(QueryKitUtils.SEGMENT_GRANULARITY_COLUMN)) { - throw new MSQException(new ColumnNameRestrictedFault(QueryKitUtils.SEGMENT_GRANULARITY_COLUMN)); + if (signature.contains(PARTITION_BOOST_COLUMN)) { + throw new MSQException(new ColumnNameRestrictedFault(PARTITION_BOOST_COLUMN)); + } else if (signature.contains(SEGMENT_GRANULARITY_COLUMN)) { + throw new MSQException(new ColumnNameRestrictedFault(SEGMENT_GRANULARITY_COLUMN)); } } @@ -144,7 +144,7 @@ public class QueryKitUtils } else { return RowSignature.builder() .addAll(signature) - .add(QueryKitUtils.SEGMENT_GRANULARITY_COLUMN, ColumnType.LONG) + .add(SEGMENT_GRANULARITY_COLUMN, ColumnType.LONG) .build(); } } @@ -194,8 +194,8 @@ public class QueryKitUtils public static VirtualColumn makeSegmentGranularityVirtualColumn(final ObjectMapper jsonMapper, final QueryContext queryContext) { final Granularity segmentGranularity = - QueryKitUtils.getSegmentGranularityFromContext(jsonMapper, queryContext.asMap()); - final String timeColumnName = queryContext.getString(QueryKitUtils.CTX_TIME_COLUMN_NAME); + getSegmentGranularityFromContext(jsonMapper, queryContext.asMap()); + final String timeColumnName = queryContext.getString(CTX_TIME_COLUMN_NAME); if (timeColumnName == null || Granularities.ALL.equals(segmentGranularity)) { return null; @@ -213,7 +213,7 @@ public class QueryKitUtils } return new ExpressionVirtualColumn( - QueryKitUtils.SEGMENT_GRANULARITY_COLUMN, + SEGMENT_GRANULARITY_COLUMN, StringUtils.format( "timestamp_floor(%s, %s)", CalciteSqlDialect.DEFAULT.quoteIdentifier(timeColumnName), diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQMode.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQMode.java index d2f017b04dd..3685b876c93 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQMode.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQMode.java @@ -50,7 +50,7 @@ public enum MSQMode @Nullable public static MSQMode fromString(String str) { - for (MSQMode msqMode : MSQMode.values()) { + for (MSQMode msqMode : values()) { if (msqMode.value.equalsIgnoreCase(str)) { return msqMode; } @@ -66,12 +66,12 @@ public enum MSQMode public static void populateDefaultQueryContext(final String modeStr, final Map originalQueryContext) { - MSQMode mode = MSQMode.fromString(modeStr); + MSQMode mode = fromString(modeStr); if (mode == null) { throw new ISE( "%s is an unknown multi stage query mode. Acceptable modes: %s", modeStr, - Arrays.stream(MSQMode.values()).map(m -> m.value).collect(Collectors.toList()) + Arrays.stream(values()).map(m -> m.value).collect(Collectors.toList()) ); } log.debug("Populating default query context with %s for the %s multi stage query mode", mode.defaultQueryContext, mode); diff --git a/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3Utils.java b/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3Utils.java index ecea31c94f7..0e7dd016ae2 100644 --- a/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3Utils.java +++ b/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3Utils.java @@ -327,7 +327,7 @@ public class S3Utils log.debug("Deleting keys from bucket: [%s], keys: [%s]", bucket, keys); } DeleteObjectsRequest deleteRequest = new DeleteObjectsRequest(bucket).withKeys(keysToDelete); - S3Utils.retryS3Operation(() -> { + retryS3Operation(() -> { s3Client.deleteObjects(deleteRequest); return null; }, retries); @@ -353,7 +353,7 @@ public class S3Utils final PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, key, file); if (!disableAcl) { - putObjectRequest.setAccessControlList(S3Utils.grantFullControlToBucketOwner(service, bucket)); + putObjectRequest.setAccessControlList(grantFullControlToBucketOwner(service, bucket)); } log.info("Pushing [%s] to bucket[%s] and key[%s].", file, bucket, key); service.putObject(putObjectRequest); diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java index d7e4eb2e10d..7b097382629 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/DeterminePartitionsJob.java @@ -958,7 +958,7 @@ public class DeterminePartitionsJob implements Jobby @Override public void checkOutputSpecs(JobContext job) throws IOException { - Path outDir = FileOutputFormat.getOutputPath(job); + Path outDir = getOutputPath(job); if (outDir == null) { throw new InvalidJobConfException("Output directory not set."); } diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java index 246a068e460..c38084813ff 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java @@ -148,13 +148,13 @@ public class HadoopDruidIndexerConfig // the Map<> intermediary if (argSpec.containsKey("spec")) { - return HadoopDruidIndexerConfig.JSON_MAPPER.convertValue( + return JSON_MAPPER.convertValue( argSpec, HadoopDruidIndexerConfig.class ); } return new HadoopDruidIndexerConfig( - HadoopDruidIndexerConfig.JSON_MAPPER.convertValue( + JSON_MAPPER.convertValue( argSpec, HadoopIngestionSpec.class ) @@ -166,7 +166,7 @@ public class HadoopDruidIndexerConfig { try { return fromMap( - HadoopDruidIndexerConfig.JSON_MAPPER.readValue(file, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) + JSON_MAPPER.readValue(file, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) ); } catch (IOException e) { @@ -180,7 +180,7 @@ public class HadoopDruidIndexerConfig // This is a map to try and prevent dependency screwbally-ness try { return fromMap( - HadoopDruidIndexerConfig.JSON_MAPPER.readValue(str, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) + JSON_MAPPER.readValue(str, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) ); } catch (IOException e) { @@ -197,7 +197,7 @@ public class HadoopDruidIndexerConfig Reader reader = new InputStreamReader(fs.open(pt), StandardCharsets.UTF_8); return fromMap( - HadoopDruidIndexerConfig.JSON_MAPPER.readValue(reader, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) + JSON_MAPPER.readValue(reader, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT) ); } catch (Exception e) { @@ -207,7 +207,7 @@ public class HadoopDruidIndexerConfig public static HadoopDruidIndexerConfig fromConfiguration(Configuration conf) { - final HadoopDruidIndexerConfig retVal = fromString(conf.get(HadoopDruidIndexerConfig.CONFIG_PROPERTY)); + final HadoopDruidIndexerConfig retVal = fromString(conf.get(CONFIG_PROPERTY)); retVal.verify(); return retVal; } @@ -590,7 +590,7 @@ public class HadoopDruidIndexerConfig Configuration conf = job.getConfiguration(); try { - conf.set(HadoopDruidIndexerConfig.CONFIG_PROPERTY, HadoopDruidIndexerConfig.JSON_MAPPER.writeValueAsString(this)); + conf.set(CONFIG_PROPERTY, JSON_MAPPER.writeValueAsString(this)); } catch (IOException e) { throw new RuntimeException(e); diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopTuningConfig.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopTuningConfig.java index 9da6ead38cf..dfc3a4c6935 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopTuningConfig.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopTuningConfig.java @@ -188,9 +188,9 @@ public class HadoopTuningConfig implements TuningConfig this.ignoreInvalidRows = Configs.valueOrDefault(ignoreInvalidRows, false); this.maxParseExceptions = Configs.valueOrDefault( maxParseExceptions, - this.ignoreInvalidRows ? TuningConfig.DEFAULT_MAX_PARSE_EXCEPTIONS : 0 + this.ignoreInvalidRows ? DEFAULT_MAX_PARSE_EXCEPTIONS : 0 ); - this.logParseExceptions = Configs.valueOrDefault(logParseExceptions, TuningConfig.DEFAULT_LOG_PARSE_EXCEPTIONS); + this.logParseExceptions = Configs.valueOrDefault(logParseExceptions, DEFAULT_LOG_PARSE_EXCEPTIONS); this.useYarnRMJobStatusFallback = Configs.valueOrDefault(useYarnRMJobStatusFallback, true); if (awaitSegmentAvailabilityTimeoutMillis == null || awaitSegmentAvailabilityTimeoutMillis < 0) { diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java index 6b1b84d02d7..538b2eaecea 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java @@ -413,9 +413,9 @@ public class JobHelper authenticate(); HadoopDruidIndexerConfig config = HadoopDruidIndexerConfig.fromSpec(indexerSchema); - final Configuration configuration = JobHelper.injectSystemProperties(new Configuration(), config); + final Configuration configuration = injectSystemProperties(new Configuration(), config); config.addJobProperties(configuration); - JobHelper.injectDruidProperties(configuration, config); + injectDruidProperties(configuration, config); if (!config.getSchema().getTuningConfig().isLeaveIntermediate()) { if (jobSucceeded || config.getSchema().getTuningConfig().isCleanupOnFailure()) { Path workingPath = config.makeIntermediatePath(); @@ -619,7 +619,7 @@ public class JobHelper prependFSIfNullScheme(fs, basePath), StringUtils.format( "./%s.%d", - dataSegmentPusher.makeIndexPathName(segmentTemplate, JobHelper.INDEX_ZIP), + dataSegmentPusher.makeIndexPathName(segmentTemplate, INDEX_ZIP), taskAttemptID.getId() ) ); @@ -640,9 +640,9 @@ public class JobHelper ) throws IOException { HadoopDruidIndexerConfig config = HadoopDruidIndexerConfig.fromSpec(indexerSchema); - final Configuration configuration = JobHelper.injectSystemProperties(new Configuration(), config); + final Configuration configuration = injectSystemProperties(new Configuration(), config); config.addJobProperties(configuration); - JobHelper.injectDruidProperties(configuration, config); + injectDruidProperties(configuration, config); for (DataSegmentAndIndexZipFilePath segmentAndIndexZipFilePath : segmentAndIndexZipFilePaths) { Path tmpPath = new Path(segmentAndIndexZipFilePath.getTmpIndexZipFilePath()); Path finalIndexZipFilePath = new Path(segmentAndIndexZipFilePath.getFinalIndexZipFilePath()); diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/hadoop/DatasourceInputFormat.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/hadoop/DatasourceInputFormat.java index 0937c19bd56..dee0d11b10d 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/hadoop/DatasourceInputFormat.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/hadoop/DatasourceInputFormat.java @@ -160,7 +160,7 @@ public class DatasourceInputFormat extends InputFormat { // to avoid globbing which needs input path should be hadoop-compatible (':' is not acceptable in path, etc.) List statusList = new ArrayList<>(); - for (Path path : FileInputFormat.getInputPaths(job)) { + for (Path path : getInputPaths(job)) { // load spec in segment points specifically zip file itself statusList.add(path.getFileSystem(job).getFileStatus(path)); } diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractBatchIndexTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractBatchIndexTask.java index 0f124389399..fe7f1e1134f 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractBatchIndexTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractBatchIndexTask.java @@ -812,7 +812,7 @@ public abstract class AbstractBatchIndexTask extends AbstractTask throw new ISE("Unspecified interval[%s] in granularitySpec[%s]", interval, granularitySpec); } - version = AbstractBatchIndexTask.findVersion(versions, interval); + version = findVersion(versions, interval); if (version == null) { throw new ISE("Cannot find a version for interval[%s]", interval); } @@ -820,7 +820,7 @@ public abstract class AbstractBatchIndexTask extends AbstractTask // We don't have explicit intervals. We can use the segment granularity to figure out what // interval we need, but we might not have already locked it. interval = granularitySpec.getSegmentGranularity().bucket(timestamp); - final String existingLockVersion = AbstractBatchIndexTask.findVersion(versions, interval); + final String existingLockVersion = findVersion(versions, interval); if (existingLockVersion == null) { if (ingestionSpec.getTuningConfig() instanceof ParallelIndexTuningConfig) { final int maxAllowedLockCount = ((ParallelIndexTuningConfig) ingestionSpec.getTuningConfig()) diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java index 81721cabb44..61f647ea505 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java @@ -535,7 +535,7 @@ public class HadoopIndexTask extends HadoopTask implements ChatHandler String hadoopJobIdFile = getHadoopJobIdFileName(); try { - ClassLoader loader = HadoopTask.buildClassLoader( + ClassLoader loader = buildClassLoader( getHadoopDependencyCoordinates(), taskConfig.getDefaultHadoopCoordinates() ); @@ -616,7 +616,7 @@ public class HadoopIndexTask extends HadoopTask implements ChatHandler final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); try { - ClassLoader loader = HadoopTask.buildClassLoader( + ClassLoader loader = buildClassLoader( getHadoopDependencyCoordinates(), taskConfig.getDefaultHadoopCoordinates() ); diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java index 9c114d3403f..d745a893431 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTask.java @@ -81,7 +81,6 @@ import org.apache.druid.segment.incremental.RowIngestionMeters; import org.apache.druid.segment.indexing.BatchIOConfig; import org.apache.druid.segment.indexing.DataSchema; import org.apache.druid.segment.indexing.IngestionSpec; -import org.apache.druid.segment.indexing.TuningConfig; import org.apache.druid.segment.indexing.granularity.ArbitraryGranularitySpec; import org.apache.druid.segment.indexing.granularity.GranularitySpec; import org.apache.druid.segment.realtime.ChatHandler; @@ -742,7 +741,7 @@ public class IndexTask extends AbstractBatchIndexTask implements ChatHandler, Pe Comparators.intervalsByStartThenEnd() ); final Granularity queryGranularity = granularitySpec.getQueryGranularity(); - try (final CloseableIterator inputRowIterator = AbstractBatchIndexTask.inputSourceReader( + try (final CloseableIterator inputRowIterator = inputSourceReader( tmpDir, ingestionSchema.getDataSchema(), inputSource, @@ -1070,7 +1069,7 @@ public class IndexTask extends AbstractBatchIndexTask implements ChatHandler, Pe throw new IAE("Cannot use parser and inputSource together. Try using inputFormat instead of parser."); } - IngestionMode ingestionMode = AbstractTask.computeBatchIngestionMode(ioConfig); + IngestionMode ingestionMode = computeBatchIngestionMode(ioConfig); if (ingestionMode == IngestionMode.REPLACE && dataSchema.getGranularitySpec() .inputIntervals() @@ -1133,8 +1132,8 @@ public class IndexTask extends AbstractBatchIndexTask implements ChatHandler, Pe { this.inputSource = inputSource; this.inputFormat = inputFormat; - this.appendToExisting = appendToExisting == null ? BatchIOConfig.DEFAULT_APPEND_EXISTING : appendToExisting; - this.dropExisting = dropExisting == null ? BatchIOConfig.DEFAULT_DROP_EXISTING : dropExisting; + this.appendToExisting = appendToExisting == null ? DEFAULT_APPEND_EXISTING : appendToExisting; + this.dropExisting = dropExisting == null ? DEFAULT_DROP_EXISTING : dropExisting; } @Nullable @@ -1367,7 +1366,7 @@ public class IndexTask extends AbstractBatchIndexTask implements ChatHandler, Pe ) { this.appendableIndexSpec = appendableIndexSpec == null ? DEFAULT_APPENDABLE_INDEX : appendableIndexSpec; - this.maxRowsInMemory = maxRowsInMemory == null ? TuningConfig.DEFAULT_MAX_ROWS_IN_MEMORY_BATCH : maxRowsInMemory; + this.maxRowsInMemory = maxRowsInMemory == null ? DEFAULT_MAX_ROWS_IN_MEMORY_BATCH : maxRowsInMemory; // initializing this to 0, it will be lazily initialized to a value // @see #getMaxBytesInMemoryOrDefault() this.maxBytesInMemory = maxBytesInMemory == null ? 0 : maxBytesInMemory; @@ -1395,14 +1394,14 @@ public class IndexTask extends AbstractBatchIndexTask implements ChatHandler, Pe this.maxSavedParseExceptions = maxSavedParseExceptions == null ? 0 : Math.min(1, maxSavedParseExceptions); } else { this.maxParseExceptions = maxParseExceptions == null - ? TuningConfig.DEFAULT_MAX_PARSE_EXCEPTIONS + ? DEFAULT_MAX_PARSE_EXCEPTIONS : maxParseExceptions; this.maxSavedParseExceptions = maxSavedParseExceptions == null - ? TuningConfig.DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS + ? DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS : maxSavedParseExceptions; } this.logParseExceptions = logParseExceptions == null - ? TuningConfig.DEFAULT_LOG_PARSE_EXCEPTIONS + ? DEFAULT_LOG_PARSE_EXCEPTIONS : logParseExceptions; if (awaitSegmentAvailabilityTimeoutMillis == null || awaitSegmentAvailabilityTimeoutMillis < 0) { this.awaitSegmentAvailabilityTimeoutMillis = DEFAULT_AWAIT_SEGMENT_AVAILABILITY_TIMEOUT_MILLIS; diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java index 79a3e8993a8..06a2da71f8a 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/IndexTaskUtils.java @@ -138,12 +138,12 @@ public class IndexTaskUtils ) { final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder(); - IndexTaskUtils.setTaskDimensions(metricBuilder, task); + setTaskDimensions(metricBuilder, task); if (publishResult.isSuccess()) { toolbox.getEmitter().emit(metricBuilder.setMetric("segment/txn/success", 1)); for (DataSegment segment : publishResult.getSegments()) { - IndexTaskUtils.setSegmentDimensions(metricBuilder, segment); + setSegmentDimensions(metricBuilder, segment); toolbox.getEmitter().emit(metricBuilder.setMetric("segment/added/bytes", segment.getSize())); toolbox.getEmitter().emit(SegmentMetadataEvent.create(segment, DateTimes.nowUtc())); } diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/LegacySinglePhaseSubTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/LegacySinglePhaseSubTask.java index d2694c7afd9..36853987a6d 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/LegacySinglePhaseSubTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/LegacySinglePhaseSubTask.java @@ -54,7 +54,7 @@ public class LegacySinglePhaseSubTask extends SinglePhaseSubTask @Override public String getType() { - return SinglePhaseSubTask.OLD_TYPE_NAME; + return OLD_TYPE_NAME; } } diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTask.java index d75304f38c0..67d97c62b81 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTask.java @@ -37,7 +37,6 @@ import org.apache.druid.indexer.partitions.HashedPartitionsSpec; import org.apache.druid.indexing.common.TaskToolbox; import org.apache.druid.indexing.common.actions.SurrogateTaskActionClient; import org.apache.druid.indexing.common.actions.TaskActionClient; -import org.apache.druid.indexing.common.task.AbstractBatchIndexTask; import org.apache.druid.indexing.common.task.TaskResource; import org.apache.druid.java.util.common.granularity.Granularity; import org.apache.druid.java.util.common.parsers.CloseableIterator; @@ -182,7 +181,7 @@ public class PartialDimensionCardinalityTask extends PerfectRollupWorkerTask tuningConfig.getMaxSavedParseExceptions() ); try ( - final CloseableIterator inputRowIterator = AbstractBatchIndexTask.inputSourceReader( + final CloseableIterator inputRowIterator = inputSourceReader( toolbox.getIndexingTmpDir(), dataSchema, inputSource, diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTask.java index 4bb395420b3..089424377aa 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTask.java @@ -40,7 +40,6 @@ import org.apache.druid.indexer.partitions.DimensionRangePartitionsSpec; import org.apache.druid.indexing.common.TaskToolbox; import org.apache.druid.indexing.common.actions.SurrogateTaskActionClient; import org.apache.druid.indexing.common.actions.TaskActionClient; -import org.apache.druid.indexing.common.task.AbstractBatchIndexTask; import org.apache.druid.indexing.common.task.TaskResource; import org.apache.druid.indexing.common.task.batch.parallel.distribution.StringDistribution; import org.apache.druid.indexing.common.task.batch.parallel.distribution.StringSketch; @@ -229,7 +228,7 @@ public class PartialDimensionDistributionTask extends PerfectRollupWorkerTask tuningConfig.getMaxSavedParseExceptions() ); try ( - final CloseableIterator inputRowIterator = AbstractBatchIndexTask.inputSourceReader( + final CloseableIterator inputRowIterator = inputSourceReader( toolbox.getIndexingTmpDir(), dataSchema, inputSource, diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeTask.java index 17d9936c685..fa4122904c5 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeTask.java @@ -32,7 +32,6 @@ import org.apache.druid.indexing.common.TaskToolbox; import org.apache.druid.indexing.common.actions.LockListAction; import org.apache.druid.indexing.common.actions.SurrogateAction; import org.apache.druid.indexing.common.actions.TaskActionClient; -import org.apache.druid.indexing.common.task.AbstractBatchIndexTask; import org.apache.druid.indexing.common.task.TaskResource; import org.apache.druid.java.util.common.FileUtils; import org.apache.druid.java.util.common.ISE; @@ -293,7 +292,7 @@ abstract class PartialSegmentMergeTask extends PerfectRollu getDataSource(), interval, Preconditions.checkNotNull( - AbstractBatchIndexTask.findVersion(intervalToVersion, interval), + findVersion(intervalToVersion, interval), "version for interval[%s]", interval ), diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseSubTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseSubTask.java index 8d49a7f3dbe..db9dc26372c 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseSubTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseSubTask.java @@ -38,8 +38,6 @@ import org.apache.druid.indexing.common.TaskToolbox; import org.apache.druid.indexing.common.actions.SurrogateTaskActionClient; import org.apache.druid.indexing.common.actions.TaskActionClient; import org.apache.druid.indexing.common.stats.TaskRealtimeMetricsMonitor; -import org.apache.druid.indexing.common.task.AbstractBatchIndexTask; -import org.apache.druid.indexing.common.task.AbstractTask; import org.apache.druid.indexing.common.task.BatchAppenderators; import org.apache.druid.indexing.common.task.IndexTask; import org.apache.druid.indexing.common.task.IndexTaskUtils; @@ -165,7 +163,7 @@ public class SinglePhaseSubTask extends AbstractBatchSubtask implements ChatHand taskResource, ingestionSchema.getDataSchema().getDataSource(), context, - AbstractTask.computeBatchIngestionMode(ingestionSchema.getIOConfig()), + computeBatchIngestionMode(ingestionSchema.getIOConfig()), supervisorTaskId ); @@ -409,7 +407,7 @@ public class SinglePhaseSubTask extends AbstractBatchSubtask implements ChatHand boolean exceptionOccurred = false; try ( final BatchAppenderatorDriver driver = BatchAppenderators.newDriver(appenderator, toolbox, segmentAllocator); - final CloseableIterator inputRowIterator = AbstractBatchIndexTask.inputSourceReader( + final CloseableIterator inputRowIterator = inputSourceReader( tmpDir, dataSchema, inputSource, diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidInputSource.java b/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidInputSource.java index 84c17f1a8fa..8f83a63057c 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidInputSource.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/input/DruidInputSource.java @@ -397,7 +397,7 @@ public class DruidInputSource extends AbstractInputSource implements SplittableI coordinatorClient, dataSource, interval, - splitHintSpec == null ? SplittableInputSource.DEFAULT_SPLIT_HINT_SPEC : splitHintSpec + splitHintSpec == null ? DEFAULT_SPLIT_HINT_SPEC : splitHintSpec ) ); } else { @@ -417,7 +417,7 @@ public class DruidInputSource extends AbstractInputSource implements SplittableI coordinatorClient, dataSource, interval, - splitHintSpec == null ? SplittableInputSource.DEFAULT_SPLIT_HINT_SPEC : splitHintSpec + splitHintSpec == null ? DEFAULT_SPLIT_HINT_SPEC : splitHintSpec ) ); } else { diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/QuotableWhiteSpaceSplitter.java b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/QuotableWhiteSpaceSplitter.java index 88e11821abc..49c8d166150 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/QuotableWhiteSpaceSplitter.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/QuotableWhiteSpaceSplitter.java @@ -54,7 +54,7 @@ public class QuotableWhiteSpaceSplitter implements Iterable if (inQuotes) { return false; } - return CharMatcher.breakingWhitespace().matches(c); + return breakingWhitespace().matches(c); } } ).omitEmptyStrings().split(string).iterator(); diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTuningConfig.java b/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTuningConfig.java index 309336e1d53..b802ffc044d 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTuningConfig.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTuningConfig.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.druid.indexer.partitions.DynamicPartitionsSpec; import org.apache.druid.segment.IndexSpec; import org.apache.druid.segment.incremental.AppendableIndexSpec; -import org.apache.druid.segment.indexing.TuningConfig; import org.apache.druid.segment.realtime.appenderator.AppenderatorConfig; import org.apache.druid.segment.writeout.SegmentWriteOutMediumFactory; import org.joda.time.Period; @@ -131,14 +130,14 @@ public abstract class SeekableStreamIndexTaskTuningConfig implements Appenderato this.maxSavedParseExceptions = maxSavedParseExceptions == null ? 0 : Math.min(1, maxSavedParseExceptions); } else { this.maxParseExceptions = maxParseExceptions == null - ? TuningConfig.DEFAULT_MAX_PARSE_EXCEPTIONS + ? DEFAULT_MAX_PARSE_EXCEPTIONS : maxParseExceptions; this.maxSavedParseExceptions = maxSavedParseExceptions == null - ? TuningConfig.DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS + ? DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS : maxSavedParseExceptions; } this.logParseExceptions = logParseExceptions == null - ? TuningConfig.DEFAULT_LOG_PARSE_EXCEPTIONS + ? DEFAULT_LOG_PARSE_EXCEPTIONS : logParseExceptions; this.numPersistThreads = numPersistThreads == null ? DEFAULT_NUM_PERSIST_THREADS : Math.max(numPersistThreads, DEFAULT_NUM_PERSIST_THREADS); diff --git a/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliCustomNodeRole.java b/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliCustomNodeRole.java index 087cb24bec5..df5ef8827eb 100644 --- a/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliCustomNodeRole.java +++ b/integration-tests-ex/tools/src/main/java/org/apache/druid/testing/tools/CliCustomNodeRole.java @@ -66,7 +66,7 @@ public class CliCustomNodeRole extends ServerRunnable public static final String SERVICE_NAME = "custom-node-role"; public static final int PORT = 9301; public static final int TLS_PORT = 9501; - public static final NodeRole NODE_ROLE = new NodeRole(CliCustomNodeRole.SERVICE_NAME); + public static final NodeRole NODE_ROLE = new NodeRole(SERVICE_NAME); public CliCustomNodeRole() { @@ -85,9 +85,9 @@ public class CliCustomNodeRole extends ServerRunnable return ImmutableList.of( binder -> { LOG.info("starting up custom node role"); - binder.bindConstant().annotatedWith(Names.named("serviceName")).to(CliCustomNodeRole.SERVICE_NAME); - binder.bindConstant().annotatedWith(Names.named("servicePort")).to(CliCustomNodeRole.PORT); - binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(CliCustomNodeRole.TLS_PORT); + binder.bindConstant().annotatedWith(Names.named("serviceName")).to(SERVICE_NAME); + binder.bindConstant().annotatedWith(Names.named("servicePort")).to(PORT); + binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(TLS_PORT); binder.bind(JettyServerInitializer.class).to(CustomJettyServiceInitializer.class).in(LazySingleton.class); LifecycleModule.register(binder, Server.class); diff --git a/integration-tests/src/main/java/org/apache/druid/cli/CliCustomNodeRole.java b/integration-tests/src/main/java/org/apache/druid/cli/CliCustomNodeRole.java index e0e1605b302..eade6b9eda0 100644 --- a/integration-tests/src/main/java/org/apache/druid/cli/CliCustomNodeRole.java +++ b/integration-tests/src/main/java/org/apache/druid/cli/CliCustomNodeRole.java @@ -65,7 +65,7 @@ public class CliCustomNodeRole extends ServerRunnable public static final String SERVICE_NAME = "custom-node-role"; public static final int PORT = 9301; public static final int TLS_PORT = 9501; - public static final NodeRole NODE_ROLE = new NodeRole(CliCustomNodeRole.SERVICE_NAME); + public static final NodeRole NODE_ROLE = new NodeRole(SERVICE_NAME); public CliCustomNodeRole() { @@ -84,9 +84,9 @@ public class CliCustomNodeRole extends ServerRunnable return ImmutableList.of( binder -> { LOG.info("starting up"); - binder.bindConstant().annotatedWith(Names.named("serviceName")).to(CliCustomNodeRole.SERVICE_NAME); - binder.bindConstant().annotatedWith(Names.named("servicePort")).to(CliCustomNodeRole.PORT); - binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(CliCustomNodeRole.TLS_PORT); + binder.bindConstant().annotatedWith(Names.named("serviceName")).to(SERVICE_NAME); + binder.bindConstant().annotatedWith(Names.named("servicePort")).to(PORT); + binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(TLS_PORT); binder.bind(JettyServerInitializer.class).to(CustomJettyServiceInitializer.class).in(LazySingleton.class); LifecycleModule.register(binder, Server.class); diff --git a/integration-tests/src/main/java/org/apache/druid/testing/utils/AvroSchemaRegistryEventSerializer.java b/integration-tests/src/main/java/org/apache/druid/testing/utils/AvroSchemaRegistryEventSerializer.java index dd1e82f82df..a5df23466ca 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/utils/AvroSchemaRegistryEventSerializer.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/utils/AvroSchemaRegistryEventSerializer.java @@ -73,7 +73,7 @@ public class AvroSchemaRegistryEventSerializer extends AvroEventSerializer try { RetryUtils.retry( () -> { - schemaId = client.register(topic, AvroEventSerializer.SCHEMA); + schemaId = client.register(topic, SCHEMA); fromRegistry = client.getById(schemaId); return 0; }, diff --git a/integration-tests/src/main/java/org/apache/druid/testing/utils/ProtobufSchemaRegistryEventSerializer.java b/integration-tests/src/main/java/org/apache/druid/testing/utils/ProtobufSchemaRegistryEventSerializer.java index 8d80b22af35..f2a65ae95df 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/utils/ProtobufSchemaRegistryEventSerializer.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/utils/ProtobufSchemaRegistryEventSerializer.java @@ -68,7 +68,7 @@ public class ProtobufSchemaRegistryEventSerializer extends ProtobufEventSerializ try { RetryUtils.retry( () -> { - schemaId = client.register(topic, new ProtobufSchema(ProtobufEventSerializer.SCHEMA.newMessageBuilder("Wikipedia").getDescriptorForType())); + schemaId = client.register(topic, new ProtobufSchema(SCHEMA.newMessageBuilder("Wikipedia").getDescriptorForType())); return 0; }, (e) -> true, diff --git a/processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java b/processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java index 68dc2174a89..840a9f9c2d1 100644 --- a/processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java +++ b/processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java @@ -101,7 +101,7 @@ public class PolygonBound extends RectangularBound public static PolygonBound from(float[] abscissa, float[] ordinate) { - return PolygonBound.from(abscissa, ordinate, 0); + return from(abscissa, ordinate, 0); } @JsonProperty diff --git a/processing/src/main/java/org/apache/druid/common/config/NullHandling.java b/processing/src/main/java/org/apache/druid/common/config/NullHandling.java index 747512cece5..b98d81421d2 100644 --- a/processing/src/main/java/org/apache/druid/common/config/NullHandling.java +++ b/processing/src/main/java/org/apache/druid/common/config/NullHandling.java @@ -129,7 +129,7 @@ public class NullHandling */ public static boolean useThreeValueLogic() { - return NullHandling.sqlCompatible() && + return sqlCompatible() && INSTANCE.isUseThreeValueLogicForNativeFilters() && ExpressionProcessing.useStrictBooleans(); } @@ -268,7 +268,7 @@ public class NullHandling */ public static boolean mustCombineNullAndEmptyInDictionary(final Indexed dictionaryUtf8) { - return NullHandling.replaceWithDefault() + return replaceWithDefault() && dictionaryUtf8.size() >= 2 && isNullOrEquivalent(dictionaryUtf8.get(0)) && isNullOrEquivalent(dictionaryUtf8.get(1)); @@ -285,7 +285,7 @@ public class NullHandling */ public static boolean mustReplaceFirstValueWithNullInDictionary(final Indexed dictionaryUtf8) { - if (NullHandling.replaceWithDefault() && dictionaryUtf8.size() >= 1) { + if (replaceWithDefault() && dictionaryUtf8.size() >= 1) { final ByteBuffer firstValue = dictionaryUtf8.get(0); return firstValue != null && firstValue.remaining() == 0; } diff --git a/processing/src/main/java/org/apache/druid/common/guava/FutureUtils.java b/processing/src/main/java/org/apache/druid/common/guava/FutureUtils.java index 43ab45ef457..32625f1ec49 100644 --- a/processing/src/main/java/org/apache/druid/common/guava/FutureUtils.java +++ b/processing/src/main/java/org/apache/druid/common/guava/FutureUtils.java @@ -73,7 +73,7 @@ public class FutureUtils public static T getUnchecked(final ListenableFuture future, final boolean cancelIfInterrupted) { try { - return FutureUtils.get(future, cancelIfInterrupted); + return get(future, cancelIfInterrupted); } catch (InterruptedException e) { Thread.currentThread().interrupt(); @@ -103,7 +103,7 @@ public class FutureUtils /** * Like {@link Futures#transform}, but works better with lambdas due to not having overloads. * - * One can write {@code FutureUtils.transform(future, v -> ...)} instead of + * One can write {@code transform(future, v -> ...)} instead of * {@code Futures.transform(future, (Function) v -> ...)} */ public static ListenableFuture transform(final ListenableFuture future, final Function fn) @@ -115,7 +115,7 @@ public class FutureUtils * Like {@link Futures#transformAsync(ListenableFuture, AsyncFunction, java.util.concurrent.Executor)}, but works better with lambdas due to not having * overloads. * - * One can write {@code FutureUtils.transformAsync(future, v -> ...)} instead of + * One can write {@code transformAsync(future, v -> ...)} instead of * {@code Futures.transform(future, (Function) v -> ...)} */ public static ListenableFuture transformAsync(final ListenableFuture future, final AsyncFunction fn) diff --git a/processing/src/main/java/org/apache/druid/common/utils/IdUtils.java b/processing/src/main/java/org/apache/druid/common/utils/IdUtils.java index 88d4d0d413b..ee769dfd89e 100644 --- a/processing/src/main/java/org/apache/druid/common/utils/IdUtils.java +++ b/processing/src/main/java/org/apache/druid/common/utils/IdUtils.java @@ -100,7 +100,7 @@ public class IdUtils public static String getRandomIdWithPrefix(String prefix) { - return UNDERSCORE_JOINER.join(prefix, IdUtils.getRandomId()); + return UNDERSCORE_JOINER.join(prefix, getRandomId()); } public static String newTaskId(String typeName, String dataSource, @Nullable Interval interval) diff --git a/processing/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java b/processing/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java index efc3718d4ff..b7369fe55f5 100644 --- a/processing/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java +++ b/processing/src/main/java/org/apache/druid/data/input/impl/DimensionsSpec.java @@ -139,7 +139,7 @@ public class DimensionsSpec } for (SpatialDimensionSchema spatialSchema : spatialDims) { - DimensionSchema newSchema = DimensionsSpec.convertSpatialSchema(spatialSchema); + DimensionSchema newSchema = convertSpatialSchema(spatialSchema); this.dimensions.add(newSchema); dimensionSchemaMap.put(newSchema.getName(), newSchema); } diff --git a/processing/src/main/java/org/apache/druid/data/input/impl/DoubleDimensionSchema.java b/processing/src/main/java/org/apache/druid/data/input/impl/DoubleDimensionSchema.java index 2bde0812214..041907a09ce 100644 --- a/processing/src/main/java/org/apache/druid/data/input/impl/DoubleDimensionSchema.java +++ b/processing/src/main/java/org/apache/druid/data/input/impl/DoubleDimensionSchema.java @@ -36,7 +36,7 @@ public class DoubleDimensionSchema extends DimensionSchema @Override public String getTypeName() { - return DimensionSchema.DOUBLE_TYPE_NAME; + return DOUBLE_TYPE_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/data/input/impl/FloatDimensionSchema.java b/processing/src/main/java/org/apache/druid/data/input/impl/FloatDimensionSchema.java index 1a9d6e73fe3..ca7b3e2a400 100644 --- a/processing/src/main/java/org/apache/druid/data/input/impl/FloatDimensionSchema.java +++ b/processing/src/main/java/org/apache/druid/data/input/impl/FloatDimensionSchema.java @@ -39,7 +39,7 @@ public class FloatDimensionSchema extends DimensionSchema @Override public String getTypeName() { - return DimensionSchema.FLOAT_TYPE_NAME; + return FLOAT_TYPE_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/data/input/impl/LongDimensionSchema.java b/processing/src/main/java/org/apache/druid/data/input/impl/LongDimensionSchema.java index e8a90a7a481..3c9ee334ffb 100644 --- a/processing/src/main/java/org/apache/druid/data/input/impl/LongDimensionSchema.java +++ b/processing/src/main/java/org/apache/druid/data/input/impl/LongDimensionSchema.java @@ -40,7 +40,7 @@ public class LongDimensionSchema extends DimensionSchema @Override public String getTypeName() { - return DimensionSchema.LONG_TYPE_NAME; + return LONG_TYPE_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/data/input/impl/NewSpatialDimensionSchema.java b/processing/src/main/java/org/apache/druid/data/input/impl/NewSpatialDimensionSchema.java index bd1fd8292ae..d46c7ca130a 100644 --- a/processing/src/main/java/org/apache/druid/data/input/impl/NewSpatialDimensionSchema.java +++ b/processing/src/main/java/org/apache/druid/data/input/impl/NewSpatialDimensionSchema.java @@ -59,7 +59,7 @@ public class NewSpatialDimensionSchema extends DimensionSchema @Override public String getTypeName() { - return DimensionSchema.SPATIAL_TYPE_NAME; + return SPATIAL_TYPE_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/data/input/impl/StringDimensionSchema.java b/processing/src/main/java/org/apache/druid/data/input/impl/StringDimensionSchema.java index 2af2fbbaac2..11775039655 100644 --- a/processing/src/main/java/org/apache/druid/data/input/impl/StringDimensionSchema.java +++ b/processing/src/main/java/org/apache/druid/data/input/impl/StringDimensionSchema.java @@ -54,7 +54,7 @@ public class StringDimensionSchema extends DimensionSchema @Override public String getTypeName() { - return DimensionSchema.STRING_TYPE_NAME; + return STRING_TYPE_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/extendedset/intset/ImmutableConciseSet.java b/processing/src/main/java/org/apache/druid/extendedset/intset/ImmutableConciseSet.java index 43591e2b59d..f87a032cc6d 100755 --- a/processing/src/main/java/org/apache/druid/extendedset/intset/ImmutableConciseSet.java +++ b/processing/src/main/java/org/apache/druid/extendedset/intset/ImmutableConciseSet.java @@ -209,7 +209,7 @@ public class ImmutableConciseSet } } ConciseSet newSet = new ConciseSet(words, false); - return ImmutableConciseSet.newImmutableFromMutable(newSet); + return newImmutableFromMutable(newSet); } IntList retVal = new IntList(); diff --git a/processing/src/main/java/org/apache/druid/frame/Frame.java b/processing/src/main/java/org/apache/druid/frame/Frame.java index 8185190a28d..49a9a2347d7 100644 --- a/processing/src/main/java/org/apache/druid/frame/Frame.java +++ b/processing/src/main/java/org/apache/druid/frame/Frame.java @@ -240,12 +240,12 @@ public class Frame ); } - return Frame.wrap(dstBuffer); + return wrap(dstBuffer); } else { // Copy first, then decompress. final byte[] compressedFrame = new byte[compressedFrameLength]; memory.getByteArray(frameStart, compressedFrame, 0, compressedFrameLength); - return Frame.wrap(LZ4_DECOMPRESSOR.decompress(compressedFrame, uncompressedFrameLength)); + return wrap(LZ4_DECOMPRESSOR.decompress(compressedFrame, uncompressedFrameLength)); } } diff --git a/processing/src/main/java/org/apache/druid/frame/key/RowKeyReader.java b/processing/src/main/java/org/apache/druid/frame/key/RowKeyReader.java index d26f248e801..69958187b86 100644 --- a/processing/src/main/java/org/apache/druid/frame/key/RowKeyReader.java +++ b/processing/src/main/java/org/apache/druid/frame/key/RowKeyReader.java @@ -149,7 +149,7 @@ public class RowKeyReader newSignature.add(columnName, columnType); } - return RowKeyReader.create(newSignature.build()); + return create(newSignature.build()); } /** diff --git a/processing/src/main/java/org/apache/druid/frame/processor/OutputChannel.java b/processing/src/main/java/org/apache/druid/frame/processor/OutputChannel.java index e1377eddca3..058450dd063 100644 --- a/processing/src/main/java/org/apache/druid/frame/processor/OutputChannel.java +++ b/processing/src/main/java/org/apache/druid/frame/processor/OutputChannel.java @@ -243,7 +243,7 @@ public class OutputChannel */ public OutputChannel readOnly() { - return OutputChannel.readOnly(readableChannelSupplier, partitionNumber); + return readOnly(readableChannelSupplier, partitionNumber); } /** diff --git a/processing/src/main/java/org/apache/druid/frame/util/DurableStorageUtils.java b/processing/src/main/java/org/apache/druid/frame/util/DurableStorageUtils.java index 168d96fc20a..476b7f3f015 100644 --- a/processing/src/main/java/org/apache/druid/frame/util/DurableStorageUtils.java +++ b/processing/src/main/java/org/apache/druid/frame/util/DurableStorageUtils.java @@ -252,7 +252,7 @@ public class DurableStorageUtils if (elements.size() < 2) { return false; } - if (!DurableStorageUtils.QUERY_RESULTS_DIR.equals(elements.get(0))) { + if (!QUERY_RESULTS_DIR.equals(elements.get(0))) { return false; } return knownTasks.contains(elements.get(1)); diff --git a/processing/src/main/java/org/apache/druid/frame/write/FrameWriterUtils.java b/processing/src/main/java/org/apache/druid/frame/write/FrameWriterUtils.java index a480767f111..affa5a453ca 100644 --- a/processing/src/main/java/org/apache/druid/frame/write/FrameWriterUtils.java +++ b/processing/src/main/java/org/apache/druid/frame/write/FrameWriterUtils.java @@ -318,7 +318,7 @@ public class FrameWriterUtils return buf; } } else { - return FrameWriterUtils.getUtf8ByteBufferFromString(selector.lookupName(dictionaryId)); + return getUtf8ByteBufferFromString(selector.lookupName(dictionaryId)); } } diff --git a/processing/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java b/processing/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java index d285f1cd044..f8ef6acc152 100644 --- a/processing/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java +++ b/processing/src/main/java/org/apache/druid/hll/HyperLogLogCollector.java @@ -394,7 +394,7 @@ public abstract class HyperLogLogCollector implements Comparable public Either map(final Function fn) { if (isValue()) { - return Either.value(fn.apply(value)); + return value(fn.apply(value)); } else { // Safe because the value is never going to be returned. //noinspection unchecked diff --git a/processing/src/main/java/org/apache/druid/java/util/common/HumanReadableBytes.java b/processing/src/main/java/org/apache/druid/java/util/common/HumanReadableBytes.java index 63e697cc954..f44e6c327a5 100644 --- a/processing/src/main/java/org/apache/druid/java/util/common/HumanReadableBytes.java +++ b/processing/src/main/java/org/apache/druid/java/util/common/HumanReadableBytes.java @@ -30,7 +30,7 @@ public class HumanReadableBytes public HumanReadableBytes(String bytes) { - this.bytes = HumanReadableBytes.parse(bytes); + this.bytes = parse(bytes); } public HumanReadableBytes(long bytes) diff --git a/processing/src/main/java/org/apache/druid/java/util/common/StringUtils.java b/processing/src/main/java/org/apache/druid/java/util/common/StringUtils.java index d8ef9956d9b..282c436ebcd 100644 --- a/processing/src/main/java/org/apache/druid/java/util/common/StringUtils.java +++ b/processing/src/main/java/org/apache/druid/java/util/common/StringUtils.java @@ -54,7 +54,7 @@ public class StringUtils private static final Base64.Decoder BASE64_DECODER = Base64.getDecoder(); // should be used only for estimation - // returns the same result with StringUtils.fromUtf8(value).length for valid string values + // returns the same result with fromUtf8(value).length for valid string values // does not check validity of format and returns over-estimated result for invalid string (see UT) public static int estimatedBinaryLengthAsUTF8(String value) { @@ -257,7 +257,7 @@ public class StringUtils */ public static String fromUtf8(final ByteBuffer buffer) { - return StringUtils.fromUtf8(buffer, buffer.remaining()); + return fromUtf8(buffer, buffer.remaining()); } /** @@ -273,7 +273,7 @@ public class StringUtils if (buffer == null) { return null; } - return StringUtils.fromUtf8(buffer, buffer.remaining()); + return fromUtf8(buffer, buffer.remaining()); } /** @@ -390,7 +390,7 @@ public class StringUtils if (s == null) { return null; } else { - return StringUtils.replaceChar(s, '%', "%%"); + return replaceChar(s, '%', "%%"); } } @@ -422,7 +422,7 @@ public class StringUtils } try { - return StringUtils.replace(URLEncoder.encode(s, "UTF-8"), "+", "%20"); + return replace(URLEncoder.encode(s, "UTF-8"), "+", "%20"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); @@ -792,7 +792,7 @@ public class StringUtils } else { // Shorten firstValue to what could fit in maxBytes as UTF-8. final byte[] bytes = new byte[maxBytes]; - final int len = StringUtils.toUtf8WithLimit(s, ByteBuffer.wrap(bytes)); + final int len = toUtf8WithLimit(s, ByteBuffer.wrap(bytes)); return new String(bytes, 0, len, StandardCharsets.UTF_8); } } @@ -831,6 +831,6 @@ public class StringUtils */ public static String escapeSql(String str) { - return str == null ? null : StringUtils.replace(str, "'", "''"); + return str == null ? null : replace(str, "'", "''"); } } diff --git a/processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularities.java b/processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularities.java index 08de0a364ec..1ae9281e8ab 100644 --- a/processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularities.java +++ b/processing/src/main/java/org/apache/druid/java/util/common/granularity/Granularities.java @@ -68,7 +68,7 @@ public class Granularities public static Granularity nullToAll(Granularity granularity) { - return granularity == null ? Granularities.ALL : granularity; + return granularity == null ? ALL : granularity; } /** diff --git a/processing/src/main/java/org/apache/druid/java/util/common/granularity/GranularityType.java b/processing/src/main/java/org/apache/druid/java/util/common/granularity/GranularityType.java index b4b78390605..26fe8e44f64 100644 --- a/processing/src/main/java/org/apache/druid/java/util/common/granularity/GranularityType.java +++ b/processing/src/main/java/org/apache/druid/java/util/common/granularity/GranularityType.java @@ -176,7 +176,7 @@ public enum GranularityType */ public static boolean isStandard(Granularity granularity) { - final GranularityType[] values = GranularityType.values(); + final GranularityType[] values = values(); for (GranularityType value : values) { if (value.getDefaultGranularity().equals(granularity)) { return true; @@ -205,42 +205,42 @@ public enum GranularityType switch (index) { case 0: - return GranularityType.YEAR; + return YEAR; case 1: if (vals[index] == 3) { - return GranularityType.QUARTER; + return QUARTER; } else if (vals[index] == 1) { - return GranularityType.MONTH; + return MONTH; } break; case 2: - return GranularityType.WEEK; + return WEEK; case 3: - return GranularityType.DAY; + return DAY; case 4: if (vals[index] == 8) { - return GranularityType.EIGHT_HOUR; + return EIGHT_HOUR; } else if (vals[index] == 6) { - return GranularityType.SIX_HOUR; + return SIX_HOUR; } else if (vals[index] == 1) { - return GranularityType.HOUR; + return HOUR; } break; case 5: if (vals[index] == 30) { - return GranularityType.THIRTY_MINUTE; + return THIRTY_MINUTE; } else if (vals[index] == 15) { - return GranularityType.FIFTEEN_MINUTE; + return FIFTEEN_MINUTE; } else if (vals[index] == 10) { - return GranularityType.TEN_MINUTE; + return TEN_MINUTE; } else if (vals[index] == 5) { - return GranularityType.FIVE_MINUTE; + return FIVE_MINUTE; } else if (vals[index] == 1) { - return GranularityType.MINUTE; + return MINUTE; } break; case 6: - return GranularityType.SECOND; + return SECOND; default: break; } diff --git a/processing/src/main/java/org/apache/druid/java/util/common/guava/Sequences.java b/processing/src/main/java/org/apache/druid/java/util/common/guava/Sequences.java index e66ba29e4d7..daac8b235f4 100644 --- a/processing/src/main/java/org/apache/druid/java/util/common/guava/Sequences.java +++ b/processing/src/main/java/org/apache/druid/java/util/common/guava/Sequences.java @@ -56,7 +56,7 @@ public class Sequences public static Sequence concat(Iterable> sequences) { - return concat(Sequences.simple(sequences)); + return concat(simple(sequences)); } public static Sequence concat(Sequence> sequences) diff --git a/processing/src/main/java/org/apache/druid/java/util/common/parsers/JSONPathFieldSpec.java b/processing/src/main/java/org/apache/druid/java/util/common/parsers/JSONPathFieldSpec.java index 9ddde9b8970..04e372f4f5d 100644 --- a/processing/src/main/java/org/apache/druid/java/util/common/parsers/JSONPathFieldSpec.java +++ b/processing/src/main/java/org/apache/druid/java/util/common/parsers/JSONPathFieldSpec.java @@ -103,7 +103,7 @@ public class JSONPathFieldSpec @JsonCreator public static JSONPathFieldSpec fromString(String name) { - return JSONPathFieldSpec.createRootField(name); + return createRootField(name); } public static JSONPathFieldSpec createNestedField(String name, String expr) diff --git a/processing/src/main/java/org/apache/druid/java/util/common/parsers/ParserUtils.java b/processing/src/main/java/org/apache/druid/java/util/common/parsers/ParserUtils.java index 18afba4491d..fe86ae3035b 100644 --- a/processing/src/main/java/org/apache/druid/java/util/common/parsers/ParserUtils.java +++ b/processing/src/main/java/org/apache/druid/java/util/common/parsers/ParserUtils.java @@ -76,7 +76,7 @@ public class ParserUtils if (input.contains(listDelimiter)) { return StreamSupport.stream(listSplitter.split(input).spliterator(), false) .map(NullHandling::emptyToNullIfNeeded) - .map(value -> tryParseNumbers ? ParserUtils.tryParseStringAsNumber(value) : value) + .map(value -> tryParseNumbers ? tryParseStringAsNumber(value) : value) .collect(Collectors.toList()); } else { return tryParseNumbers ? diff --git a/processing/src/main/java/org/apache/druid/java/util/emitter/core/HttpPostEmitter.java b/processing/src/main/java/org/apache/druid/java/util/emitter/core/HttpPostEmitter.java index f70b7e7d3fd..e2fb9d436bf 100644 --- a/processing/src/main/java/org/apache/druid/java/util/emitter/core/HttpPostEmitter.java +++ b/processing/src/main/java/org/apache/druid/java/util/emitter/core/HttpPostEmitter.java @@ -524,7 +524,7 @@ public class HttpPostEmitter implements Flushable, Closeable, Emitter private boolean needsToShutdown() { - boolean needsToShutdown = Thread.interrupted() || shuttingDown; + boolean needsToShutdown = interrupted() || shuttingDown; if (needsToShutdown) { Object lastBatch = concurrentBatch.getAndSet(null); if (lastBatch instanceof Batch) { @@ -722,7 +722,7 @@ public class HttpPostEmitter implements Flushable, Closeable, Emitter final long backoffCheckDelayMillis = config.getMinHttpTimeoutMillis() / 5; try { - Thread.sleep(backoffCheckDelayMillis); + sleep(backoffCheckDelayMillis); } catch (InterruptedException ignored) { return; diff --git a/processing/src/main/java/org/apache/druid/java/util/emitter/service/AlertBuilder.java b/processing/src/main/java/org/apache/druid/java/util/emitter/service/AlertBuilder.java index 352272d67bc..c0c2b98b901 100644 --- a/processing/src/main/java/org/apache/druid/java/util/emitter/service/AlertBuilder.java +++ b/processing/src/main/java/org/apache/druid/java/util/emitter/service/AlertBuilder.java @@ -46,7 +46,7 @@ public class AlertBuilder extends ServiceEventBuilder public static AlertBuilder create(String descriptionFormat, Object... objects) { - return AlertBuilder.createEmittable(null, descriptionFormat, objects); + return createEmittable(null, descriptionFormat, objects); } public static AlertBuilder createEmittable(ServiceEmitter emitter, String descriptionFormat, Object... objects) diff --git a/processing/src/main/java/org/apache/druid/math/expr/Evals.java b/processing/src/main/java/org/apache/druid/math/expr/Evals.java index 0010679a814..91a1dce688a 100644 --- a/processing/src/main/java/org/apache/druid/math/expr/Evals.java +++ b/processing/src/main/java/org/apache/druid/math/expr/Evals.java @@ -82,11 +82,11 @@ public class Evals if (val instanceof Boolean) { return (Boolean) val; } else if (val instanceof String) { - return Evals.asBoolean((String) val); + return asBoolean((String) val); } else if (val instanceof Long) { - return Evals.asBoolean((Long) val); + return asBoolean((Long) val); } else if (val instanceof Number) { - return Evals.asBoolean(((Number) val).doubleValue()); + return asBoolean(((Number) val).doubleValue()); } return false; } diff --git a/processing/src/main/java/org/apache/druid/math/expr/ExprEval.java b/processing/src/main/java/org/apache/druid/math/expr/ExprEval.java index a16b563c77c..a18ca8b61e2 100644 --- a/processing/src/main/java/org/apache/druid/math/expr/ExprEval.java +++ b/processing/src/main/java/org/apache/druid/math/expr/ExprEval.java @@ -166,14 +166,14 @@ public abstract class ExprEval Object[] array = new Object[val.size()]; int i = 0; for (Object o : val) { - array[i++] = o != null ? ExprEval.ofType(ExpressionType.LONG, o).value() : null; + array[i++] = o != null ? ofType(ExpressionType.LONG, o).value() : null; } return new NonnullPair<>(ExpressionType.LONG_ARRAY, array); } else if (coercedType == Float.class || coercedType == Double.class) { Object[] array = new Object[val.size()]; int i = 0; for (Object o : val) { - array[i++] = o != null ? ExprEval.ofType(ExpressionType.DOUBLE, o).value() : null; + array[i++] = o != null ? ofType(ExpressionType.DOUBLE, o).value() : null; } return new NonnullPair<>(ExpressionType.DOUBLE_ARRAY, array); } else if (coercedType == Object.class) { @@ -184,7 +184,7 @@ public abstract class ExprEval ExpressionType elementType = null; for (Object o : val) { if (o != null) { - ExprEval eval = ExprEval.bestEffortOf(o); + ExprEval eval = bestEffortOf(o); elementType = ExpressionTypeConversion.leastRestrictiveType(elementType, eval.type()); evals[i++] = eval; } else { @@ -196,7 +196,7 @@ public abstract class ExprEval if (eval != null) { array[i++] = eval.castTo(elementType).value(); } else { - array[i++] = ExprEval.ofType(elementType, null).value(); + array[i++] = ofType(elementType, null).value(); } } ExpressionType arrayType = elementType == null @@ -208,7 +208,7 @@ public abstract class ExprEval Object[] array = new Object[val.size()]; int i = 0; for (Object o : val) { - array[i++] = o != null ? ExprEval.ofType(ExpressionType.STRING, o).value() : null; + array[i++] = o != null ? ofType(ExpressionType.STRING, o).value() : null; } return new NonnullPair<>(ExpressionType.STRING_ARRAY, array); } @@ -362,11 +362,11 @@ public abstract class ExprEval { switch (type.getType()) { case DOUBLE: - return ExprEval.of(Evals.asDouble(value)); + return of(Evals.asDouble(value)); case LONG: return ofLongBoolean(value); case STRING: - return ExprEval.of(String.valueOf(value)); + return of(String.valueOf(value)); default: throw new Types.InvalidCastBooleanException(type); } @@ -559,7 +559,7 @@ public abstract class ExprEval return ofLongBoolean((Boolean) value); } if (value instanceof String) { - return ofLong(ExprEval.computeNumber((String) value)); + return ofLong(computeNumber((String) value)); } return ofLong(null); case DOUBLE: @@ -570,7 +570,7 @@ public abstract class ExprEval return ofDouble(Evals.asDouble((Boolean) value)); } if (value instanceof String) { - return ofDouble(ExprEval.computeNumber((String) value)); + return ofDouble(computeNumber((String) value)); } return ofDouble(null); case COMPLEX: @@ -605,7 +605,7 @@ public abstract class ExprEval Object[] array = new Object[theList.size()]; int i = 0; for (Object o : theList) { - array[i++] = ExprEval.ofType(elementType, o).value(); + array[i++] = ofType(elementType, o).value(); } return ofArray(type, array); } @@ -615,7 +615,7 @@ public abstract class ExprEval Object[] array = new Object[inputArray.length]; int i = 0; for (Object o : inputArray) { - array[i++] = ExprEval.ofType(elementType, o).value(); + array[i++] = ofType(elementType, o).value(); } return ofArray(type, array); } @@ -890,20 +890,20 @@ public abstract class ExprEval return this; case LONG: if (value == null) { - return ExprEval.ofLong(null); + return ofLong(null); } else { - return ExprEval.of(asLong()); + return of(asLong()); } case STRING: - return ExprEval.of(asString()); + return of(asString()); case ARRAY: switch (castTo.getElementType().getType()) { case DOUBLE: - return ExprEval.ofDoubleArray(asArray()); + return ofDoubleArray(asArray()); case LONG: - return ExprEval.ofLongArray(value == null ? null : new Object[]{value.longValue()}); + return ofLongArray(value == null ? null : new Object[]{value.longValue()}); case STRING: - return ExprEval.ofStringArray(value == null ? null : new Object[]{value.toString()}); + return ofStringArray(value == null ? null : new Object[]{value.toString()}); default: ExpressionType elementType = (ExpressionType) castTo.getElementType(); return new ArrayExprEval(castTo, new Object[]{castTo(elementType).value()}); @@ -971,25 +971,25 @@ public abstract class ExprEval switch (castTo.getType()) { case DOUBLE: if (value == null) { - return ExprEval.ofDouble(null); + return ofDouble(null); } else { - return ExprEval.of(asDouble()); + return of(asDouble()); } case LONG: return this; case STRING: - return ExprEval.of(asString()); + return of(asString()); case ARRAY: if (value == null) { return new ArrayExprEval(castTo, null); } switch (castTo.getElementType().getType()) { case DOUBLE: - return ExprEval.ofDoubleArray(new Object[]{value.doubleValue()}); + return ofDoubleArray(new Object[]{value.doubleValue()}); case LONG: - return ExprEval.ofLongArray(asArray()); + return ofLongArray(asArray()); case STRING: - return ExprEval.ofStringArray(new Object[]{value.toString()}); + return ofStringArray(new Object[]{value.toString()}); default: ExpressionType elementType = (ExpressionType) castTo.getElementType(); return new ArrayExprEval(castTo, new Object[]{castTo(elementType).value()}); @@ -1150,10 +1150,10 @@ public abstract class ExprEval { switch (castTo.getType()) { case DOUBLE: - return ExprEval.ofDouble(computeNumber()); + return ofDouble(computeNumber()); case LONG: - return ExprEval.ofLong(computeNumber()); + return ofLong(computeNumber()); case STRING: return this; @@ -1165,12 +1165,12 @@ public abstract class ExprEval ExprType type = castTo.getElementType().getType(); if (type == ExprType.DOUBLE) { final Number number = computeNumber(); - return ExprEval.ofDoubleArray(new Object[]{number == null ? null : number.doubleValue()}); + return ofDoubleArray(new Object[]{number == null ? null : number.doubleValue()}); } else if (type == ExprType.LONG) { final Number number = computeNumber(); - return ExprEval.ofLongArray(new Object[]{number == null ? null : number.longValue()}); + return ofLongArray(new Object[]{number == null ? null : number.longValue()}); } else if (type == ExprType.STRING) { - return ExprEval.ofStringArray(new Object[]{value}); + return ofStringArray(new Object[]{value}); } ExpressionType elementType = (ExpressionType) castTo.getElementType(); @@ -1335,7 +1335,7 @@ public abstract class ExprEval if (castTo.isArray()) { return new ArrayExprEval(castTo, null); } - return ExprEval.ofType(castTo, null); + return ofType(castTo, null); } if (type().equals(castTo)) { return this; @@ -1343,26 +1343,26 @@ public abstract class ExprEval switch (castTo.getType()) { case STRING: if (value.length == 1) { - return ExprEval.of(asString()); + return of(asString()); } break; case LONG: if (value.length == 1) { - return isNumericNull() ? ExprEval.ofLong(null) : ExprEval.ofLong(asLong()); + return isNumericNull() ? ofLong(null) : ofLong(asLong()); } break; case DOUBLE: if (value.length == 1) { - return isNumericNull() ? ExprEval.ofDouble(null) : ExprEval.ofDouble(asDouble()); + return isNumericNull() ? ofDouble(null) : ofDouble(asDouble()); } break; case ARRAY: ExpressionType elementType = (ExpressionType) castTo.getElementType(); Object[] cast = new Object[value.length]; for (int i = 0; i < value.length; i++) { - cast[i] = ExprEval.ofType(elementType(), value[i]).castTo(elementType).value(); + cast[i] = ofType(elementType(), value[i]).castTo(elementType).value(); } - return ExprEval.ofArray(castTo, cast); + return ofArray(castTo, cast); case COMPLEX: if (ExpressionType.NESTED_DATA.equals(castTo)) { return new NestedDataExprEval(value); @@ -1536,7 +1536,7 @@ public abstract class ExprEval } else if (val instanceof Boolean) { number = Evals.asLong((Boolean) val); } else if (val instanceof String) { - number = ExprEval.computeNumber((String) val); + number = computeNumber((String) val); } } } @@ -1546,7 +1546,7 @@ public abstract class ExprEval public Object[] asArray() { Object val = StructuredData.unwrap(value); - ExprEval maybeArray = ExprEval.bestEffortOf(val); + ExprEval maybeArray = bestEffortOf(val); if (maybeArray.type().isPrimitive() || maybeArray.isArray()) { return maybeArray.asArray(); } @@ -1561,7 +1561,7 @@ public abstract class ExprEval } Object val = StructuredData.unwrap(value); - ExprEval bestEffortOf = ExprEval.bestEffortOf(val); + ExprEval bestEffortOf = bestEffortOf(val); if (bestEffortOf.type().isPrimitive() || bestEffortOf.type().isArray()) { return bestEffortOf.castTo(castTo); diff --git a/processing/src/main/java/org/apache/druid/math/expr/ExprMacroTable.java b/processing/src/main/java/org/apache/druid/math/expr/ExprMacroTable.java index 40d8ba1112c..9aa1029898a 100644 --- a/processing/src/main/java/org/apache/druid/math/expr/ExprMacroTable.java +++ b/processing/src/main/java/org/apache/druid/math/expr/ExprMacroTable.java @@ -159,7 +159,7 @@ public class ExprMacroTable macro.name(), args.size() == 1 ? args.get(0).stringify() - : Expr.ARG_JOINER.join(args.stream().map(Expr::stringify).iterator()) + : ARG_JOINER.join(args.stream().map(Expr::stringify).iterator()) ); } diff --git a/processing/src/main/java/org/apache/druid/math/expr/ExprType.java b/processing/src/main/java/org/apache/druid/math/expr/ExprType.java index 9a9294cb404..40da7469566 100644 --- a/processing/src/main/java/org/apache/druid/math/expr/ExprType.java +++ b/processing/src/main/java/org/apache/druid/math/expr/ExprType.java @@ -49,6 +49,6 @@ public enum ExprType implements TypeDescriptor @Override public boolean isArray() { - return this == ExprType.ARRAY; + return this == ARRAY; } } diff --git a/processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java b/processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java index 42f32212097..86d47d92cb2 100644 --- a/processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java +++ b/processing/src/main/java/org/apache/druid/math/expr/ExpressionType.java @@ -54,7 +54,7 @@ public class ExpressionType extends BaseTypeSignature public static final ExpressionType DOUBLE_ARRAY = new ExpressionType(ExprType.ARRAY, null, DOUBLE); public static final ExpressionType NESTED_DATA = - ExpressionType.fromColumnTypeStrict(ColumnType.NESTED_DATA); + fromColumnTypeStrict(ColumnType.NESTED_DATA); public static final ExpressionType UNKNOWN_COMPLEX = new ExpressionType(ExprType.COMPLEX, null, null); diff --git a/processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeConversion.java b/processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeConversion.java index 16ae5024830..cffb2c00207 100644 --- a/processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeConversion.java +++ b/processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeConversion.java @@ -241,7 +241,7 @@ public class ExpressionTypeConversion @Nullable public static ExpressionType integerMathFunction(@Nullable ExpressionType type, @Nullable ExpressionType other) { - final ExpressionType functionType = ExpressionTypeConversion.function(type, other); + final ExpressionType functionType = function(type, other); // any number is long return Types.isNumeric(functionType) ? ExpressionType.LONG : functionType; } diff --git a/processing/src/main/java/org/apache/druid/math/expr/Parser.java b/processing/src/main/java/org/apache/druid/math/expr/Parser.java index e92dd130b7c..80bd58ad4ec 100644 --- a/processing/src/main/java/org/apache/druid/math/expr/Parser.java +++ b/processing/src/main/java/org/apache/druid/math/expr/Parser.java @@ -110,7 +110,7 @@ public class Parser */ public static Supplier lazyParse(@Nullable String in, ExprMacroTable macroTable) { - return Suppliers.memoize(() -> in == null ? null : Parser.parse(in, macroTable)); + return Suppliers.memoize(() -> in == null ? null : parse(in, macroTable)); } /** diff --git a/processing/src/main/java/org/apache/druid/query/JoinDataSource.java b/processing/src/main/java/org/apache/druid/query/JoinDataSource.java index 220f18a9485..e75ee5f63fe 100644 --- a/processing/src/main/java/org/apache/druid/query/JoinDataSource.java +++ b/processing/src/main/java/org/apache/druid/query/JoinDataSource.java @@ -313,7 +313,7 @@ public class JoinDataSource implements DataSource DimFilter joinBaseFilter = analysis.getJoinBaseTableFilter().orElse(null); for (final PreJoinableClause clause : analysis.getPreJoinableClauses()) { - current = JoinDataSource.create( + current = create( current, clause.getDataSource(), clause.getPrefix(), diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/AggregatorUtil.java b/processing/src/main/java/org/apache/druid/query/aggregation/AggregatorUtil.java index c4c9a7875ef..c1cc0c5f523 100755 --- a/processing/src/main/java/org/apache/druid/query/aggregation/AggregatorUtil.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/AggregatorUtil.java @@ -219,7 +219,7 @@ public class AggregatorUtil ) { - List condensedPostAggs = AggregatorUtil.pruneDependentPostAgg(postAggList, metric); + List condensedPostAggs = pruneDependentPostAgg(postAggList, metric); // calculate dependent aggregators for these postAgg Set dependencySet = new HashSet<>(); dependencySet.add(metric); @@ -427,7 +427,7 @@ public class AggregatorUtil return ByteBuffer.allocate(2 + fieldNameBytes.length + expressionBytes.length) .put(aggregatorType) .put(fieldNameBytes) - .put(AggregatorUtil.STRING_SEPARATOR) + .put(STRING_SEPARATOR) .put(expressionBytes) .array(); }); diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyAggregatorFactory.java b/processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyAggregatorFactory.java index 418bb32f64e..286ac4d47b7 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyAggregatorFactory.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyAggregatorFactory.java @@ -119,7 +119,7 @@ public class StringAnyAggregatorFactory extends AggregatorFactory @Override public Comparator getComparator() { - return StringAnyAggregatorFactory.VALUE_COMPARATOR; + return VALUE_COMPARATOR; } @Override diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/firstlast/first/StringFirstAggregatorFactory.java b/processing/src/main/java/org/apache/druid/query/aggregation/firstlast/first/StringFirstAggregatorFactory.java index 8ff45a27380..80a4ca8ddce 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/firstlast/first/StringFirstAggregatorFactory.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/firstlast/first/StringFirstAggregatorFactory.java @@ -150,7 +150,7 @@ public class StringFirstAggregatorFactory extends AggregatorFactory this.fieldName = fieldName; this.timeColumn = timeColumn == null ? ColumnHolder.TIME_COLUMN_NAME : timeColumn; this.maxStringBytes = maxStringBytes == null - ? StringFirstAggregatorFactory.DEFAULT_MAX_STRING_SIZE + ? DEFAULT_MAX_STRING_SIZE : maxStringBytes; } diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/post/ArithmeticPostAggregator.java b/processing/src/main/java/org/apache/druid/query/aggregation/post/ArithmeticPostAggregator.java index 468be2b2a62..2c343d7062f 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/post/ArithmeticPostAggregator.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/post/ArithmeticPostAggregator.java @@ -265,7 +265,7 @@ public class ArithmeticPostAggregator implements PostAggregator private static final Map LOOKUP_MAP = new HashMap<>(); static { - for (Ops op : Ops.values()) { + for (Ops op : values()) { LOOKUP_MAP.put(op.getFn(), op); } } diff --git a/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQuery.java b/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQuery.java index 5c43c6445bc..e5e6ead376d 100644 --- a/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQuery.java +++ b/processing/src/main/java/org/apache/druid/query/datasourcemetadata/DataSourceMetadataQuery.java @@ -69,7 +69,7 @@ public class DataSourceMetadataQuery extends BaseQuery public Builder queryId(String queryId) { - context = BaseQuery.computeOverriddenContext(context, ImmutableMap.of(BaseQuery.QUERY_ID, queryId)); + context = computeOverriddenContext(context, ImmutableMap.of(QUERY_ID, queryId)); return this; } diff --git a/processing/src/main/java/org/apache/druid/query/groupby/GroupingEngine.java b/processing/src/main/java/org/apache/druid/query/groupby/GroupingEngine.java index 5dc995b5538..f53c64a566e 100644 --- a/processing/src/main/java/org/apache/druid/query/groupby/GroupingEngine.java +++ b/processing/src/main/java/org/apache/druid/query/groupby/GroupingEngine.java @@ -502,7 +502,7 @@ public class GroupingEngine closer.register(bufferHolder); try { final String fudgeTimestampString = NullHandling.emptyToNullIfNeeded( - query.context().getString(GroupingEngine.CTX_KEY_FUDGE_TIMESTAMP) + query.context().getString(CTX_KEY_FUDGE_TIMESTAMP) ); final DateTime fudgeTimestamp = fudgeTimestampString == null diff --git a/processing/src/main/java/org/apache/druid/query/groupby/ResultRow.java b/processing/src/main/java/org/apache/druid/query/groupby/ResultRow.java index 977cba96034..1232fc7c591 100644 --- a/processing/src/main/java/org/apache/druid/query/groupby/ResultRow.java +++ b/processing/src/main/java/org/apache/druid/query/groupby/ResultRow.java @@ -91,7 +91,7 @@ public final class ResultRow public static ResultRow fromLegacyRow(Row row, final GroupByQuery query) { // Can't be sure if we'll get result rows with or without postaggregations, so be safe. - final ResultRow resultRow = ResultRow.create(query.getResultRowSizeWithPostAggregators()); + final ResultRow resultRow = create(query.getResultRowSizeWithPostAggregators()); int i = 0; if (query.getResultRowHasTimestamp()) { diff --git a/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java b/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java index 063348f35b7..bd0768297d7 100644 --- a/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java +++ b/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java @@ -449,7 +449,7 @@ public class RowBasedGrouperHelper final ColumnSelectorFactory columnSelectorFactory = query.getVirtualColumns() .wrap( - RowBasedGrouperHelper.createResultRowBasedColumnSelectorFactory( + createResultRowBasedColumnSelectorFactory( subquery, rowSupplier, RowSignature.Finalization.UNKNOWN diff --git a/processing/src/main/java/org/apache/druid/query/groupby/orderby/OrderByColumnSpec.java b/processing/src/main/java/org/apache/druid/query/groupby/orderby/OrderByColumnSpec.java index ac043d781c2..01ca2b8431c 100644 --- a/processing/src/main/java/org/apache/druid/query/groupby/orderby/OrderByColumnSpec.java +++ b/processing/src/main/java/org/apache/druid/query/groupby/orderby/OrderByColumnSpec.java @@ -55,7 +55,7 @@ public class OrderByColumnSpec private static final Map STUPID_ENUM_MAP; static { final ImmutableMap.Builder bob = ImmutableMap.builder(); - for (Direction direction : Direction.values()) { + for (Direction direction : values()) { bob.put(direction.name(), direction); } STUPID_ENUM_MAP = bob.build(); @@ -75,7 +75,7 @@ public class OrderByColumnSpec Direction direction = STUPID_ENUM_MAP.get(upperName); if (direction == null) { - for (Direction dir : Direction.values()) { + for (Direction dir : values()) { if (dir.name().startsWith(upperName)) { if (direction != null) { throw new ISE("Ambiguous directions[%s] and [%s]", direction, dir); diff --git a/processing/src/main/java/org/apache/druid/query/metadata/metadata/ColumnAnalysis.java b/processing/src/main/java/org/apache/druid/query/metadata/metadata/ColumnAnalysis.java index d157ee8c1a1..1ce8f4f3e95 100644 --- a/processing/src/main/java/org/apache/druid/query/metadata/metadata/ColumnAnalysis.java +++ b/processing/src/main/java/org/apache/druid/query/metadata/metadata/ColumnAnalysis.java @@ -151,7 +151,7 @@ public class ColumnAnalysis } if (isError() && rhs.isError()) { - return errorMessage.equals(rhs.getErrorMessage()) ? this : ColumnAnalysis.error("multiple_errors"); + return errorMessage.equals(rhs.getErrorMessage()) ? this : error("multiple_errors"); } else if (isError()) { return this; } else if (rhs.isError()) { @@ -159,13 +159,13 @@ public class ColumnAnalysis } if (!Objects.equals(type, rhs.getType())) { - return ColumnAnalysis.error( + return error( StringUtils.format("cannot_merge_diff_types: [%s] and [%s]", type, rhs.getType()) ); } if (!Objects.equals(typeSignature, rhs.getTypeSignature())) { - return ColumnAnalysis.error( + return error( StringUtils.format( "cannot_merge_diff_types: [%s] and [%s]", typeSignature.asTypeString(), diff --git a/processing/src/main/java/org/apache/druid/query/metadata/metadata/SegmentMetadataQuery.java b/processing/src/main/java/org/apache/druid/query/metadata/metadata/SegmentMetadataQuery.java index f2d434bab8a..1e365ea4b51 100644 --- a/processing/src/main/java/org/apache/druid/query/metadata/metadata/SegmentMetadataQuery.java +++ b/processing/src/main/java/org/apache/druid/query/metadata/metadata/SegmentMetadataQuery.java @@ -164,7 +164,7 @@ public class SegmentMetadataQuery extends BaseQuery @Override public String getType() { - return Query.SEGMENT_METADATA; + return SEGMENT_METADATA; } @JsonProperty diff --git a/processing/src/main/java/org/apache/druid/query/operator/WindowOperatorQuery.java b/processing/src/main/java/org/apache/druid/query/operator/WindowOperatorQuery.java index 79a8ebdb19d..97d053491eb 100644 --- a/processing/src/main/java/org/apache/druid/query/operator/WindowOperatorQuery.java +++ b/processing/src/main/java/org/apache/druid/query/operator/WindowOperatorQuery.java @@ -186,7 +186,7 @@ public class WindowOperatorQuery extends BaseQuery @Override public String getType() { - return Query.WINDOW_OPERATOR; + return WINDOW_OPERATOR; } diff --git a/processing/src/main/java/org/apache/druid/query/ordering/StringComparators.java b/processing/src/main/java/org/apache/druid/query/ordering/StringComparators.java index 650b259ed56..eb44210d911 100644 --- a/processing/src/main/java/org/apache/druid/query/ordering/StringComparators.java +++ b/processing/src/main/java/org/apache/druid/query/ordering/StringComparators.java @@ -98,7 +98,7 @@ public class StringComparators @Override public String toString() { - return StringComparators.LEXICOGRAPHIC_NAME; + return LEXICOGRAPHIC_NAME; } @Override @@ -286,7 +286,7 @@ public class StringComparators @Override public String toString() { - return StringComparators.ALPHANUMERIC_NAME; + return ALPHANUMERIC_NAME; } @Override @@ -340,7 +340,7 @@ public class StringComparators @Override public String toString() { - return StringComparators.STRLEN_NAME; + return STRLEN_NAME; } @Override @@ -404,7 +404,7 @@ public class StringComparators if (bd1 == null && bd2 == null) { // both Strings are unparseable, just compare lexicographically to have a well-defined ordering - return StringComparators.LEXICOGRAPHIC.compare(o1, o2); + return LEXICOGRAPHIC.compare(o1, o2); } if (bd1 == null) { @@ -417,7 +417,7 @@ public class StringComparators @Override public String toString() { - return StringComparators.NUMERIC_NAME; + return NUMERIC_NAME; } @Override @@ -469,7 +469,7 @@ public class StringComparators @Override public String toString() { - return StringComparators.VERSION_NAME; + return VERSION_NAME; } @Override @@ -520,7 +520,7 @@ public class StringComparators @Override public String toString() { - return StringComparators.NATURAL_NAME; + return NATURAL_NAME; } @Override diff --git a/processing/src/main/java/org/apache/druid/query/rowsandcols/MapOfColumnsRowsAndColumns.java b/processing/src/main/java/org/apache/druid/query/rowsandcols/MapOfColumnsRowsAndColumns.java index d6bc1026a98..48e93f10e75 100644 --- a/processing/src/main/java/org/apache/druid/query/rowsandcols/MapOfColumnsRowsAndColumns.java +++ b/processing/src/main/java/org/apache/druid/query/rowsandcols/MapOfColumnsRowsAndColumns.java @@ -205,7 +205,7 @@ public class MapOfColumnsRowsAndColumns implements RowsAndColumns public MapOfColumnsRowsAndColumns build() { - return MapOfColumnsRowsAndColumns.fromMap(cols); + return fromMap(cols); } } diff --git a/processing/src/main/java/org/apache/druid/query/search/SearchQuery.java b/processing/src/main/java/org/apache/druid/query/search/SearchQuery.java index aa10b6ab579..06ef3aa0a32 100644 --- a/processing/src/main/java/org/apache/druid/query/search/SearchQuery.java +++ b/processing/src/main/java/org/apache/druid/query/search/SearchQuery.java @@ -94,7 +94,7 @@ public class SearchQuery extends BaseQuery> @Override public String getType() { - return Query.SEARCH; + return SEARCH; } @Override diff --git a/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQuery.java b/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQuery.java index 47412f7d7d5..95913b77940 100644 --- a/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQuery.java +++ b/processing/src/main/java/org/apache/druid/query/timeboundary/TimeBoundaryQuery.java @@ -89,7 +89,7 @@ public class TimeBoundaryQuery extends BaseQuery @Override public String getType() { - return Query.TIME_BOUNDARY; + return TIME_BOUNDARY; } @JsonProperty diff --git a/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQuery.java b/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQuery.java index b2165cd5b70..f85237c8be8 100644 --- a/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQuery.java +++ b/processing/src/main/java/org/apache/druid/query/timeseries/TimeseriesQuery.java @@ -120,7 +120,7 @@ public class TimeseriesQuery extends BaseQuery> @Override public String getType() { - return Query.TIMESERIES; + return TIMESERIES; } @JsonProperty diff --git a/processing/src/main/java/org/apache/druid/query/topn/PooledTopNAlgorithm.java b/processing/src/main/java/org/apache/druid/query/topn/PooledTopNAlgorithm.java index d2ba1674621..9ab0241c31e 100644 --- a/processing/src/main/java/org/apache/druid/query/topn/PooledTopNAlgorithm.java +++ b/processing/src/main/java/org/apache/druid/query/topn/PooledTopNAlgorithm.java @@ -81,28 +81,28 @@ public class PooledTopNAlgorithm @VisibleForTesting static void setSpecializeGeneric1AggPooledTopN(boolean value) { - PooledTopNAlgorithm.SPECIALIZE_GENERIC_ONE_AGG_POOLED_TOPN = value; + SPECIALIZE_GENERIC_ONE_AGG_POOLED_TOPN = value; computeSpecializedScanAndAggregateImplementations(); } @VisibleForTesting static void setSpecializeGeneric2AggPooledTopN(boolean value) { - PooledTopNAlgorithm.SPECIALIZE_GENERIC_TWO_AGG_POOLED_TOPN = value; + SPECIALIZE_GENERIC_TWO_AGG_POOLED_TOPN = value; computeSpecializedScanAndAggregateImplementations(); } @VisibleForTesting static void setSpecializeHistorical1SimpleDoubleAggPooledTopN(boolean value) { - PooledTopNAlgorithm.SPECIALIZE_HISTORICAL_ONE_SIMPLE_DOUBLE_AGG_POOLED_TOPN = value; + SPECIALIZE_HISTORICAL_ONE_SIMPLE_DOUBLE_AGG_POOLED_TOPN = value; computeSpecializedScanAndAggregateImplementations(); } @VisibleForTesting static void setSpecializeHistoricalSingleValueDimSelector1SimpleDoubleAggPooledTopN(boolean value) { - PooledTopNAlgorithm.SPECIALIZE_HISTORICAL_SINGLE_VALUE_DIM_SELECTOR_ONE_SIMPLE_DOUBLE_AGG_POOLED_TOPN = value; + SPECIALIZE_HISTORICAL_SINGLE_VALUE_DIM_SELECTOR_ONE_SIMPLE_DOUBLE_AGG_POOLED_TOPN = value; computeSpecializedScanAndAggregateImplementations(); } diff --git a/processing/src/main/java/org/apache/druid/segment/AutoTypeColumnIndexer.java b/processing/src/main/java/org/apache/druid/segment/AutoTypeColumnIndexer.java index d0209b0bfea..45a58dfcdd7 100644 --- a/processing/src/main/java/org/apache/druid/segment/AutoTypeColumnIndexer.java +++ b/processing/src/main/java/org/apache/druid/segment/AutoTypeColumnIndexer.java @@ -99,7 +99,7 @@ public class AutoTypeColumnIndexer implements DimensionIndexer eval = ExprEval.bestEffortOf(fieldValue); FieldIndexer fieldIndexer = fieldIndexers.get(fieldName); if (fieldIndexer == null) { - estimatedFieldKeySize += StructuredDataProcessor.estimateStringSize(fieldName); + estimatedFieldKeySize += estimateStringSize(fieldName); fieldIndexer = new FieldIndexer(globalDictionary); fieldIndexers.put(fieldName, fieldIndexer); } @@ -120,7 +120,7 @@ public class AutoTypeColumnIndexer implements DimensionIndexer DimensionHandlerUtils.convertObjectToType(x, type.getElementType(), reportParseExceptions, fieldName) + x -> convertObjectToType(x, type.getElementType(), reportParseExceptions, fieldName) ); case COMPLEX: // Can't coerce complex objects, and we shouldn't need to. If in future selectors behave weirdly, or we need to diff --git a/processing/src/main/java/org/apache/druid/segment/IndexMergerV9.java b/processing/src/main/java/org/apache/druid/segment/IndexMergerV9.java index 7da89edaff7..2be3966b650 100644 --- a/processing/src/main/java/org/apache/druid/segment/IndexMergerV9.java +++ b/processing/src/main/java/org/apache/druid/segment/IndexMergerV9.java @@ -1232,7 +1232,7 @@ public class IndexMergerV9 implements IndexMerger List tempDirs = new ArrayList<>(); - if (maxColumnsToMerge == IndexMerger.UNLIMITED_MAX_COLUMNS_TO_MERGE) { + if (maxColumnsToMerge == UNLIMITED_MAX_COLUMNS_TO_MERGE) { return merge( indexes, rollup, diff --git a/processing/src/main/java/org/apache/druid/segment/IndexSpec.java b/processing/src/main/java/org/apache/druid/segment/IndexSpec.java index 1dc2f849682..939adf87d4f 100644 --- a/processing/src/main/java/org/apache/druid/segment/IndexSpec.java +++ b/processing/src/main/java/org/apache/druid/segment/IndexSpec.java @@ -43,7 +43,7 @@ import java.util.Objects; */ public class IndexSpec { - public static final IndexSpec DEFAULT = IndexSpec.builder().build(); + public static final IndexSpec DEFAULT = builder().build(); public static Builder builder() { diff --git a/processing/src/main/java/org/apache/druid/segment/NestedDataColumnIndexerV4.java b/processing/src/main/java/org/apache/druid/segment/NestedDataColumnIndexerV4.java index f3c92806e4f..c7107f868ad 100644 --- a/processing/src/main/java/org/apache/druid/segment/NestedDataColumnIndexerV4.java +++ b/processing/src/main/java/org/apache/druid/segment/NestedDataColumnIndexerV4.java @@ -73,7 +73,7 @@ public class NestedDataColumnIndexerV4 implements DimensionIndexer eval = ExprEval.bestEffortOf(fieldValue); FieldIndexer fieldIndexer = fieldIndexers.get(fieldName); if (fieldIndexer == null) { - estimatedFieldKeySize += StructuredDataProcessor.estimateStringSize(fieldName); + estimatedFieldKeySize += estimateStringSize(fieldName); fieldIndexer = new FieldIndexer(globalDictionary); fieldIndexers.put(fieldName, fieldIndexer); } diff --git a/processing/src/main/java/org/apache/druid/segment/RowBasedColumnSelectorFactory.java b/processing/src/main/java/org/apache/druid/segment/RowBasedColumnSelectorFactory.java index 43ae6ae1464..6e89942e1f9 100644 --- a/processing/src/main/java/org/apache/druid/segment/RowBasedColumnSelectorFactory.java +++ b/processing/src/main/java/org/apache/druid/segment/RowBasedColumnSelectorFactory.java @@ -298,7 +298,7 @@ public class RowBasedColumnSelectorFactory implements ColumnSelectorFactory @Override public int getValueCardinality() { - return DimensionDictionarySelector.CARDINALITY_UNKNOWN; + return CARDINALITY_UNKNOWN; } @Override diff --git a/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilities.java b/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilities.java index 59f0e18c0ae..014dfe2227c 100644 --- a/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilities.java +++ b/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilities.java @@ -119,7 +119,7 @@ public interface ColumnCapabilities extends TypeSignature public Capable coerceUnknownToBoolean(boolean unknownIsTrue) { - return this == UNKNOWN ? Capable.of(unknownIsTrue) : this; + return this == UNKNOWN ? of(unknownIsTrue) : this; } public Capable and(Capable other) @@ -146,7 +146,7 @@ public interface ColumnCapabilities extends TypeSignature @JsonCreator public static Capable ofNullable(@Nullable Boolean bool) { - return bool == null ? Capable.UNKNOWN : of(bool); + return bool == null ? UNKNOWN : of(bool); } @JsonValue diff --git a/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilitiesImpl.java b/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilitiesImpl.java index f0b13a7115e..956352e1c28 100644 --- a/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilitiesImpl.java +++ b/processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilitiesImpl.java @@ -110,7 +110,7 @@ public class ColumnCapabilitiesImpl implements ColumnCapabilities */ public static ColumnCapabilitiesImpl createDefault() { - return ColumnCapabilitiesImpl.snapshot(new ColumnCapabilitiesImpl(), ALL_FALSE); + return snapshot(new ColumnCapabilitiesImpl(), ALL_FALSE); } /** diff --git a/processing/src/main/java/org/apache/druid/segment/column/ColumnType.java b/processing/src/main/java/org/apache/druid/segment/column/ColumnType.java index b670d8f4370..60da75855fc 100644 --- a/processing/src/main/java/org/apache/druid/segment/column/ColumnType.java +++ b/processing/src/main/java/org/apache/druid/segment/column/ColumnType.java @@ -179,8 +179,8 @@ public class ColumnType extends BaseTypeSignature } // if either is nested data, use nested data, otherwise error if (type.is(ValueType.COMPLEX) || other.is(ValueType.COMPLEX)) { - if (ColumnType.NESTED_DATA.equals(type) || ColumnType.NESTED_DATA.equals(other)) { - return ColumnType.NESTED_DATA; + if (NESTED_DATA.equals(type) || NESTED_DATA.equals(other)) { + return NESTED_DATA; } throw new Types.IncompatibleTypeException(type, other); } @@ -198,14 +198,14 @@ public class ColumnType extends BaseTypeSignature (ColumnType) other.getElementType() ); - return ColumnType.ofArray(commonElementType); + return ofArray(commonElementType); } else { commonElementType = leastRestrictiveType( (ColumnType) type.getElementType(), other ); } - return ColumnType.ofArray(commonElementType); + return ofArray(commonElementType); } if (other.isArray()) { if (type.equals(type.getElementType())) { @@ -217,22 +217,22 @@ public class ColumnType extends BaseTypeSignature type, (ColumnType) other.getElementType() ); - return ColumnType.ofArray(commonElementType); + return ofArray(commonElementType); } // if either argument is a string, type becomes a string if (Types.is(type, ValueType.STRING) || Types.is(other, ValueType.STRING)) { - return ColumnType.STRING; + return STRING; } // all numbers win over longs if (Types.is(type, ValueType.LONG) && Types.isNullOr(other, ValueType.LONG)) { - return ColumnType.LONG; + return LONG; } // doubles win over floats if (Types.is(type, ValueType.FLOAT) && Types.isNullOr(other, ValueType.FLOAT)) { - return ColumnType.FLOAT; + return FLOAT; } - return ColumnType.DOUBLE; + return DOUBLE; } } diff --git a/processing/src/main/java/org/apache/druid/segment/column/ValueType.java b/processing/src/main/java/org/apache/druid/segment/column/ValueType.java index 6e114ec8995..083e87bf5fc 100644 --- a/processing/src/main/java/org/apache/druid/segment/column/ValueType.java +++ b/processing/src/main/java/org/apache/druid/segment/column/ValueType.java @@ -128,7 +128,7 @@ public enum ValueType implements TypeDescriptor @Override public boolean isPrimitive() { - return this.equals(ValueType.STRING) || isNumeric(this); + return STRING.equals(this) || isNumeric(this); } @Nullable @@ -143,11 +143,11 @@ public enum ValueType implements TypeDescriptor public static boolean isNumeric(ValueType type) { - return type == ValueType.LONG || type == ValueType.FLOAT || type == ValueType.DOUBLE; + return type == LONG || type == FLOAT || type == DOUBLE; } public static boolean isArray(ValueType type) { - return type == ValueType.ARRAY; + return type == ARRAY; } } diff --git a/processing/src/main/java/org/apache/druid/segment/data/CompressionFactory.java b/processing/src/main/java/org/apache/druid/segment/data/CompressionFactory.java index 9e7d2ea5b61..40931b0fa81 100644 --- a/processing/src/main/java/org/apache/druid/segment/data/CompressionFactory.java +++ b/processing/src/main/java/org/apache/druid/segment/data/CompressionFactory.java @@ -203,7 +203,7 @@ public class CompressionFactory static final Map ID_MAP = new HashMap<>(); static { - for (LongEncodingFormat format : LongEncodingFormat.values()) { + for (LongEncodingFormat format : values()) { ID_MAP.put(format.getId(), format); } } diff --git a/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java b/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java index 18ea27cc404..34eb269851a 100644 --- a/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java +++ b/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java @@ -158,7 +158,7 @@ public enum CompressionStrategy static final Map ID_MAP = new HashMap<>(); static { - for (CompressionStrategy strategy : CompressionStrategy.values()) { + for (CompressionStrategy strategy : values()) { ID_MAP.put(strategy.getId(), strategy); } } @@ -171,7 +171,7 @@ public enum CompressionStrategy // TODO remove this method and change all its callers to use all CompressionStrategy values when NONE type is supported by all types public static CompressionStrategy[] noNoneValues() { - return (CompressionStrategy[]) ArrayUtils.removeElement(CompressionStrategy.values(), NONE); + return (CompressionStrategy[]) ArrayUtils.removeElement(values(), NONE); } public interface Decompressor diff --git a/processing/src/main/java/org/apache/druid/segment/data/FrontCodedIndexed.java b/processing/src/main/java/org/apache/druid/segment/data/FrontCodedIndexed.java index f3f1457c503..1ba694cbcfc 100644 --- a/processing/src/main/java/org/apache/druid/segment/data/FrontCodedIndexed.java +++ b/processing/src/main/java/org/apache/druid/segment/data/FrontCodedIndexed.java @@ -83,12 +83,12 @@ public abstract class FrontCodedIndexed implements Indexed public static byte validateVersion(byte version) { - if (version != FrontCodedIndexed.V0 && version != FrontCodedIndexed.V1) { + if (version != V0 && version != V1) { throw new IAE( "Unknown format version for FrontCodedIndexed [%s], must be [%s] or [%s]", version, - FrontCodedIndexed.V0, - FrontCodedIndexed.V1 + V0, + V1 ); } return version; diff --git a/processing/src/main/java/org/apache/druid/segment/data/Indexed.java b/processing/src/main/java/org/apache/druid/segment/data/Indexed.java index f85e1a84168..cf5687b8461 100644 --- a/processing/src/main/java/org/apache/druid/segment/data/Indexed.java +++ b/processing/src/main/java/org/apache/druid/segment/data/Indexed.java @@ -53,7 +53,7 @@ public interface Indexed extends Iterable, HotLoopCallee @Override public T get(int index) { - Indexed.checkIndex(index, 0); + checkIndex(index, 0); return null; } diff --git a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java index 1c0893b4a05..1d83e2eda11 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/Filters.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/Filters.java @@ -164,7 +164,7 @@ public class Filters } boolean useCNF = query.context().getBoolean(QueryContexts.USE_FILTER_CNF_KEY, QueryContexts.DEFAULT_USE_FILTER_CNF); try { - return useCNF ? Filters.toCnf(filter) : filter; + return useCNF ? toCnf(filter) : filter; } catch (CNFFilterExplosionException cnfFilterExplosionException) { return filter; // cannot convert to CNF, return the filter as is @@ -321,7 +321,7 @@ public class Filters */ public static List toNormalizedOrClauses(Filter filter) throws CNFFilterExplosionException { - Filter normalizedFilter = Filters.toCnf(filter); + Filter normalizedFilter = toCnf(filter); // List of candidates for pushdown // CNF normalization will generate either diff --git a/processing/src/main/java/org/apache/druid/segment/filter/ValueMatchers.java b/processing/src/main/java/org/apache/druid/segment/filter/ValueMatchers.java index 344fbbb70cb..a543f56fa9f 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/ValueMatchers.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/ValueMatchers.java @@ -411,7 +411,7 @@ public class ValueMatchers final int nullId = lookup.lookupId(null); if (nullId < 0) { // column doesn't have null value so no unknowns, can safely return always false matcher - return ValueMatchers.allFalse(); + return allFalse(); } if (multiValue) { return new ValueMatcher() diff --git a/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java b/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java index a9819fd75cb..4476d70f112 100644 --- a/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java +++ b/processing/src/main/java/org/apache/druid/segment/index/IndexedUtf8ValueIndexes.java @@ -241,7 +241,7 @@ public final class IndexedUtf8ValueIndexes ValueSetIndexes.SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) { + if (tailSet.size() > SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) { return ValueSetIndexes.buildBitmapColumnIndexFromSortedIteratorScan( bitmapFactory, ByteBufferUtils.utf8Comparator(), diff --git a/processing/src/main/java/org/apache/druid/segment/nested/FieldTypeInfo.java b/processing/src/main/java/org/apache/druid/segment/nested/FieldTypeInfo.java index b00af7a132f..7750b864544 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/FieldTypeInfo.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/FieldTypeInfo.java @@ -253,7 +253,7 @@ public class FieldTypeInfo byte typeByte = types.getByteValue(); // adjust for empty array if needed if (types.hasUntypedArray()) { - Set columnTypes = FieldTypeInfo.convertToSet(types.getByteValue()); + Set columnTypes = convertToSet(types.getByteValue()); ColumnType leastRestrictive = null; for (ColumnType type : columnTypes) { leastRestrictive = ColumnType.leastRestrictiveType(leastRestrictive, type); diff --git a/processing/src/main/java/org/apache/druid/segment/nested/NestedCommonFormatColumnSerializer.java b/processing/src/main/java/org/apache/druid/segment/nested/NestedCommonFormatColumnSerializer.java index 88b5c240e1b..acaa9a32c12 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/NestedCommonFormatColumnSerializer.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/NestedCommonFormatColumnSerializer.java @@ -88,7 +88,7 @@ public abstract class NestedCommonFormatColumnSerializer implements GenericColum public static void writeV0Header(WritableByteChannel channel, ByteBuffer columnNameBuffer) throws IOException { - channel.write(ByteBuffer.wrap(new byte[]{NestedCommonFormatColumnSerializer.V0})); + channel.write(ByteBuffer.wrap(new byte[]{V0})); channel.write(columnNameBuffer); } diff --git a/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java b/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java index d53596964f8..5e2d38238c4 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/NestedFieldColumnIndexSupplier.java @@ -1314,7 +1314,7 @@ public class NestedFieldColumnIndexSupplier= Integer.MAX_VALUE / NestedVariantIndexes.INDEX_COMPUTE_SCALE) { + if (values.size() >= Integer.MAX_VALUE / INDEX_COMPUTE_SCALE) { return Integer.MAX_VALUE; } - return values.size() * NestedVariantIndexes.INDEX_COMPUTE_SCALE; + return values.size() * INDEX_COMPUTE_SCALE; } @Override diff --git a/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java b/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java index 1bde18e188a..8452e143d6e 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/ScalarDoubleColumnAndIndexSupplier.java @@ -323,7 +323,7 @@ public class ScalarDoubleColumnAndIndexSupplier implements Supplier tailSet; final List baseSet = (List) sortedValues; - if (sortedValues.size() >= ValueSetIndexes.SIZE_WORTH_CHECKING_MIN) { + if (sortedValues.size() >= SIZE_WORTH_CHECKING_MIN) { final double minValueInColumn = dictionary.get(0) == null ? dictionary.get(1) : dictionary.get(0); final int position = Collections.binarySearch( sortedValues, @@ -335,7 +335,7 @@ public class ScalarDoubleColumnAndIndexSupplier implements Supplier ValueSetIndexes.SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) { + if (tailSet.size() > SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) { return ValueSetIndexes.buildBitmapColumnIndexFromSortedIteratorScan( bitmapFactory, ColumnType.DOUBLE.getNullableStrategy(), diff --git a/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java b/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java index 1b1b9fb97e7..b76f5d99be4 100644 --- a/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java +++ b/processing/src/main/java/org/apache/druid/segment/nested/ScalarLongColumnAndIndexSupplier.java @@ -321,7 +321,7 @@ public class ScalarLongColumnAndIndexSupplier implements Supplier tailSet; final List baseSet = (List) sortedValues; - if (sortedValues.size() >= ValueSetIndexes.SIZE_WORTH_CHECKING_MIN) { + if (sortedValues.size() >= SIZE_WORTH_CHECKING_MIN) { final long minValueInColumn = dictionary.get(0) == null ? dictionary.get(1) : dictionary.get(0); final int position = Collections.binarySearch( sortedValues, @@ -332,7 +332,7 @@ public class ScalarLongColumnAndIndexSupplier implements Supplier ValueSetIndexes.SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) { + if (tailSet.size() > SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) { return ValueSetIndexes.buildBitmapColumnIndexFromSortedIteratorScan( bitmapFactory, ColumnType.LONG.getNullableStrategy(), diff --git a/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java b/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java index 02e7f5b4d39..536b562ebda 100644 --- a/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java +++ b/processing/src/main/java/org/apache/druid/segment/serde/DictionaryEncodedColumnPartSerde.java @@ -91,7 +91,7 @@ public class DictionaryEncodedColumnPartSerde implements ColumnPartSerde public static VERSION fromByte(byte b) { - final VERSION[] values = VERSION.values(); + final VERSION[] values = values(); Preconditions.checkArgument(b < values.length, "Unsupported dictionary column version[%s]", b); return values[b]; } diff --git a/processing/src/main/java/org/apache/druid/segment/virtual/ExpressionMultiValueDimensionSelector.java b/processing/src/main/java/org/apache/druid/segment/virtual/ExpressionMultiValueDimensionSelector.java index dd70b3566e1..a9773551d2b 100644 --- a/processing/src/main/java/org/apache/druid/segment/virtual/ExpressionMultiValueDimensionSelector.java +++ b/processing/src/main/java/org/apache/druid/segment/virtual/ExpressionMultiValueDimensionSelector.java @@ -252,7 +252,7 @@ public class ExpressionMultiValueDimensionSelector implements DimensionSelector @Override String getArrayValue(ExprEval evaluated, int i) { - return extractionFn.apply(ExpressionMultiValueDimensionSelector.getArrayElement(evaluated, i)); + return extractionFn.apply(getArrayElement(evaluated, i)); } @Override diff --git a/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionSelector.java b/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionSelector.java index b8a4e2d82f9..88dc833a250 100644 --- a/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionSelector.java +++ b/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionSelector.java @@ -26,7 +26,6 @@ import org.apache.druid.math.expr.ExpressionType; import org.apache.druid.query.filter.DruidPredicateFactory; import org.apache.druid.query.filter.ValueMatcher; import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector; -import org.apache.druid.segment.DimensionDictionarySelector; import org.apache.druid.segment.DimensionSelector; import org.apache.druid.segment.DimensionSelectorUtils; import org.apache.druid.segment.IdLookup; @@ -57,7 +56,7 @@ public class SingleStringInputDeferredEvaluationExpressionDimensionSelector impl ) { // Verify selector has a working dictionary. - if (selector.getValueCardinality() == DimensionDictionarySelector.CARDINALITY_UNKNOWN + if (selector.getValueCardinality() == CARDINALITY_UNKNOWN || !selector.nameLookupPossibleInAdvance()) { throw new ISE("Selector of class[%s] does not have a dictionary, cannot use it.", selector.getClass().getName()); } diff --git a/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java b/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java index 5a1dd495506..47586c753b5 100644 --- a/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java +++ b/processing/src/main/java/org/apache/druid/segment/virtual/SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector.java @@ -24,7 +24,6 @@ import org.apache.druid.math.expr.Evals; import org.apache.druid.math.expr.Expr; import org.apache.druid.math.expr.ExpressionType; import org.apache.druid.math.expr.vector.ExprVectorProcessor; -import org.apache.druid.segment.DimensionDictionarySelector; import org.apache.druid.segment.IdLookup; import org.apache.druid.segment.vector.SingleValueDimensionVectorSelector; @@ -53,7 +52,7 @@ public class SingleStringInputDeferredEvaluationExpressionDimensionVectorSelecto ) { // Verify selector has a working dictionary. - if (selector.getValueCardinality() == DimensionDictionarySelector.CARDINALITY_UNKNOWN + if (selector.getValueCardinality() == CARDINALITY_UNKNOWN || !selector.nameLookupPossibleInAdvance()) { throw new ISE( "Selector of class[%s] does not have a dictionary, cannot use it.", diff --git a/quidem-ut/src/main/java/org/apache/druid/quidem/ExposedAsBrokerQueryComponentSupplierWrapper.java b/quidem-ut/src/main/java/org/apache/druid/quidem/ExposedAsBrokerQueryComponentSupplierWrapper.java index d1fa6a349ba..b564fbdc50b 100644 --- a/quidem-ut/src/main/java/org/apache/druid/quidem/ExposedAsBrokerQueryComponentSupplierWrapper.java +++ b/quidem-ut/src/main/java/org/apache/druid/quidem/ExposedAsBrokerQueryComponentSupplierWrapper.java @@ -123,7 +123,7 @@ public class ExposedAsBrokerQueryComponentSupplierWrapper extends QueryComponent installForServerModules(builder); builder.add(new QueryRunnerFactoryModule()); - overrideModules.addAll(ExposedAsBrokerQueryComponentSupplierWrapper.brokerModules()); + overrideModules.addAll(brokerModules()); overrideModules.add(new BrokerTestModule()); builder.add(QuidemCaptureModule.class); } diff --git a/quidem-ut/src/main/java/org/apache/druid/quidem/QuidemRecorder.java b/quidem-ut/src/main/java/org/apache/druid/quidem/QuidemRecorder.java index d95de9f3f76..dc34b25697c 100644 --- a/quidem-ut/src/main/java/org/apache/druid/quidem/QuidemRecorder.java +++ b/quidem-ut/src/main/java/org/apache/druid/quidem/QuidemRecorder.java @@ -53,7 +53,7 @@ public class QuidemRecorder implements AutoCloseable, DruidHook printStream.println("#started " + new Date()); printStream.println("!use " + quidemURI); printStream.println("!set outputformat mysql"); - hookDispatcher.register(DruidHook.SQL, this); + hookDispatcher.register(SQL, this); } @Override @@ -63,13 +63,13 @@ public class QuidemRecorder implements AutoCloseable, DruidHook printStream.close(); printStream = null; } - hookDispatcher.unregister(DruidHook.SQL, this); + hookDispatcher.unregister(SQL, this); } @Override public synchronized void invoke(HookKey key, String query) { - if (DruidHook.SQL.equals(key)) { + if (SQL.equals(key)) { if (queries.contains(query)) { // ignore duplicate queries return; diff --git a/server/src/main/java/org/apache/druid/catalog/model/CatalogUtils.java b/server/src/main/java/org/apache/druid/catalog/model/CatalogUtils.java index d0ac6c31e76..88cfcc1a587 100644 --- a/server/src/main/java/org/apache/druid/catalog/model/CatalogUtils.java +++ b/server/src/main/java/org/apache/druid/catalog/model/CatalogUtils.java @@ -203,7 +203,7 @@ public class CatalogUtils */ public static String getNonBlankString(Map args, String parameter) { - String value = CatalogUtils.getString(args, parameter); + String value = getString(args, parameter); if (value != null) { value = value.trim(); if (value.isEmpty()) { @@ -215,7 +215,7 @@ public class CatalogUtils public static List getUriListArg(Map args, String parameter) { - String urisString = CatalogUtils.getString(args, parameter); + String urisString = getString(args, parameter); if (Strings.isNullOrEmpty(urisString)) { throw new IAE("One or more values are required for parameter %s", parameter); } diff --git a/server/src/main/java/org/apache/druid/catalog/model/table/DatasourceDefn.java b/server/src/main/java/org/apache/druid/catalog/model/table/DatasourceDefn.java index cca497f0b7f..9516d1c917f 100644 --- a/server/src/main/java/org/apache/druid/catalog/model/table/DatasourceDefn.java +++ b/server/src/main/java/org/apache/druid/catalog/model/table/DatasourceDefn.java @@ -158,7 +158,7 @@ public class DatasourceDefn extends TableDefn public static boolean isDatasource(String tableType) { - return DatasourceDefn.TABLE_TYPE.equals(tableType); + return TABLE_TYPE.equals(tableType); } public static boolean isDatasource(ResolvedTable table) diff --git a/server/src/main/java/org/apache/druid/discovery/DruidNodeDiscoveryProvider.java b/server/src/main/java/org/apache/druid/discovery/DruidNodeDiscoveryProvider.java index 44ce7ff9824..42abbb23f2a 100644 --- a/server/src/main/java/org/apache/druid/discovery/DruidNodeDiscoveryProvider.java +++ b/server/src/main/java/org/apache/druid/discovery/DruidNodeDiscoveryProvider.java @@ -67,7 +67,7 @@ public abstract class DruidNodeDiscoveryProvider serviceName, service -> { - Set nodeRolesToWatch = DruidNodeDiscoveryProvider.SERVICE_TO_NODE_TYPES.get(service); + Set nodeRolesToWatch = SERVICE_TO_NODE_TYPES.get(service); if (nodeRolesToWatch == null) { throw new IAE("Unknown service [%s].", service); } diff --git a/server/src/main/java/org/apache/druid/guice/DruidBinders.java b/server/src/main/java/org/apache/druid/guice/DruidBinders.java index 63f2061ce13..87886b411d4 100644 --- a/server/src/main/java/org/apache/druid/guice/DruidBinders.java +++ b/server/src/main/java/org/apache/druid/guice/DruidBinders.java @@ -75,7 +75,7 @@ public class DruidBinders public QueryLogicBinder(Binder binder) { this.binder = binder; - queryLogicMapBinder = DruidBinders.queryLogicBinderType(binder); + queryLogicMapBinder = queryLogicBinderType(binder); } QueryLogicBinder bindQueryLogic( diff --git a/server/src/main/java/org/apache/druid/metadata/SortOrder.java b/server/src/main/java/org/apache/druid/metadata/SortOrder.java index afabd0cde59..d7e0de4677d 100644 --- a/server/src/main/java/org/apache/druid/metadata/SortOrder.java +++ b/server/src/main/java/org/apache/druid/metadata/SortOrder.java @@ -53,14 +53,14 @@ public enum SortOrder @JsonCreator public static SortOrder fromValue(String value) { - for (SortOrder b : SortOrder.values()) { + for (SortOrder b : values()) { if (String.valueOf(b.value).equalsIgnoreCase(String.valueOf(value))) { return b; } } throw InvalidInput.exception(StringUtils.format( "Unexpected value[%s] for SortOrder. Possible values are: %s", - value, Arrays.stream(SortOrder.values()).map(SortOrder::toString).collect(Collectors.toList()) + value, Arrays.stream(values()).map(SortOrder::toString).collect(Collectors.toList()) )); } } diff --git a/server/src/main/java/org/apache/druid/rpc/guice/ServiceClientModule.java b/server/src/main/java/org/apache/druid/rpc/guice/ServiceClientModule.java index a0d9a5e3725..52b2e837915 100644 --- a/server/src/main/java/org/apache/druid/rpc/guice/ServiceClientModule.java +++ b/server/src/main/java/org/apache/druid/rpc/guice/ServiceClientModule.java @@ -139,7 +139,7 @@ public class ServiceClientModule implements DruidModule clientFactory.makeClient( NodeRole.BROKER.getJsonName(), serviceLocator, - StandardRetryPolicy.builder().maxAttempts(ServiceClientModule.CLIENT_MAX_ATTEMPTS).build() + StandardRetryPolicy.builder().maxAttempts(CLIENT_MAX_ATTEMPTS).build() ), jsonMapper ); diff --git a/server/src/main/java/org/apache/druid/server/compaction/CompactionStatus.java b/server/src/main/java/org/apache/druid/server/compaction/CompactionStatus.java index fd53ed38c25..a2e6385b46f 100644 --- a/server/src/main/java/org/apache/druid/server/compaction/CompactionStatus.java +++ b/server/src/main/java/org/apache/druid/server/compaction/CompactionStatus.java @@ -140,7 +140,7 @@ public class CompactionStatus Function stringFunction ) { - return CompactionStatus.incomplete( + return incomplete( "'%s' mismatch: required[%s], current[%s]", field, target == null ? null : stringFunction.apply(target), @@ -298,7 +298,7 @@ public class CompactionStatus private CompactionStatus segmentsHaveBeenCompactedAtLeastOnce() { if (lastCompactionState == null) { - return CompactionStatus.incomplete("not compacted yet"); + return incomplete("not compacted yet"); } else { return COMPLETE; } @@ -312,7 +312,7 @@ public class CompactionStatus if (allHaveSameCompactionState) { return COMPLETE; } else { - return CompactionStatus.incomplete("segments have different last compaction states"); + return incomplete("segments have different last compaction states"); } } @@ -322,7 +322,7 @@ public class CompactionStatus if (existingPartionsSpec instanceof DimensionRangePartitionsSpec) { existingPartionsSpec = getEffectiveRangePartitionsSpec((DimensionRangePartitionsSpec) existingPartionsSpec); } - return CompactionStatus.completeIfEqual( + return completeIfEqual( "partitionsSpec", findPartitionsSpecFromConfig(tuningConfig), existingPartionsSpec, @@ -332,7 +332,7 @@ public class CompactionStatus private CompactionStatus indexSpecIsUpToDate() { - return CompactionStatus.completeIfEqual( + return completeIfEqual( "indexSpec", Configs.valueOrDefault(tuningConfig.getIndexSpec(), IndexSpec.DEFAULT), objectMapper.convertValue(lastCompactionState.getIndexSpec(), IndexSpec.class), @@ -360,13 +360,13 @@ public class CompactionStatus segment -> !configuredSegmentGranularity.isAligned(segment.getInterval()) ); if (needsCompaction) { - return CompactionStatus.incomplete( + return incomplete( "segmentGranularity: segments do not align with target[%s]", asString(configuredSegmentGranularity) ); } } else { - return CompactionStatus.configChanged( + return configChanged( "segmentGranularity", configuredSegmentGranularity, existingSegmentGranularity, @@ -382,7 +382,7 @@ public class CompactionStatus if (configuredGranularitySpec == null) { return COMPLETE; } else { - return CompactionStatus.completeIfEqual( + return completeIfEqual( "rollup", configuredGranularitySpec.isRollup(), existingGranularitySpec == null ? null : existingGranularitySpec.isRollup(), @@ -396,7 +396,7 @@ public class CompactionStatus if (configuredGranularitySpec == null) { return COMPLETE; } else { - return CompactionStatus.completeIfEqual( + return completeIfEqual( "queryGranularity", configuredGranularitySpec.getQueryGranularity(), existingGranularitySpec == null ? null : existingGranularitySpec.getQueryGranularity(), @@ -426,7 +426,7 @@ public class CompactionStatus compactionConfig.getTuningConfig() == null ? null : compactionConfig.getTuningConfig().getPartitionsSpec() ); { - return CompactionStatus.completeIfEqual( + return completeIfEqual( "dimensionsSpec", configuredDimensions, existingDimensions, @@ -449,7 +449,7 @@ public class CompactionStatus ? null : objectMapper.convertValue(metricSpecList, AggregatorFactory[].class); if (existingMetricsSpec == null || !Arrays.deepEquals(configuredMetricsSpec, existingMetricsSpec)) { - return CompactionStatus.configChanged( + return configChanged( "metricsSpec", configuredMetricsSpec, existingMetricsSpec, @@ -470,7 +470,7 @@ public class CompactionStatus lastCompactionState.getTransformSpec(), ClientCompactionTaskTransformSpec.class ); - return CompactionStatus.completeIfEqual( + return completeIfEqual( "transformSpec filter", compactionConfig.getTransformSpec().getFilter(), existingTransformSpec == null ? null : existingTransformSpec.getFilter(), diff --git a/server/src/main/java/org/apache/druid/server/coordination/BroadcastDatasourceLoadingSpec.java b/server/src/main/java/org/apache/druid/server/coordination/BroadcastDatasourceLoadingSpec.java index 3a11027311e..28d83adab5b 100644 --- a/server/src/main/java/org/apache/druid/server/coordination/BroadcastDatasourceLoadingSpec.java +++ b/server/src/main/java/org/apache/druid/server/coordination/BroadcastDatasourceLoadingSpec.java @@ -134,7 +134,7 @@ public class BroadcastDatasourceLoadingSpec if (broadcastDatasourcesToLoad == null || broadcastDatasourcesToLoad.isEmpty()) { throw InvalidInput.exception("Set of broadcast datasources to load cannot be %s for mode[ONLY_REQUIRED].", broadcastDatasourcesToLoad); } - return BroadcastDatasourceLoadingSpec.loadOnly(new HashSet<>(broadcastDatasourcesToLoad)); + return loadOnly(new HashSet<>(broadcastDatasourcesToLoad)); } else { return defaultSpec; } diff --git a/server/src/main/java/org/apache/druid/server/coordination/ServerType.java b/server/src/main/java/org/apache/druid/server/coordination/ServerType.java index 59d6f6bcc61..829a662d1af 100644 --- a/server/src/main/java/org/apache/druid/server/coordination/ServerType.java +++ b/server/src/main/java/org/apache/druid/server/coordination/ServerType.java @@ -153,11 +153,11 @@ public enum ServerType { // this doesn't actually check that the NodeRole is a typical data node if (nodeRole.equals(NodeRole.HISTORICAL)) { - return ServerType.HISTORICAL; + return HISTORICAL; } else if (nodeRole.equals(NodeRole.BROKER)) { - return ServerType.BROKER; + return BROKER; } else { - return ServerType.INDEXER_EXECUTOR; + return INDEXER_EXECUTOR; } } diff --git a/server/src/main/java/org/apache/druid/server/coordinator/balancer/SegmentToMoveCalculator.java b/server/src/main/java/org/apache/druid/server/coordinator/balancer/SegmentToMoveCalculator.java index 01c7da44c11..a84d63ebe76 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/balancer/SegmentToMoveCalculator.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/balancer/SegmentToMoveCalculator.java @@ -70,10 +70,8 @@ public class SegmentToMoveCalculator ).sum(); // Move at least some segments to ensure that the cluster is always balancing itself - final int minSegmentsToMove = SegmentToMoveCalculator - .computeMinSegmentsToMoveInTier(totalSegments); - final int segmentsToMoveToFixDeviation = SegmentToMoveCalculator - .computeNumSegmentsToMoveToBalanceTier(tier, historicals); + final int minSegmentsToMove = computeMinSegmentsToMoveInTier(totalSegments); + final int segmentsToMoveToFixDeviation = computeNumSegmentsToMoveToBalanceTier(tier, historicals); log.info( "Need to move [%,d] segments in tier[%s] to attain balance. Allowed values are [min=%d, max=%d].", segmentsToMoveToFixDeviation, tier, minSegmentsToMove, maxSegmentsToMoveInTier diff --git a/server/src/main/java/org/apache/druid/server/http/HostAndPortWithScheme.java b/server/src/main/java/org/apache/druid/server/http/HostAndPortWithScheme.java index 297e86f3898..6a76ebc89ff 100644 --- a/server/src/main/java/org/apache/druid/server/http/HostAndPortWithScheme.java +++ b/server/src/main/java/org/apache/druid/server/http/HostAndPortWithScheme.java @@ -47,12 +47,12 @@ public class HostAndPortWithScheme if (colonIndex == -1) { throw new IAE("Invalid host with scheme string: [%s]", hostPortMaybeSchemeString); } - return HostAndPortWithScheme.fromString( + return fromString( hostPortMaybeSchemeString.substring(0, colonIndex), hostPortMaybeSchemeString.substring(colonIndex + 1) ); } - return HostAndPortWithScheme.fromString("http", hostPortMaybeSchemeString); + return fromString("http", hostPortMaybeSchemeString); } public static HostAndPortWithScheme fromString(String scheme, String hostPortString) diff --git a/server/src/main/java/org/apache/druid/server/initialization/jetty/StandardResponseHeaderFilterHolder.java b/server/src/main/java/org/apache/druid/server/initialization/jetty/StandardResponseHeaderFilterHolder.java index 2f12ff2402c..b6d79e930f4 100644 --- a/server/src/main/java/org/apache/druid/server/initialization/jetty/StandardResponseHeaderFilterHolder.java +++ b/server/src/main/java/org/apache/druid/server/initialization/jetty/StandardResponseHeaderFilterHolder.java @@ -73,7 +73,7 @@ public class StandardResponseHeaderFilterHolder implements ServletFilterHolder final Response serverResponse ) { - for (final String headerName : StandardResponseHeaderFilterHolder.STANDARD_HEADERS) { + for (final String headerName : STANDARD_HEADERS) { if (serverResponse.getHeaders().containsKey(headerName) && proxyResponse.containsHeader(headerName)) { ((org.eclipse.jetty.server.Response) proxyResponse).getHttpFields().remove(headerName); } diff --git a/server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java b/server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java index 4665bdd18cf..2d798e657ea 100644 --- a/server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java +++ b/server/src/main/java/org/apache/druid/server/lookup/cache/LookupLoadingSpec.java @@ -127,7 +127,7 @@ public class LookupLoadingSpec if (lookupsToLoad == null || lookupsToLoad.isEmpty()) { throw InvalidInput.exception("Set of lookups to load cannot be %s for mode[ONLY_REQUIRED].", lookupsToLoad); } - return LookupLoadingSpec.loadOnly(new HashSet<>(lookupsToLoad)); + return loadOnly(new HashSet<>(lookupsToLoad)); } else { return defaultSpec; } diff --git a/server/src/main/java/org/apache/druid/server/metrics/MonitorsConfig.java b/server/src/main/java/org/apache/druid/server/metrics/MonitorsConfig.java index 25e124c1983..fd06b3adb83 100644 --- a/server/src/main/java/org/apache/druid/server/metrics/MonitorsConfig.java +++ b/server/src/main/java/org/apache/druid/server/metrics/MonitorsConfig.java @@ -95,8 +95,8 @@ public class MonitorsConfig { Map dimensionsMap = new HashMap<>(); for (String property : props.stringPropertyNames()) { - if (property.startsWith(MonitorsConfig.METRIC_DIMENSION_PREFIX)) { - String dimension = property.substring(MonitorsConfig.METRIC_DIMENSION_PREFIX.length()); + if (property.startsWith(METRIC_DIMENSION_PREFIX)) { + String dimension = property.substring(METRIC_DIMENSION_PREFIX.length()); if (dimensions.contains(dimension)) { dimensionsMap.put( dimension, diff --git a/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java b/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java index 431819da8a4..af0ba920a85 100644 --- a/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java +++ b/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java @@ -404,7 +404,7 @@ public class AuthorizationUtils throw new ISE("Request already had authorization check."); } - final AuthenticationResult authenticationResult = AuthorizationUtils.authenticationResultFromRequest(request); + final AuthenticationResult authenticationResult = authenticationResultFromRequest(request); Map> filteredResources = new HashMap<>(); for (Map.Entry> entry : unfilteredResources.entrySet()) { @@ -413,7 +413,7 @@ public class AuthorizationUtils } final List filteredList = Lists.newArrayList( - AuthorizationUtils.filterAuthorizedResources( + filterAuthorizedResources( authenticationResult, entry.getValue(), resourceActionGenerator, diff --git a/sql/src/main/java/org/apache/calcite/plan/volcano/DruidVolcanoCost.java b/sql/src/main/java/org/apache/calcite/plan/volcano/DruidVolcanoCost.java index c26fe21c692..af57df6f562 100644 --- a/sql/src/main/java/org/apache/calcite/plan/volcano/DruidVolcanoCost.java +++ b/sql/src/main/java/org/apache/calcite/plan/volcano/DruidVolcanoCost.java @@ -264,25 +264,25 @@ public class DruidVolcanoCost implements RelOptCost @Override public RelOptCost makeHugeCost() { - return DruidVolcanoCost.HUGE; + return HUGE; } @Override public RelOptCost makeInfiniteCost() { - return DruidVolcanoCost.INFINITY; + return INFINITY; } @Override public RelOptCost makeTinyCost() { - return DruidVolcanoCost.TINY; + return TINY; } @Override public RelOptCost makeZeroCost() { - return DruidVolcanoCost.ZERO; + return ZERO; } } } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MaxSqlAggregator.java b/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MaxSqlAggregator.java index 4f29b276a54..eb8fbd50200 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MaxSqlAggregator.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MaxSqlAggregator.java @@ -71,7 +71,7 @@ public class MaxSqlAggregator extends SimpleSqlAggregator default: // This error refers to the Druid type. But, we're in SQL validation. // It should refer to the SQL type. - throw SimpleSqlAggregator.badTypeException(fieldName, "MAX", aggregationType); + throw badTypeException(fieldName, "MAX", aggregationType); } } } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MinSqlAggregator.java b/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MinSqlAggregator.java index 93b87d376b5..4d83c64da52 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MinSqlAggregator.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/MinSqlAggregator.java @@ -66,7 +66,7 @@ public class MinSqlAggregator extends SimpleSqlAggregator case DOUBLE: return new DoubleMinAggregatorFactory(name, fieldName, null, macroTable); default: - throw SimpleSqlAggregator.badTypeException(fieldName, "MIN", aggregationType); + throw badTypeException(fieldName, "MIN", aggregationType); } } } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/SumSqlAggregator.java b/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/SumSqlAggregator.java index 29790ab7154..e7244f46386 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/SumSqlAggregator.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/builtin/SumSqlAggregator.java @@ -80,7 +80,7 @@ public class SumSqlAggregator extends SimpleSqlAggregator case DOUBLE: return new DoubleSumAggregatorFactory(name, fieldName, null, macroTable); default: - throw SimpleSqlAggregator.badTypeException(fieldName, "SUM", aggregationType); + throw badTypeException(fieldName, "SUM", aggregationType); } } } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/expression/DefaultOperandTypeChecker.java b/sql/src/main/java/org/apache/druid/sql/calcite/expression/DefaultOperandTypeChecker.java index a52ce5707c1..99a446c270c 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/expression/DefaultOperandTypeChecker.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/expression/DefaultOperandTypeChecker.java @@ -243,7 +243,7 @@ public class DefaultOperandTypeChecker implements SqlOperandTypeChecker operandNames, operandTypes, computedRequiredOperandCount, - DefaultOperandTypeChecker.buildNullableOperands(computedRequiredOperandCount, operandTypes.size(), notNullOperands), + buildNullableOperands(computedRequiredOperandCount, operandTypes.size(), notNullOperands), literalOperands ); } diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/filtration/ConvertSelectorsToIns.java b/sql/src/main/java/org/apache/druid/sql/calcite/filtration/ConvertSelectorsToIns.java index 413d75fbc6d..5d58988dda5 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/filtration/ConvertSelectorsToIns.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/filtration/ConvertSelectorsToIns.java @@ -149,7 +149,7 @@ public class ConvertSelectorsToIns extends BottomUpTransform @Override protected Pair> getCollectibleComparison(DimFilter filter) { - return ConvertSelectorsToIns.splitAnd( + return splitAnd( filter, SelectorDimFilter.class, @@ -217,7 +217,7 @@ public class ConvertSelectorsToIns extends BottomUpTransform @Override protected Pair> getCollectibleComparison(DimFilter filter) { - return ConvertSelectorsToIns.splitAnd( + return splitAnd( filter, EqualityFilter.class, @@ -275,7 +275,7 @@ public class ConvertSelectorsToIns extends BottomUpTransform @Override protected Pair> getCollectibleComparison(DimFilter filter) { - return ConvertSelectorsToIns.splitAnd( + return splitAnd( filter, EqualityFilter.class, diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java index 917f0cc204a..1b20dab7d79 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java @@ -277,7 +277,7 @@ public class CalciteRulesManager private Program buildDecoupledLogicalOptimizationProgram(PlannerContext plannerContext) { final HepProgramBuilder builder = HepProgram.builder(); - builder.addMatchLimit(CalciteRulesManager.HEP_DEFAULT_MATCH_LIMIT); + builder.addMatchLimit(HEP_DEFAULT_MATCH_LIMIT); builder.addRuleCollection(baseRuleSet(plannerContext)); builder.addRuleInstance(CoreRules.UNION_MERGE); builder.addRuleInstance(JoinExtractFilterRule.Config.DEFAULT.toRule()); @@ -330,7 +330,7 @@ public class CalciteRulesManager private Program buildPreVolcanoManipulationProgram(final PlannerContext plannerContext) { final HepProgramBuilder builder = HepProgram.builder(); - builder.addMatchLimit(CalciteRulesManager.HEP_DEFAULT_MATCH_LIMIT); + builder.addMatchLimit(HEP_DEFAULT_MATCH_LIMIT); // Apply FILTER_INTO_JOIN early, if using a join algorithm that requires subqueries anyway. if (plannerContext.getJoinAlgorithm().requiresSubquery()) { @@ -350,7 +350,7 @@ public class CalciteRulesManager private Program buildReductionProgram(final PlannerContext plannerContext, final boolean isDruid) { final HepProgramBuilder builder = HepProgram.builder(); - builder.addMatchLimit(CalciteRulesManager.HEP_DEFAULT_MATCH_LIMIT); + builder.addMatchLimit(HEP_DEFAULT_MATCH_LIMIT); if (isDruid) { // COALESCE rules must run before REDUCTION_RULES, since otherwise ReduceExpressionsRule#pushPredicateIntoCase may diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java index 6310b23543d..32e74887bf2 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java @@ -299,7 +299,7 @@ public class Calcites case VARCHAR: dataType = typeFactory.createTypeWithCharsetAndCollation( typeFactory.createSqlType(typeName), - Calcites.defaultCharset(), + defaultCharset(), SqlCollation.IMPLICIT ); break; @@ -566,7 +566,7 @@ public class Calcites if (SqlTypeUtil.isArray(type)) { return type; } - return Calcites.createSqlArrayTypeWithNullability( + return createSqlArrayTypeWithNullability( opBinding.getTypeFactory(), type.getSqlTypeName(), true @@ -583,7 +583,7 @@ public class Calcites if (SqlTypeUtil.isArray(type)) { return type; } - return Calcites.createSqlArrayTypeWithNullability( + return createSqlArrayTypeWithNullability( opBinding.getTypeFactory(), type.getSqlTypeName(), true diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidOperatorTable.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidOperatorTable.java index 0fb1c9fb9ff..6d1cd1243e2 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidOperatorTable.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidOperatorTable.java @@ -558,7 +558,7 @@ public class DruidOperatorTable implements SqlOperatorTable private static SqlSyntax normalizeSyntax(final SqlSyntax syntax) { - if (!DruidOperatorTable.isFunctionSyntax(syntax)) { + if (!isFunctionSyntax(syntax)) { return syntax; } else { return SqlSyntax.FUNCTION; diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidTypeSystem.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidTypeSystem.java index 521291c3244..1041269090d 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidTypeSystem.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidTypeSystem.java @@ -28,7 +28,7 @@ import org.apache.calcite.sql.type.SqlTypeName; public class DruidTypeSystem implements RelDataTypeSystem { public static final DruidTypeSystem INSTANCE = new DruidTypeSystem(); - public static final RelDataTypeFactory TYPE_FACTORY = new SqlTypeFactoryImpl(DruidTypeSystem.INSTANCE); + public static final RelDataTypeFactory TYPE_FACTORY = new SqlTypeFactoryImpl(INSTANCE); /** * Druid uses millisecond precision for timestamps internally. This is also the default at the SQL layer. @@ -43,7 +43,7 @@ public class DruidTypeSystem implements RelDataTypeSystem @Override public int getMaxScale(final SqlTypeName typeName) { - return RelDataTypeSystem.DEFAULT.getMaxScale(typeName); + return DEFAULT.getMaxScale(typeName); } @Override @@ -54,7 +54,7 @@ public class DruidTypeSystem implements RelDataTypeSystem case TIMESTAMP_WITH_LOCAL_TIME_ZONE: return DEFAULT_TIMESTAMP_PRECISION; default: - return RelDataTypeSystem.DEFAULT.getDefaultPrecision(typeName); + return DEFAULT.getDefaultPrecision(typeName); } } @@ -64,44 +64,44 @@ public class DruidTypeSystem implements RelDataTypeSystem if (typeName == SqlTypeName.TIME || typeName == SqlTypeName.TIMESTAMP) { return DEFAULT_TIMESTAMP_PRECISION; } else { - return RelDataTypeSystem.DEFAULT.getMaxPrecision(typeName); + return DEFAULT.getMaxPrecision(typeName); } } @Override public int getMaxNumericScale() { - return RelDataTypeSystem.DEFAULT.getMaxNumericScale(); + return DEFAULT.getMaxNumericScale(); } @Override public int getMaxNumericPrecision() { - return RelDataTypeSystem.DEFAULT.getMaxNumericPrecision(); + return DEFAULT.getMaxNumericPrecision(); } @Override public String getLiteral(final SqlTypeName typeName, final boolean isPrefix) { - return RelDataTypeSystem.DEFAULT.getLiteral(typeName, isPrefix); + return DEFAULT.getLiteral(typeName, isPrefix); } @Override public boolean isCaseSensitive(final SqlTypeName typeName) { - return RelDataTypeSystem.DEFAULT.isCaseSensitive(typeName); + return DEFAULT.isCaseSensitive(typeName); } @Override public boolean isAutoincrement(final SqlTypeName typeName) { - return RelDataTypeSystem.DEFAULT.isAutoincrement(typeName); + return DEFAULT.isAutoincrement(typeName); } @Override public int getNumTypeRadix(final SqlTypeName typeName) { - return RelDataTypeSystem.DEFAULT.getNumTypeRadix(typeName); + return DEFAULT.getNumTypeRadix(typeName); } @Override @@ -132,25 +132,25 @@ public class DruidTypeSystem implements RelDataTypeSystem final RelDataType arg1Type ) { - return RelDataTypeSystem.DEFAULT.deriveCovarType(typeFactory, arg0Type, arg1Type); + return DEFAULT.deriveCovarType(typeFactory, arg0Type, arg1Type); } @Override public RelDataType deriveFractionalRankType(final RelDataTypeFactory typeFactory) { - return RelDataTypeSystem.DEFAULT.deriveFractionalRankType(typeFactory); + return DEFAULT.deriveFractionalRankType(typeFactory); } @Override public RelDataType deriveRankType(final RelDataTypeFactory typeFactory) { - return RelDataTypeSystem.DEFAULT.deriveRankType(typeFactory); + return DEFAULT.deriveRankType(typeFactory); } @Override public boolean isSchemaCaseSensitive() { - return RelDataTypeSystem.DEFAULT.isSchemaCaseSensitive(); + return DEFAULT.isSchemaCaseSensitive(); } @Override diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java index 589d68d4305..dbc2be0b091 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java @@ -430,7 +430,7 @@ public class PlannerConfig ); } - PlannerConfig newConfig = PlannerConfig.builder().withOverrides(overrides).build(); + PlannerConfig newConfig = builder().withOverrides(overrides).build(); if (!equals(newConfig)) { throw DruidException.defensive( "Not all PlannerConfig options are not persistable as QueryContext keys!\nold: %s\nnew: %s", diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/rel/Grouping.java b/sql/src/main/java/org/apache/druid/sql/calcite/rel/Grouping.java index 8bcf1544fc8..dbdc79883da 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/rel/Grouping.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/rel/Grouping.java @@ -265,7 +265,7 @@ public class Grouping newSubtotals = subtotals; } - return Grouping.create( + return create( newDimensions, newSubtotals, newAggregations, diff --git a/sql/src/main/java/org/apache/druid/sql/http/ObjectWriter.java b/sql/src/main/java/org/apache/druid/sql/http/ObjectWriter.java index 27a027d0abd..d4dbd674d86 100644 --- a/sql/src/main/java/org/apache/druid/sql/http/ObjectWriter.java +++ b/sql/src/main/java/org/apache/druid/sql/http/ObjectWriter.java @@ -126,14 +126,14 @@ public class ObjectWriter implements ResultFormat.Writer if (includeTypes) { jsonGenerator.writeStringField( - ObjectWriter.TYPE_HEADER_NAME, + TYPE_HEADER_NAME, signature.getColumnType(i).map(TypeSignature::asTypeString).orElse(null) ); } if (includeSqlTypes) { jsonGenerator.writeStringField( - ObjectWriter.SQL_TYPE_HEADER_NAME, + SQL_TYPE_HEADER_NAME, rowType.getFieldList().get(i).getType().getSqlTypeName().getName() ); } @@ -162,7 +162,7 @@ public class ObjectWriter implements ResultFormat.Writer jsonGenerator.writeStartObject(); jsonGenerator.writeStringField( - ObjectWriter.TYPE_HEADER_NAME, + TYPE_HEADER_NAME, signature.getColumnType(i).map(TypeSignature::asTypeString).orElse(null) ); diff --git a/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java b/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java index d957e7155b5..9af6e15e035 100644 --- a/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java +++ b/sql/src/main/java/org/apache/druid/sql/http/SqlResource.java @@ -211,7 +211,7 @@ public class SqlResource jsonMapper, responseContextConfig, selfNode, - SqlResource.QUERY_METRIC_COUNTER, + QUERY_METRIC_COUNTER, sqlQueryId, MediaType.APPLICATION_JSON_TYPE, headers