diff --git a/codestyle/pmd-ruleset.xml b/codestyle/pmd-ruleset.xml
index f10d4f3da197..7d7285d0a516 100644
--- a/codestyle/pmd-ruleset.xml
+++ b/codestyle/pmd-ruleset.xml
@@ -29,5 +29,4 @@ 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 60037389276a..fa1b656f0aa9 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 @@ private static void deleteBucketKeys(
throws Exception
{
DeleteObjectsRequest deleteRequest = new DeleteObjectsRequest(bucket).withKeys(keysToDelete);
- retry(() -> {
+ OssUtils.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 b02765f92ccd..a214bfd057a8 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 static CompressedBigDecimal objToCompressedBigDecimalWithScale(
boolean strictNumberParse
)
{
- CompressedBigDecimal compressedBigDecimal = objToCompressedBigDecimal(obj, strictNumberParse);
+ CompressedBigDecimal compressedBigDecimal = Utils.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 db155269d4fd..6efcd34872b8 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(values())
+ private static final Map PHASE_MAP = Arrays.stream(PeonPhase.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 6b8640144854..a2667026fffd 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,7 +173,9 @@ public Duration getShutdownTimeout()
public Duration getRepartitionTransitionDuration()
{
// just return a default for now.
- return SeekableStreamSupervisorTuningConfig.defaultDuration(null, DEFAULT_REPARTITION_TRANSITION_DURATION);
+ return SeekableStreamSupervisorTuningConfig.defaultDuration(
+ null,
+ SeekableStreamSupervisorTuningConfig.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 a79c4a5c4ab4..df0b884eaaec 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 static HllSketchHolder fromObj(Object obj)
if (obj instanceof HllSketchHolder) {
return (HllSketchHolder) obj;
} else if (obj instanceof HllSketch) {
- return of((HllSketch) obj);
+ return HllSketchHolder.of((HllSketch) obj);
} else if (obj instanceof Union) {
- return of((Union) obj);
+ return HllSketchHolder.of((Union) obj);
} else if (obj instanceof byte[]) {
- return of(HllSketch.heapify((byte[]) obj));
+ return HllSketchHolder.of(HllSketch.heapify((byte[]) obj));
} else if (obj instanceof Memory) {
- return of(HllSketch.wrap((Memory) obj));
+ return HllSketchHolder.of(HllSketch.wrap((Memory) obj));
} else if (obj instanceof String) {
- return of(HllSketch.heapify(StringUtils.decodeBase64(StringUtils.toUtf8((String) obj))));
+ return HllSketchHolder.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 ab8abaf34213..c9229042763a 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 @@
*/
public class SketchHolder
{
- public static final SketchHolder EMPTY = of(
+ public static final SketchHolder EMPTY = SketchHolder.of(
Sketches.updateSketchBuilder()
.build()
.compact(true, null)
@@ -195,7 +195,7 @@ public static SketchHolder combine(Object o1, Object o2, int nomEntries)
Union union = (Union) SetOperation.builder().setNominalEntries(nomEntries).build(Family.UNION);
holder1.updateUnion(union);
holder2.updateUnion(union);
- return of(union);
+ return SketchHolder.of(union);
}
}
@@ -208,15 +208,15 @@ void invalidateCache()
public static SketchHolder deserialize(Object serializedSketch)
{
if (serializedSketch instanceof String) {
- return of(deserializeFromBase64EncodedString((String) serializedSketch));
+ return SketchHolder.of(deserializeFromBase64EncodedString((String) serializedSketch));
} else if (serializedSketch instanceof byte[]) {
- return of(deserializeFromByteArray((byte[]) serializedSketch));
+ return SketchHolder.of(deserializeFromByteArray((byte[]) serializedSketch));
} else if (serializedSketch instanceof SketchHolder) {
return (SketchHolder) serializedSketch;
} else if (serializedSketch instanceof Sketch
|| serializedSketch instanceof Union
|| serializedSketch instanceof Memory) {
- return of(serializedSketch);
+ return SketchHolder.of(serializedSketch);
}
throw new ISE(
@@ -228,9 +228,9 @@ public static SketchHolder deserialize(Object serializedSketch)
public static SketchHolder deserializeSafe(Object serializedSketch)
{
if (serializedSketch instanceof String) {
- return of(deserializeFromBase64EncodedStringSafe((String) serializedSketch));
+ return SketchHolder.of(deserializeFromBase64EncodedStringSafe((String) serializedSketch));
} else if (serializedSketch instanceof byte[]) {
- return of(deserializeFromByteArraySafe((byte[]) serializedSketch));
+ return SketchHolder.of(deserializeFromByteArraySafe((byte[]) serializedSketch));
}
return deserialize(serializedSketch);
@@ -285,13 +285,13 @@ public static SketchHolder sketchSetOperation(Func func, int sketchSize, Object.
for (Object o : holders) {
((SketchHolder) o).updateUnion(union);
}
- return of(union);
+ return SketchHolder.of(union);
case INTERSECT:
Intersection intersection = (Intersection) SetOperation.builder().setNominalEntries(sketchSize).build(Family.INTERSECTION);
for (Object o : holders) {
intersection.intersect(((SketchHolder) o).getSketch());
}
- return of(intersection.getResult(false, null));
+ return SketchHolder.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 static SketchHolder sketchSetOperation(Func func, int sketchSize, Object.
AnotB anotb = (AnotB) SetOperation.builder().setNominalEntries(sketchSize).build(Family.A_NOT_B);
result = anotb.aNotB(result, ((SketchHolder) holders[i]).getSketch());
}
- return of(result);
+ return SketchHolder.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 03aec3954e5a..44948df4a6ad 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
@@ -160,7 +160,7 @@ public static Map deserializeAuthorizerUserMap(
userMap = new HashMap<>();
} else {
try {
- userMap = objectMapper.readValue(userMapBytes, AUTHORIZER_USER_MAP_TYPE_REFERENCE);
+ userMap = objectMapper.readValue(userMapBytes, BasicAuthUtils.AUTHORIZER_USER_MAP_TYPE_REFERENCE);
}
catch (IOException ioe) {
throw new RuntimeException("Couldn't deserialize authorizer userMap!", ioe);
@@ -189,7 +189,7 @@ public static Map deserializeAuthorizerGrou
groupMappingMap = new HashMap<>();
} else {
try {
- groupMappingMap = objectMapper.readValue(groupMappingMapBytes, AUTHORIZER_GROUP_MAPPING_MAP_TYPE_REFERENCE);
+ groupMappingMap = objectMapper.readValue(groupMappingMapBytes, BasicAuthUtils.AUTHORIZER_GROUP_MAPPING_MAP_TYPE_REFERENCE);
}
catch (IOException ioe) {
throw new RuntimeException("Couldn't deserialize authorizer groupMappingMap!", ioe);
@@ -218,7 +218,7 @@ public static Map deserializeAuthorizerRoleMap(
roleMap = new HashMap<>();
} else {
try {
- roleMap = objectMapper.readValue(roleMapBytes, AUTHORIZER_ROLE_MAP_TYPE_REFERENCE);
+ roleMap = objectMapper.readValue(roleMapBytes, BasicAuthUtils.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 e7a7d63e1ecb..c09fe35a5a14 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 CatalogException(
public static CatalogException badRequest(String msg, Object...args)
{
return new CatalogException(
- INVALID_ERROR,
+ CatalogException.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 159c247becc3..e2c79785fe4f 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 List extends Module> getJacksonModules()
{
return Collections.singletonList(
new SimpleModule().registerSubtypes(
- new NamedType(HdfsLoadSpec.class, SCHEME),
- new NamedType(HdfsInputSource.class, SCHEME),
- new NamedType(HdfsInputSourceFactory.class, SCHEME)
+ new NamedType(HdfsLoadSpec.class, HdfsStorageDruidModule.SCHEME),
+ new NamedType(HdfsInputSource.class, HdfsStorageDruidModule.SCHEME),
+ new NamedType(HdfsInputSourceFactory.class, HdfsStorageDruidModule.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 4186837bbb00..1e0b35874090 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 Duration getRepartitionTransitionDuration()
// just return a default for now.
return SeekableStreamSupervisorTuningConfig.defaultDuration(
null,
- DEFAULT_REPARTITION_TRANSITION_DURATION
+ SeekableStreamSupervisorTuningConfig.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 023605a28a92..03a1b6914a85 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 boolean hasNext() throws SocketTimeoutException
try {
while (watch.hasNext()) {
Watch.Response item = watch.next();
- if (item != null && item.type != null && !BOOKMARK.equals(item.type)) {
+ if (item != null && item.type != null && !item.type.equals(WatchResult.BOOKMARK)) {
DiscoveryDruidNodeAndResourceVersion result = null;
if (item.object != null) {
result = new DiscoveryDruidNodeAndResourceVersion(
@@ -150,7 +150,7 @@ public boolean hasNext() throws SocketTimeoutException
result
);
return true;
- } else if (item != null && item.type != null && BOOKMARK.equals(item.type)) {
+ } else if (item != null && item.type != null && item.type.equals(WatchResult.BOOKMARK)) {
// 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 184b766128f9..f47fcfc0c9aa 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 static String getLabelSelectorForNodeRole(K8sDiscoveryConfig discoveryCon
"%s=%s,%s=%s",
getClusterIdentifierAnnouncementLabel(),
discoveryConfig.getClusterIdentifier(),
- getRoleAnnouncementLabel(nodeRole),
- ANNOUNCEMENT_DONE
+ K8sDruidNodeAnnouncer.getRoleAnnouncementLabel(nodeRole),
+ K8sDruidNodeAnnouncer.ANNOUNCEMENT_DONE
);
}
@@ -219,9 +219,9 @@ public static String getLabelSelectorForNode(K8sDiscoveryConfig discoveryConfig,
"%s=%s,%s=%s,%s=%s",
getClusterIdentifierAnnouncementLabel(),
discoveryConfig.getClusterIdentifier(),
- getRoleAnnouncementLabel(nodeRole),
- ANNOUNCEMENT_DONE,
- getIdHashAnnouncementLabel(),
+ K8sDruidNodeAnnouncer.getRoleAnnouncementLabel(nodeRole),
+ K8sDruidNodeAnnouncer.ANNOUNCEMENT_DONE,
+ K8sDruidNodeAnnouncer.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 428fed78cf45..3fa5654c2a55 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 @@ private static AppenderatorConfig makeAppenderatorConfig(
@Override
public AppendableIndexSpec getAppendableIndexSpec()
{
- return DEFAULT_APPENDABLE_INDEX;
+ return TuningConfig.DEFAULT_APPENDABLE_INDEX;
}
@Override
@@ -346,7 +346,7 @@ public int getMaxPendingPersists()
@Override
public boolean isSkipBytesInMemoryOverheadCheck()
{
- return DEFAULT_SKIP_BYTES_IN_MEMORY_OVERHEAD_CHECK;
+ return TuningConfig.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 ea6b00a8c867..bc0c64c251a7 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 static ClusterBy clusterByWithSegmentGranularity(
return clusterBy;
} else {
final List newColumns = new ArrayList<>(clusterBy.getColumns().size() + 1);
- newColumns.add(new KeyColumn(SEGMENT_GRANULARITY_COLUMN, KeyOrder.ASCENDING));
+ newColumns.add(new KeyColumn(QueryKitUtils.SEGMENT_GRANULARITY_COLUMN, KeyOrder.ASCENDING));
newColumns.addAll(clusterBy.getColumns());
return new ClusterBy(newColumns, 1);
}
@@ -123,10 +123,10 @@ public static ClusterBy clusterByWithSegmentGranularity(
*/
public static void verifyRowSignature(final RowSignature signature)
{
- 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));
+ 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));
}
}
@@ -144,7 +144,7 @@ public static RowSignature signatureWithSegmentGranularity(
} else {
return RowSignature.builder()
.addAll(signature)
- .add(SEGMENT_GRANULARITY_COLUMN, ColumnType.LONG)
+ .add(QueryKitUtils.SEGMENT_GRANULARITY_COLUMN, ColumnType.LONG)
.build();
}
}
@@ -194,8 +194,8 @@ public static RowSignature sortableSignature(
public static VirtualColumn makeSegmentGranularityVirtualColumn(final ObjectMapper jsonMapper, final QueryContext queryContext)
{
final Granularity segmentGranularity =
- getSegmentGranularityFromContext(jsonMapper, queryContext.asMap());
- final String timeColumnName = queryContext.getString(CTX_TIME_COLUMN_NAME);
+ QueryKitUtils.getSegmentGranularityFromContext(jsonMapper, queryContext.asMap());
+ final String timeColumnName = queryContext.getString(QueryKitUtils.CTX_TIME_COLUMN_NAME);
if (timeColumnName == null || Granularities.ALL.equals(segmentGranularity)) {
return null;
@@ -213,7 +213,7 @@ public static VirtualColumn makeSegmentGranularityVirtualColumn(final ObjectMapp
}
return new ExpressionVirtualColumn(
- SEGMENT_GRANULARITY_COLUMN,
+ QueryKitUtils.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 3685b876c93f..d2f017b04dd6 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 : values()) {
+ for (MSQMode msqMode : MSQMode.values()) {
if (msqMode.value.equalsIgnoreCase(str)) {
return msqMode;
}
@@ -66,12 +66,12 @@ public String toString()
public static void populateDefaultQueryContext(final String modeStr, final Map originalQueryContext)
{
- MSQMode mode = fromString(modeStr);
+ MSQMode mode = MSQMode.fromString(modeStr);
if (mode == null) {
throw new ISE(
"%s is an unknown multi stage query mode. Acceptable modes: %s",
modeStr,
- Arrays.stream(values()).map(m -> m.value).collect(Collectors.toList())
+ Arrays.stream(MSQMode.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 11bf1f613f02..b299d4f9dd80 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 static void deleteBucketKeys(
log.debug("Deleting keys from bucket: [%s], keys: [%s]", bucket, keys);
}
DeleteObjectsRequest deleteRequest = new DeleteObjectsRequest(bucket).withKeys(keysToDelete);
- retryS3Operation(() -> {
+ S3Utils.retryS3Operation(() -> {
s3Client.deleteObjects(deleteRequest);
return null;
}, retries);
@@ -353,7 +353,7 @@ static void uploadFileIfPossible(
final PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, key, file);
if (!disableAcl) {
- putObjectRequest.setAccessControlList(grantFullControlToBucketOwner(service, bucket));
+ putObjectRequest.setAccessControlList(S3Utils.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 82b04c5bb8aa..3efb6c5bec7e 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
@@ -956,7 +956,7 @@ public void close(TaskAttemptContext context)
@Override
public void checkOutputSpecs(JobContext job) throws IOException
{
- Path outDir = getOutputPath(job);
+ Path outDir = FileOutputFormat.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 2d46563c9056..bb830afd244f 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 @@ private static HadoopDruidIndexerConfig fromMap(Map argSpec)
// the Map<> intermediary
if (argSpec.containsKey("spec")) {
- return JSON_MAPPER.convertValue(
+ return HadoopDruidIndexerConfig.JSON_MAPPER.convertValue(
argSpec,
HadoopDruidIndexerConfig.class
);
}
return new HadoopDruidIndexerConfig(
- JSON_MAPPER.convertValue(
+ HadoopDruidIndexerConfig.JSON_MAPPER.convertValue(
argSpec,
HadoopIngestionSpec.class
)
@@ -166,7 +166,7 @@ public static HadoopDruidIndexerConfig fromFile(File file)
{
try {
return fromMap(
- JSON_MAPPER.readValue(file, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)
+ HadoopDruidIndexerConfig.JSON_MAPPER.readValue(file, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)
);
}
catch (IOException e) {
@@ -180,7 +180,7 @@ public static HadoopDruidIndexerConfig fromString(String str)
// This is a map to try and prevent dependency screwbally-ness
try {
return fromMap(
- JSON_MAPPER.readValue(str, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)
+ HadoopDruidIndexerConfig.JSON_MAPPER.readValue(str, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)
);
}
catch (IOException e) {
@@ -197,7 +197,7 @@ public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path)
Reader reader = new InputStreamReader(fs.open(pt), StandardCharsets.UTF_8);
return fromMap(
- JSON_MAPPER.readValue(reader, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)
+ HadoopDruidIndexerConfig.JSON_MAPPER.readValue(reader, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT)
);
}
catch (Exception e) {
@@ -207,7 +207,7 @@ public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path)
public static HadoopDruidIndexerConfig fromConfiguration(Configuration conf)
{
- final HadoopDruidIndexerConfig retVal = fromString(conf.get(CONFIG_PROPERTY));
+ final HadoopDruidIndexerConfig retVal = fromString(conf.get(HadoopDruidIndexerConfig.CONFIG_PROPERTY));
retVal.verify();
return retVal;
}
@@ -590,7 +590,7 @@ public void intoConfiguration(Job job)
Configuration conf = job.getConfiguration();
try {
- conf.set(CONFIG_PROPERTY, JSON_MAPPER.writeValueAsString(this));
+ conf.set(HadoopDruidIndexerConfig.CONFIG_PROPERTY, HadoopDruidIndexerConfig.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 dfc3a4c69355..9da6ead38cf1 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 HadoopTuningConfig(
this.ignoreInvalidRows = Configs.valueOrDefault(ignoreInvalidRows, false);
this.maxParseExceptions = Configs.valueOrDefault(
maxParseExceptions,
- this.ignoreInvalidRows ? DEFAULT_MAX_PARSE_EXCEPTIONS : 0
+ this.ignoreInvalidRows ? TuningConfig.DEFAULT_MAX_PARSE_EXCEPTIONS : 0
);
- this.logParseExceptions = Configs.valueOrDefault(logParseExceptions, DEFAULT_LOG_PARSE_EXCEPTIONS);
+ this.logParseExceptions = Configs.valueOrDefault(logParseExceptions, TuningConfig.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 ce042451d753..7639ba66b5f6 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 static void maybeDeleteIntermediatePath(
authenticate();
HadoopDruidIndexerConfig config = HadoopDruidIndexerConfig.fromSpec(indexerSchema);
- final Configuration configuration = injectSystemProperties(new Configuration(), config);
+ final Configuration configuration = JobHelper.injectSystemProperties(new Configuration(), config);
config.addJobProperties(configuration);
- injectDruidProperties(configuration, config);
+ JobHelper.injectDruidProperties(configuration, config);
if (!config.getSchema().getTuningConfig().isLeaveIntermediate()) {
if (jobSucceeded || config.getSchema().getTuningConfig().isCleanupOnFailure()) {
Path workingPath = config.makeIntermediatePath();
@@ -619,7 +619,7 @@ public static Path makeTmpPath(
prependFSIfNullScheme(fs, basePath),
StringUtils.format(
"./%s.%d",
- dataSegmentPusher.makeIndexPathName(segmentTemplate, INDEX_ZIP),
+ dataSegmentPusher.makeIndexPathName(segmentTemplate, JobHelper.INDEX_ZIP),
taskAttemptID.getId()
)
);
@@ -640,9 +640,9 @@ public static void renameIndexFilesForSegments(
) throws IOException
{
HadoopDruidIndexerConfig config = HadoopDruidIndexerConfig.fromSpec(indexerSchema);
- final Configuration configuration = injectSystemProperties(new Configuration(), config);
+ final Configuration configuration = JobHelper.injectSystemProperties(new Configuration(), config);
config.addJobProperties(configuration);
- injectDruidProperties(configuration, config);
+ JobHelper.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 788b4987a38f..e6d39284c5af 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 @@ protected FileStatus[] listStatus(JobConf job) throws IOException
{
// to avoid globbing which needs input path should be hadoop-compatible (':' is not acceptable in path, etc.)
List statusList = new ArrayList<>();
- for (Path path : getInputPaths(job)) {
+ for (Path path : FileInputFormat.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 08c5accea335..185e6e014c69 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 static NonnullPair findIntervalAndVersion(
throw new ISE("Unspecified interval[%s] in granularitySpec[%s]", interval, granularitySpec);
}
- version = findVersion(versions, interval);
+ version = AbstractBatchIndexTask.findVersion(versions, interval);
if (version == null) {
throw new ISE("Cannot find a version for interval[%s]", interval);
}
@@ -820,7 +820,7 @@ public static NonnullPair findIntervalAndVersion(
// 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 = findVersion(versions, interval);
+ final String existingLockVersion = AbstractBatchIndexTask.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 a8927d2fe1d3..319c1a7ab691 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 @@ private void killHadoopJob()
String hadoopJobIdFile = getHadoopJobIdFileName();
try {
- ClassLoader loader = buildClassLoader(
+ ClassLoader loader = HadoopTask.buildClassLoader(
getHadoopDependencyCoordinates(),
taskConfig.getDefaultHadoopCoordinates()
);
@@ -616,7 +616,7 @@ private void indexerGeneratorCleanupJob(
final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
try {
- ClassLoader loader = buildClassLoader(
+ ClassLoader loader = HadoopTask.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 d745a8934315..9c114d3403f1 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,6 +81,7 @@
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;
@@ -741,7 +742,7 @@ private Map> collectIntervalsAndShardSp
Comparators.intervalsByStartThenEnd()
);
final Granularity queryGranularity = granularitySpec.getQueryGranularity();
- try (final CloseableIterator inputRowIterator = inputSourceReader(
+ try (final CloseableIterator inputRowIterator = AbstractBatchIndexTask.inputSourceReader(
tmpDir,
ingestionSchema.getDataSchema(),
inputSource,
@@ -1069,7 +1070,7 @@ public IndexIngestionSpec(
throw new IAE("Cannot use parser and inputSource together. Try using inputFormat instead of parser.");
}
- IngestionMode ingestionMode = computeBatchIngestionMode(ioConfig);
+ IngestionMode ingestionMode = AbstractTask.computeBatchIngestionMode(ioConfig);
if (ingestionMode == IngestionMode.REPLACE && dataSchema.getGranularitySpec()
.inputIntervals()
@@ -1132,8 +1133,8 @@ public IndexIOConfig(
{
this.inputSource = inputSource;
this.inputFormat = inputFormat;
- this.appendToExisting = appendToExisting == null ? DEFAULT_APPEND_EXISTING : appendToExisting;
- this.dropExisting = dropExisting == null ? DEFAULT_DROP_EXISTING : dropExisting;
+ this.appendToExisting = appendToExisting == null ? BatchIOConfig.DEFAULT_APPEND_EXISTING : appendToExisting;
+ this.dropExisting = dropExisting == null ? BatchIOConfig.DEFAULT_DROP_EXISTING : dropExisting;
}
@Nullable
@@ -1366,7 +1367,7 @@ private IndexTuningConfig(
)
{
this.appendableIndexSpec = appendableIndexSpec == null ? DEFAULT_APPENDABLE_INDEX : appendableIndexSpec;
- this.maxRowsInMemory = maxRowsInMemory == null ? DEFAULT_MAX_ROWS_IN_MEMORY_BATCH : maxRowsInMemory;
+ this.maxRowsInMemory = maxRowsInMemory == null ? TuningConfig.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;
@@ -1394,14 +1395,14 @@ private IndexTuningConfig(
this.maxSavedParseExceptions = maxSavedParseExceptions == null ? 0 : Math.min(1, maxSavedParseExceptions);
} else {
this.maxParseExceptions = maxParseExceptions == null
- ? DEFAULT_MAX_PARSE_EXCEPTIONS
+ ? TuningConfig.DEFAULT_MAX_PARSE_EXCEPTIONS
: maxParseExceptions;
this.maxSavedParseExceptions = maxSavedParseExceptions == null
- ? DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS
+ ? TuningConfig.DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS
: maxSavedParseExceptions;
}
this.logParseExceptions = logParseExceptions == null
- ? DEFAULT_LOG_PARSE_EXCEPTIONS
+ ? TuningConfig.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 06a2da71f8aa..79a3e8993a8c 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 static void emitSegmentPublishMetrics(
)
{
final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder();
- setTaskDimensions(metricBuilder, task);
+ IndexTaskUtils.setTaskDimensions(metricBuilder, task);
if (publishResult.isSuccess()) {
toolbox.getEmitter().emit(metricBuilder.setMetric("segment/txn/success", 1));
for (DataSegment segment : publishResult.getSegments()) {
- setSegmentDimensions(metricBuilder, segment);
+ IndexTaskUtils.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 36853987a6dc..d2694c7afd92 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 LegacySinglePhaseSubTask(
@Override
public String getType()
{
- return OLD_TYPE_NAME;
+ return SinglePhaseSubTask.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 67d97c62b815..d75304f38c08 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,6 +37,7 @@
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;
@@ -181,7 +182,7 @@ public TaskStatus runTask(TaskToolbox toolbox) throws Exception
tuningConfig.getMaxSavedParseExceptions()
);
try (
- final CloseableIterator inputRowIterator = inputSourceReader(
+ final CloseableIterator inputRowIterator = AbstractBatchIndexTask.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 089424377aa4..4bb395420b3f 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,6 +40,7 @@
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;
@@ -228,7 +229,7 @@ public TaskStatus runTask(TaskToolbox toolbox) throws Exception
tuningConfig.getMaxSavedParseExceptions()
);
try (
- final CloseableIterator inputRowIterator = inputSourceReader(
+ final CloseableIterator inputRowIterator = AbstractBatchIndexTask.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 fa4122904c5d..17d9936c6851 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,6 +32,7 @@
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;
@@ -292,7 +293,7 @@ private DataSegmentsWithSchemas mergeAndPushSegments(
getDataSource(),
interval,
Preconditions.checkNotNull(
- findVersion(intervalToVersion, interval),
+ AbstractBatchIndexTask.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 db9dc26372c6..8d49a7f3dbe7 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,6 +38,8 @@
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;
@@ -163,7 +165,7 @@ public SinglePhaseSubTask(
taskResource,
ingestionSchema.getDataSchema().getDataSource(),
context,
- computeBatchIngestionMode(ingestionSchema.getIOConfig()),
+ AbstractTask.computeBatchIngestionMode(ingestionSchema.getIOConfig()),
supervisorTaskId
);
@@ -407,7 +409,7 @@ private DataSegmentsWithSchemas generateAndPushSegments(
boolean exceptionOccurred = false;
try (
final BatchAppenderatorDriver driver = BatchAppenderators.newDriver(appenderator, toolbox, segmentAllocator);
- final CloseableIterator inputRowIterator = inputSourceReader(
+ final CloseableIterator inputRowIterator = AbstractBatchIndexTask.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 8f83a63057c7..84c17f1a8fa0 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 Stream>> createSplits(
coordinatorClient,
dataSource,
interval,
- splitHintSpec == null ? DEFAULT_SPLIT_HINT_SPEC : splitHintSpec
+ splitHintSpec == null ? SplittableInputSource.DEFAULT_SPLIT_HINT_SPEC : splitHintSpec
)
);
} else {
@@ -417,7 +417,7 @@ public int estimateNumSplits(InputFormat inputFormat, @Nullable SplitHintSpec sp
coordinatorClient,
dataSource,
interval,
- splitHintSpec == null ? DEFAULT_SPLIT_HINT_SPEC : splitHintSpec
+ splitHintSpec == null ? SplittableInputSource.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 49c8d1661502..88e11821abc7 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 boolean matches(char c)
if (inQuotes) {
return false;
}
- return breakingWhitespace().matches(c);
+ return CharMatcher.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 b802ffc044d5..309336e1d532 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,6 +23,7 @@
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;
@@ -130,14 +131,14 @@ public SeekableStreamIndexTaskTuningConfig(
this.maxSavedParseExceptions = maxSavedParseExceptions == null ? 0 : Math.min(1, maxSavedParseExceptions);
} else {
this.maxParseExceptions = maxParseExceptions == null
- ? DEFAULT_MAX_PARSE_EXCEPTIONS
+ ? TuningConfig.DEFAULT_MAX_PARSE_EXCEPTIONS
: maxParseExceptions;
this.maxSavedParseExceptions = maxSavedParseExceptions == null
- ? DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS
+ ? TuningConfig.DEFAULT_MAX_SAVED_PARSE_EXCEPTIONS
: maxSavedParseExceptions;
}
this.logParseExceptions = logParseExceptions == null
- ? DEFAULT_LOG_PARSE_EXCEPTIONS
+ ? TuningConfig.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 df5ef8827eb5..087cb24bec5d 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(SERVICE_NAME);
+ public static final NodeRole NODE_ROLE = new NodeRole(CliCustomNodeRole.SERVICE_NAME);
public CliCustomNodeRole()
{
@@ -85,9 +85,9 @@ protected List extends Module> getModules()
return ImmutableList.of(
binder -> {
LOG.info("starting up custom node role");
- 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.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.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 eade6b9eda0e..e0e1605b3026 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(SERVICE_NAME);
+ public static final NodeRole NODE_ROLE = new NodeRole(CliCustomNodeRole.SERVICE_NAME);
public CliCustomNodeRole()
{
@@ -84,9 +84,9 @@ protected List extends Module> getModules()
return ImmutableList.of(
binder -> {
LOG.info("starting up");
- 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.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.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 a5df23466ca6..dd1e82f82dfe 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 void initialize(String topic)
try {
RetryUtils.retry(
() -> {
- schemaId = client.register(topic, SCHEMA);
+ schemaId = client.register(topic, AvroEventSerializer.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 f2a65ae95dfa..8d80b22af35d 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 void initialize(String topic)
try {
RetryUtils.retry(
() -> {
- schemaId = client.register(topic, new ProtobufSchema(SCHEMA.newMessageBuilder("Wikipedia").getDescriptorForType()));
+ schemaId = client.register(topic, new ProtobufSchema(ProtobufEventSerializer.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 f8d14f81e3d6..1ef82732a4f2 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 static PolygonBound from(
public static PolygonBound from(float[] abscissa, float[] ordinate)
{
- return from(abscissa, ordinate, 0);
+ return PolygonBound.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 578c64acbc56..da2871722240 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
@@ -128,7 +128,7 @@ public static boolean sqlCompatible()
*/
public static boolean useThreeValueLogic()
{
- return sqlCompatible() &&
+ return NullHandling.sqlCompatible() &&
INSTANCE.isUseThreeValueLogicForNativeFilters();
}
@@ -266,7 +266,7 @@ public static boolean isNullOrEquivalent(@Nullable ByteBuffer buffer)
*/
public static boolean mustCombineNullAndEmptyInDictionary(final Indexed dictionaryUtf8)
{
- return replaceWithDefault()
+ return NullHandling.replaceWithDefault()
&& dictionaryUtf8.size() >= 2
&& isNullOrEquivalent(dictionaryUtf8.get(0))
&& isNullOrEquivalent(dictionaryUtf8.get(1));
@@ -283,7 +283,7 @@ && isNullOrEquivalent(dictionaryUtf8.get(0))
*/
public static boolean mustReplaceFirstValueWithNullInDictionary(final Indexed dictionaryUtf8)
{
- if (replaceWithDefault() && dictionaryUtf8.size() >= 1) {
+ if (NullHandling.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 83a83b4f1a56..7f244ec7d356 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 static T get(final ListenableFuture future, final boolean cancelIf
public static T getUnchecked(final ListenableFuture future, final boolean cancelIfInterrupted)
{
try {
- return get(future, cancelIfInterrupted);
+ return FutureUtils.get(future, cancelIfInterrupted);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -103,7 +103,7 @@ public static T getUncheckedImmediately(final ListenableFuture future)
/**
* Like {@link Futures#transform}, but works better with lambdas due to not having overloads.
*
- * One can write {@code transform(future, v -> ...)} instead of
+ * One can write {@code FutureUtils.transform(future, v -> ...)} instead of
* {@code Futures.transform(future, (Function super T, ?>) v -> ...)}
*/
public static ListenableFuture transform(final ListenableFuture future, final Function fn)
@@ -115,7 +115,7 @@ public static ListenableFuture transform(final ListenableFuture fut
* Like {@link Futures#transformAsync(ListenableFuture, AsyncFunction, java.util.concurrent.Executor)}, but works better with lambdas due to not having
* overloads.
*
- * One can write {@code transformAsync(future, v -> ...)} instead of
+ * One can write {@code FutureUtils.transformAsync(future, v -> ...)} instead of
* {@code Futures.transform(future, (Function super T, ?>) 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 ee769dfd89eb..88d4d0d413ba 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 static String getRandomId()
public static String getRandomIdWithPrefix(String prefix)
{
- return UNDERSCORE_JOINER.join(prefix, getRandomId());
+ return UNDERSCORE_JOINER.join(prefix, IdUtils.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 a22f72ab9fb4..c13b69105ea2 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 @@ private DimensionsSpec(
}
for (SpatialDimensionSchema spatialSchema : spatialDims) {
- DimensionSchema newSchema = convertSpatialSchema(spatialSchema);
+ DimensionSchema newSchema = DimensionsSpec.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 041907a09cea..2bde08122149 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 DoubleDimensionSchema(@JsonProperty("name") String name)
@Override
public String getTypeName()
{
- return DOUBLE_TYPE_NAME;
+ return DimensionSchema.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 ca7b3e2a4002..1a9d6e73fe39 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 FloatDimensionSchema(
@Override
public String getTypeName()
{
- return FLOAT_TYPE_NAME;
+ return DimensionSchema.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 3c9ee334ffb1..e8a90a7a4818 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 LongDimensionSchema(
@Override
public String getTypeName()
{
- return LONG_TYPE_NAME;
+ return DimensionSchema.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 d46c7ca130a1..bd1fd8292aea 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 List getDims()
@Override
public String getTypeName()
{
- return SPATIAL_TYPE_NAME;
+ return DimensionSchema.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 117750396558..2af2fbbaac23 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 StringDimensionSchema(String name)
@Override
public String getTypeName()
{
- return STRING_TYPE_NAME;
+ return DimensionSchema.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 0d3ac643de66..b48bae6c0b2f 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 static ImmutableConciseSet complement(ImmutableConciseSet set, int length
}
}
ConciseSet newSet = new ConciseSet(words, false);
- return newImmutableFromMutable(newSet);
+ return ImmutableConciseSet.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 49a9a2347d76..8185190a28da 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 static Frame decompress(final Memory memory, final long position, final l
);
}
- return wrap(dstBuffer);
+ return Frame.wrap(dstBuffer);
} else {
// Copy first, then decompress.
final byte[] compressedFrame = new byte[compressedFrameLength];
memory.getByteArray(frameStart, compressedFrame, 0, compressedFrameLength);
- return wrap(LZ4_DECOMPRESSOR.decompress(compressedFrame, uncompressedFrameLength));
+ return Frame.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 69958187b86b..d26f248e8016 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 RowKeyReader trimmedKeyReader(int trimmedFieldCount)
newSignature.add(columnName, columnType);
}
- return create(newSignature.build());
+ return RowKeyReader.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 058450dd0631..e1377eddca35 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 synchronized OutputChannel mapWritableChannel(final Function knownTask
if (elements.size() < 2) {
return false;
}
- if (!QUERY_RESULTS_DIR.equals(elements.get(0))) {
+ if (!DurableStorageUtils.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 affa5a453cad..a480767f1113 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 @@ private static ByteBuffer getUtf8ByteBufferFromStringSelector(
return buf;
}
} else {
- return getUtf8ByteBufferFromString(selector.lookupName(dictionaryId));
+ return FrameWriterUtils.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 f8ef6acc152a..d285f1cd044e 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 HyperLogLogCollector fold(@Nullable HyperLogLogCollector other)
convertToDenseStorage();
}
- other = makeCollector(tmpBuffer);
+ other = HyperLogLogCollector.makeCollector(tmpBuffer);
}
final ByteBuffer otherBuffer = other.storageBuffer;
@@ -574,7 +574,7 @@ public boolean equals(Object o)
final ByteBuffer denseStorageBuffer;
if (storageBuffer.remaining() != getNumBytesForDenseStorage()) {
- HyperLogLogCollector denseCollector = makeCollector(storageBuffer.duplicate());
+ HyperLogLogCollector denseCollector = HyperLogLogCollector.makeCollector(storageBuffer.duplicate());
denseCollector.convertToDenseStorage();
denseStorageBuffer = denseCollector.storageBuffer;
} else {
@@ -582,7 +582,7 @@ public boolean equals(Object o)
}
if (otherBuffer.remaining() != getNumBytesForDenseStorage()) {
- HyperLogLogCollector otherCollector = makeCollector(otherBuffer.duplicate());
+ HyperLogLogCollector otherCollector = HyperLogLogCollector.makeCollector(otherBuffer.duplicate());
otherCollector.convertToDenseStorage();
otherBuffer = otherCollector.storageBuffer;
}
diff --git a/processing/src/main/java/org/apache/druid/indexer/TaskLocation.java b/processing/src/main/java/org/apache/druid/indexer/TaskLocation.java
index ed664775f4e7..2992814de457 100644
--- a/processing/src/main/java/org/apache/druid/indexer/TaskLocation.java
+++ b/processing/src/main/java/org/apache/druid/indexer/TaskLocation.java
@@ -60,7 +60,7 @@ public static TaskLocation create(String host, int port, int tlsPort, boolean is
public static TaskLocation unknown()
{
- return UNKNOWN;
+ return TaskLocation.UNKNOWN;
}
@JsonCreator
diff --git a/processing/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java b/processing/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java
index 5b83a5feca0b..744f5c9e6815 100644
--- a/processing/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java
+++ b/processing/src/main/java/org/apache/druid/indexer/partitions/DimensionRangePartitionsSpec.java
@@ -125,7 +125,7 @@ public Integer getMaxRowsPerSegment()
return resolvedMaxRowPerSegment; // NOTE: This returns the *resolved* value
}
- @JsonProperty(MAX_ROWS_PER_SEGMENT)
+ @JsonProperty(PartitionsSpec.MAX_ROWS_PER_SEGMENT)
protected Integer getMaxRowsPerSegmentForJson()
{
return maxRowsPerSegment;
diff --git a/processing/src/main/java/org/apache/druid/indexer/partitions/DynamicPartitionsSpec.java b/processing/src/main/java/org/apache/druid/indexer/partitions/DynamicPartitionsSpec.java
index bd60493bd791..2c5d294f3c1c 100644
--- a/processing/src/main/java/org/apache/druid/indexer/partitions/DynamicPartitionsSpec.java
+++ b/processing/src/main/java/org/apache/druid/indexer/partitions/DynamicPartitionsSpec.java
@@ -46,7 +46,7 @@ public class DynamicPartitionsSpec implements PartitionsSpec
@JsonCreator
public DynamicPartitionsSpec(
- @JsonProperty(MAX_ROWS_PER_SEGMENT) @Nullable Integer maxRowsPerSegment,
+ @JsonProperty(PartitionsSpec.MAX_ROWS_PER_SEGMENT) @Nullable Integer maxRowsPerSegment,
@JsonProperty("maxTotalRows") @Nullable Long maxTotalRows
)
{
diff --git a/processing/src/main/java/org/apache/druid/indexer/partitions/HashedPartitionsSpec.java b/processing/src/main/java/org/apache/druid/indexer/partitions/HashedPartitionsSpec.java
index 688d4a601379..c9561ac47dac 100644
--- a/processing/src/main/java/org/apache/druid/indexer/partitions/HashedPartitionsSpec.java
+++ b/processing/src/main/java/org/apache/druid/indexer/partitions/HashedPartitionsSpec.java
@@ -93,7 +93,7 @@ public HashedPartitionsSpec(
// Supply default for targetRowsPerSegment if needed
if (target.getValue() == null) {
//noinspection VariableNotUsedInsideIf (false positive for this.numShards)
- this.maxRowsPerSegment = (this.numShards == null ? DEFAULT_MAX_ROWS_PER_SEGMENT : null);
+ this.maxRowsPerSegment = (this.numShards == null ? PartitionsSpec.DEFAULT_MAX_ROWS_PER_SEGMENT : null);
} else {
this.maxRowsPerSegment = target.getValue();
}
diff --git a/processing/src/main/java/org/apache/druid/java/util/common/Either.java b/processing/src/main/java/org/apache/druid/java/util/common/Either.java
index 342c06212dd1..5a2720d07481 100644
--- a/processing/src/main/java/org/apache/druid/java/util/common/Either.java
+++ b/processing/src/main/java/org/apache/druid/java/util/common/Either.java
@@ -111,7 +111,7 @@ public R valueOrThrow()
public Either map(final Function fn)
{
if (isValue()) {
- return value(fn.apply(value));
+ return Either.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 f44e6c327a53..63e697cc9549 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 = parse(bytes);
+ this.bytes = HumanReadableBytes.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 282c436ebcde..d8ef9956d9bf 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 fromUtf8(value).length for valid string values
+ // returns the same result with StringUtils.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 static String fromUtf8(final ByteBuffer buffer, final int numBytes)
*/
public static String fromUtf8(final ByteBuffer buffer)
{
- return fromUtf8(buffer, buffer.remaining());
+ return StringUtils.fromUtf8(buffer, buffer.remaining());
}
/**
@@ -273,7 +273,7 @@ public static String fromUtf8Nullable(@Nullable final ByteBuffer buffer)
if (buffer == null) {
return null;
}
- return fromUtf8(buffer, buffer.remaining());
+ return StringUtils.fromUtf8(buffer, buffer.remaining());
}
/**
@@ -390,7 +390,7 @@ public static String encodeForFormat(@Nullable final String s)
if (s == null) {
return null;
} else {
- return replaceChar(s, '%', "%%");
+ return StringUtils.replaceChar(s, '%', "%%");
}
}
@@ -422,7 +422,7 @@ public static String urlEncode(@Nullable String s)
}
try {
- return replace(URLEncoder.encode(s, "UTF-8"), "+", "%20");
+ return StringUtils.replace(URLEncoder.encode(s, "UTF-8"), "+", "%20");
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
@@ -792,7 +792,7 @@ public static String chop(@Nullable final String s, final int maxBytes)
} else {
// Shorten firstValue to what could fit in maxBytes as UTF-8.
final byte[] bytes = new byte[maxBytes];
- final int len = toUtf8WithLimit(s, ByteBuffer.wrap(bytes));
+ final int len = StringUtils.toUtf8WithLimit(s, ByteBuffer.wrap(bytes));
return new String(bytes, 0, len, StandardCharsets.UTF_8);
}
}
@@ -831,6 +831,6 @@ public static String getResource(Object ref, String resource)
*/
public static String escapeSql(String str)
{
- return str == null ? null : replace(str, "'", "''");
+ return str == null ? null : StringUtils.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 1ae9281e8ab7..08de0a364ec3 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 ? ALL : granularity;
+ return granularity == null ? Granularities.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 26fe8e44f648..b4b78390605d 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 DateTime getDateTime(Integer[] vals)
*/
public static boolean isStandard(Granularity granularity)
{
- final GranularityType[] values = values();
+ final GranularityType[] values = GranularityType.values();
for (GranularityType value : values) {
if (value.getDefaultGranularity().equals(granularity)) {
return true;
@@ -205,42 +205,42 @@ public static GranularityType fromPeriod(Period period)
switch (index) {
case 0:
- return YEAR;
+ return GranularityType.YEAR;
case 1:
if (vals[index] == 3) {
- return QUARTER;
+ return GranularityType.QUARTER;
} else if (vals[index] == 1) {
- return MONTH;
+ return GranularityType.MONTH;
}
break;
case 2:
- return WEEK;
+ return GranularityType.WEEK;
case 3:
- return DAY;
+ return GranularityType.DAY;
case 4:
if (vals[index] == 8) {
- return EIGHT_HOUR;
+ return GranularityType.EIGHT_HOUR;
} else if (vals[index] == 6) {
- return SIX_HOUR;
+ return GranularityType.SIX_HOUR;
} else if (vals[index] == 1) {
- return HOUR;
+ return GranularityType.HOUR;
}
break;
case 5:
if (vals[index] == 30) {
- return THIRTY_MINUTE;
+ return GranularityType.THIRTY_MINUTE;
} else if (vals[index] == 15) {
- return FIFTEEN_MINUTE;
+ return GranularityType.FIFTEEN_MINUTE;
} else if (vals[index] == 10) {
- return TEN_MINUTE;
+ return GranularityType.TEN_MINUTE;
} else if (vals[index] == 5) {
- return FIVE_MINUTE;
+ return GranularityType.FIVE_MINUTE;
} else if (vals[index] == 1) {
- return MINUTE;
+ return GranularityType.MINUTE;
}
break;
case 6:
- return SECOND;
+ return GranularityType.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 5b4cd7f2e6da..15f878af1304 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 static Sequence concat(Sequence... sequences)
public static Sequence concat(Iterable> sequences)
{
- return concat(simple(sequences));
+ return concat(Sequences.simple(sequences));
}
public static Sequence concat(Sequence extends 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 04e372f4f5d5..9ddde9b89700 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 List getNodes()
@JsonCreator
public static JSONPathFieldSpec fromString(String name)
{
- return createRootField(name);
+ return JSONPathFieldSpec.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 fe86ae3035b7..18afba4491d9 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 static Function getTransformationFunction(
if (input.contains(listDelimiter)) {
return StreamSupport.stream(listSplitter.split(input).spliterator(), false)
.map(NullHandling::emptyToNullIfNeeded)
- .map(value -> tryParseNumbers ? tryParseStringAsNumber(value) : value)
+ .map(value -> tryParseNumbers ? ParserUtils.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 93ef6b1a1245..879aba3d8b70 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 void run()
private boolean needsToShutdown()
{
- boolean needsToShutdown = interrupted() || shuttingDown;
+ boolean needsToShutdown = Thread.interrupted() || shuttingDown;
if (needsToShutdown) {
Object lastBatch = concurrentBatch.getAndSet(null);
if (lastBatch instanceof Batch) {
@@ -722,7 +722,7 @@ void sendBackoffDelay()
final long backoffCheckDelayMillis = config.getMinHttpTimeoutMillis() / 5;
try {
- sleep(backoffCheckDelayMillis);
+ Thread.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 c0c2b98b901f..352272d67bc4 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 createEmittable(null, descriptionFormat, objects);
+ return AlertBuilder.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 91a1dce688a4..0010679a8144 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 static boolean objectAsBoolean(@Nullable Object val)
if (val instanceof Boolean) {
return (Boolean) val;
} else if (val instanceof String) {
- return asBoolean((String) val);
+ return Evals.asBoolean((String) val);
} else if (val instanceof Long) {
- return asBoolean((Long) val);
+ return Evals.asBoolean((Long) val);
} else if (val instanceof Number) {
- return asBoolean(((Number) val).doubleValue());
+ return Evals.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 3c2e5630df47..f0d411a8e37d 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 static NonnullPair coerceListToArray(@Nullable
Object[] array = new Object[val.size()];
int i = 0;
for (Object o : val) {
- array[i++] = o != null ? ofType(ExpressionType.LONG, o).value() : null;
+ array[i++] = o != null ? ExprEval.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 ? ofType(ExpressionType.DOUBLE, o).value() : null;
+ array[i++] = o != null ? ExprEval.ofType(ExpressionType.DOUBLE, o).value() : null;
}
return new NonnullPair<>(ExpressionType.DOUBLE_ARRAY, array);
} else if (coercedType == Object.class) {
@@ -184,7 +184,7 @@ public static NonnullPair coerceListToArray(@Nullable
ExpressionType elementType = null;
for (Object o : val) {
if (o != null) {
- ExprEval> eval = bestEffortOf(o);
+ ExprEval> eval = ExprEval.bestEffortOf(o);
elementType = ExpressionTypeConversion.leastRestrictiveType(elementType, eval.type());
evals[i++] = eval;
} else {
@@ -196,7 +196,7 @@ public static NonnullPair coerceListToArray(@Nullable
if (eval != null) {
array[i++] = eval.castTo(elementType).value();
} else {
- array[i++] = ofType(elementType, null).value();
+ array[i++] = ExprEval.ofType(elementType, null).value();
}
}
ExpressionType arrayType = elementType == null
@@ -208,7 +208,7 @@ public static NonnullPair coerceListToArray(@Nullable
Object[] array = new Object[val.size()];
int i = 0;
for (Object o : val) {
- array[i++] = o != null ? ofType(ExpressionType.STRING, o).value() : null;
+ array[i++] = o != null ? ExprEval.ofType(ExpressionType.STRING, o).value() : null;
}
return new NonnullPair<>(ExpressionType.STRING_ARRAY, array);
}
@@ -530,7 +530,7 @@ public static ExprEval ofType(@Nullable ExpressionType type, @Nullable Object va
return ofLongBoolean((Boolean) value);
}
if (value instanceof String) {
- return ofLong(computeNumber((String) value));
+ return ofLong(ExprEval.computeNumber((String) value));
}
return ofLong(null);
case DOUBLE:
@@ -541,7 +541,7 @@ public static ExprEval ofType(@Nullable ExpressionType type, @Nullable Object va
return ofDouble(Evals.asDouble((Boolean) value));
}
if (value instanceof String) {
- return ofDouble(computeNumber((String) value));
+ return ofDouble(ExprEval.computeNumber((String) value));
}
return ofDouble(null);
case COMPLEX:
@@ -576,7 +576,7 @@ public static ExprEval ofType(@Nullable ExpressionType type, @Nullable Object va
Object[] array = new Object[theList.size()];
int i = 0;
for (Object o : theList) {
- array[i++] = ofType(elementType, o).value();
+ array[i++] = ExprEval.ofType(elementType, o).value();
}
return ofArray(type, array);
}
@@ -586,7 +586,7 @@ public static ExprEval ofType(@Nullable ExpressionType type, @Nullable Object va
Object[] array = new Object[inputArray.length];
int i = 0;
for (Object o : inputArray) {
- array[i++] = ofType(elementType, o).value();
+ array[i++] = ExprEval.ofType(elementType, o).value();
}
return ofArray(type, array);
}
@@ -861,20 +861,20 @@ public final ExprEval castTo(ExpressionType castTo)
return this;
case LONG:
if (value == null) {
- return ofLong(null);
+ return ExprEval.ofLong(null);
} else {
- return of(asLong());
+ return ExprEval.of(asLong());
}
case STRING:
- return of(asString());
+ return ExprEval.of(asString());
case ARRAY:
switch (castTo.getElementType().getType()) {
case DOUBLE:
- return ofDoubleArray(asArray());
+ return ExprEval.ofDoubleArray(asArray());
case LONG:
- return ofLongArray(value == null ? null : new Object[]{value.longValue()});
+ return ExprEval.ofLongArray(value == null ? null : new Object[]{value.longValue()});
case STRING:
- return ofStringArray(value == null ? null : new Object[]{value.toString()});
+ return ExprEval.ofStringArray(value == null ? null : new Object[]{value.toString()});
default:
ExpressionType elementType = (ExpressionType) castTo.getElementType();
return new ArrayExprEval(castTo, new Object[]{castTo(elementType).value()});
@@ -942,25 +942,25 @@ public final ExprEval castTo(ExpressionType castTo)
switch (castTo.getType()) {
case DOUBLE:
if (value == null) {
- return ofDouble(null);
+ return ExprEval.ofDouble(null);
} else {
- return of(asDouble());
+ return ExprEval.of(asDouble());
}
case LONG:
return this;
case STRING:
- return of(asString());
+ return ExprEval.of(asString());
case ARRAY:
if (value == null) {
return new ArrayExprEval(castTo, null);
}
switch (castTo.getElementType().getType()) {
case DOUBLE:
- return ofDoubleArray(new Object[]{value.doubleValue()});
+ return ExprEval.ofDoubleArray(new Object[]{value.doubleValue()});
case LONG:
- return ofLongArray(asArray());
+ return ExprEval.ofLongArray(asArray());
case STRING:
- return ofStringArray(new Object[]{value.toString()});
+ return ExprEval.ofStringArray(new Object[]{value.toString()});
default:
ExpressionType elementType = (ExpressionType) castTo.getElementType();
return new ArrayExprEval(castTo, new Object[]{castTo(elementType).value()});
@@ -1121,10 +1121,10 @@ public final ExprEval castTo(ExpressionType castTo)
{
switch (castTo.getType()) {
case DOUBLE:
- return ofDouble(computeNumber());
+ return ExprEval.ofDouble(computeNumber());
case LONG:
- return ofLong(computeNumber());
+ return ExprEval.ofLong(computeNumber());
case STRING:
return this;
@@ -1136,12 +1136,12 @@ public final ExprEval castTo(ExpressionType castTo)
ExprType type = castTo.getElementType().getType();
if (type == ExprType.DOUBLE) {
final Number number = computeNumber();
- return ofDoubleArray(new Object[]{number == null ? null : number.doubleValue()});
+ return ExprEval.ofDoubleArray(new Object[]{number == null ? null : number.doubleValue()});
} else if (type == ExprType.LONG) {
final Number number = computeNumber();
- return ofLongArray(new Object[]{number == null ? null : number.longValue()});
+ return ExprEval.ofLongArray(new Object[]{number == null ? null : number.longValue()});
} else if (type == ExprType.STRING) {
- return ofStringArray(new Object[]{value});
+ return ExprEval.ofStringArray(new Object[]{value});
}
ExpressionType elementType = (ExpressionType) castTo.getElementType();
@@ -1306,7 +1306,7 @@ public ExprEval castTo(ExpressionType castTo)
if (castTo.isArray()) {
return new ArrayExprEval(castTo, null);
}
- return ofType(castTo, null);
+ return ExprEval.ofType(castTo, null);
}
if (type().equals(castTo)) {
return this;
@@ -1314,26 +1314,26 @@ public ExprEval castTo(ExpressionType castTo)
switch (castTo.getType()) {
case STRING:
if (value.length == 1) {
- return of(asString());
+ return ExprEval.of(asString());
}
break;
case LONG:
if (value.length == 1) {
- return isNumericNull() ? ofLong(null) : ofLong(asLong());
+ return isNumericNull() ? ExprEval.ofLong(null) : ExprEval.ofLong(asLong());
}
break;
case DOUBLE:
if (value.length == 1) {
- return isNumericNull() ? ofDouble(null) : ofDouble(asDouble());
+ return isNumericNull() ? ExprEval.ofDouble(null) : ExprEval.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] = ofType(elementType(), value[i]).castTo(elementType).value();
+ cast[i] = ExprEval.ofType(elementType(), value[i]).castTo(elementType).value();
}
- return ofArray(castTo, cast);
+ return ExprEval.ofArray(castTo, cast);
case COMPLEX:
if (ExpressionType.NESTED_DATA.equals(castTo)) {
return new NestedDataExprEval(value);
@@ -1507,7 +1507,7 @@ private void computeNumber()
} else if (val instanceof Boolean) {
number = Evals.asLong((Boolean) val);
} else if (val instanceof String) {
- number = computeNumber((String) val);
+ number = ExprEval.computeNumber((String) val);
}
}
}
@@ -1517,7 +1517,7 @@ private void computeNumber()
public Object[] asArray()
{
Object val = StructuredData.unwrap(value);
- ExprEval maybeArray = bestEffortOf(val);
+ ExprEval maybeArray = ExprEval.bestEffortOf(val);
if (maybeArray.type().isPrimitive() || maybeArray.isArray()) {
return maybeArray.asArray();
}
@@ -1532,7 +1532,7 @@ public ExprEval castTo(ExpressionType castTo)
}
Object val = StructuredData.unwrap(value);
- ExprEval bestEffortOf = bestEffortOf(val);
+ ExprEval bestEffortOf = ExprEval.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 9aa1029898a1..40d8ba1112c4 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 String stringify()
macro.name(),
args.size() == 1
? args.get(0).stringify()
- : ARG_JOINER.join(args.stream().map(Expr::stringify).iterator())
+ : Expr.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 40da7469566f..9a9294cb404a 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 boolean isPrimitive()
@Override
public boolean isArray()
{
- return this == ARRAY;
+ return this == ExprType.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 86d47d92cb26..42f322120978 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 =
- fromColumnTypeStrict(ColumnType.NESTED_DATA);
+ ExpressionType.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 cffb2c002073..16ae50248307 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 static ExpressionType leastRestrictiveType(@Nullable ExpressionType type,
@Nullable
public static ExpressionType integerMathFunction(@Nullable ExpressionType type, @Nullable ExpressionType other)
{
- final ExpressionType functionType = function(type, other);
+ final ExpressionType functionType = ExpressionTypeConversion.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 80bd58ad4ecd..e92dd130b7ce 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 static ApplyFunction getApplyFunction(String name)
*/
public static Supplier lazyParse(@Nullable String in, ExprMacroTable macroTable)
{
- return Suppliers.memoize(() -> in == null ? null : parse(in, macroTable));
+ return Suppliers.memoize(() -> in == null ? null : Parser.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 440739e7e31c..2eb459cf8cc3 100644
--- a/processing/src/main/java/org/apache/druid/query/JoinDataSource.java
+++ b/processing/src/main/java/org/apache/druid/query/JoinDataSource.java
@@ -320,7 +320,7 @@ public DataSource withUpdatedDataSource(DataSource newSource)
DimFilter joinBaseFilter = analysis.getJoinBaseTableFilter().orElse(null);
for (final PreJoinableClause clause : analysis.getPreJoinableClauses()) {
- current = create(
+ current = JoinDataSource.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 c1cc0c5f523b..c4c9a7875ef0 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 static Pair, List> condensedAggre
)
{
- List condensedPostAggs = pruneDependentPostAgg(postAggList, metric);
+ List condensedPostAggs = AggregatorUtil.pruneDependentPostAgg(postAggList, metric);
// calculate dependent aggregators for these postAgg
Set dependencySet = new HashSet<>();
dependencySet.add(metric);
@@ -427,7 +427,7 @@ public static Supplier getSimpleAggregatorCacheKeySupplier(
return ByteBuffer.allocate(2 + fieldNameBytes.length + expressionBytes.length)
.put(aggregatorType)
.put(fieldNameBytes)
- .put(STRING_SEPARATOR)
+ .put(AggregatorUtil.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 286ac4d47b7a..418bb32f64eb 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 boolean canVectorize(ColumnInspector columnInspector)
@Override
public Comparator getComparator()
{
- return VALUE_COMPARATOR;
+ return StringAnyAggregatorFactory.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 80a4ca8ddce2..8ff45a27380b 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 StringFirstAggregatorFactory(
this.fieldName = fieldName;
this.timeColumn = timeColumn == null ? ColumnHolder.TIME_COLUMN_NAME : timeColumn;
this.maxStringBytes = maxStringBytes == null
- ? DEFAULT_MAX_STRING_SIZE
+ ? StringFirstAggregatorFactory.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 2c343d7062f8..468be2b2a62b 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 double compute(double lhs, double rhs)
private static final Map LOOKUP_MAP = new HashMap<>();
static {
- for (Ops op : values()) {
+ for (Ops op : Ops.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 e5e6ead376dc..5c43c6445bc9 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 DimFilter getFilter()
@Override
public String getType()
{
- return DATASOURCE_METADATA;
+ return Query.DATASOURCE_METADATA;
}
@Override
diff --git a/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java b/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java
index 36b4cb9b44b4..d678f4b53f12 100644
--- a/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java
+++ b/processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java
@@ -789,7 +789,7 @@ public static ValuesSet create()
*/
public static ValuesSet of(@Nullable final String value)
{
- final ValuesSet retVal = create();
+ final ValuesSet retVal = ValuesSet.create();
retVal.add(NullHandling.emptyToNullIfNeeded(value));
return retVal;
}
diff --git a/processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java b/processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
index 05416039be78..79282735f384 100644
--- a/processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
+++ b/processing/src/main/java/org/apache/druid/query/groupby/GroupByQuery.java
@@ -1196,7 +1196,7 @@ public Builder setContext(Map context)
public Builder queryId(String queryId)
{
- context = computeOverriddenContext(context, ImmutableMap.of(QUERY_ID, queryId));
+ context = BaseQuery.computeOverriddenContext(context, ImmutableMap.of(BaseQuery.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 f53c64a566ed..5dc995b55386 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 Sequence process(
closer.register(bufferHolder);
try {
final String fudgeTimestampString = NullHandling.emptyToNullIfNeeded(
- query.context().getString(CTX_KEY_FUDGE_TIMESTAMP)
+ query.context().getString(GroupingEngine.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 1232fc7c5916..977cba96034b 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 static ResultRow create(final int size)
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 = create(query.getResultRowSizeWithPostAggregators());
+ final ResultRow 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 02e7fea12f54..96e4e9d24380 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 @@ private static Predicate getResultRowPredicate(final GroupByQuery que
final ColumnSelectorFactory columnSelectorFactory =
query.getVirtualColumns()
.wrap(
- createResultRowBasedColumnSelectorFactory(
+ RowBasedGrouperHelper.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 67cfcfc16c7b..5dbe2abf94fc 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 enum Direction
private static final Map STUPID_ENUM_MAP;
static {
final ImmutableMap.Builder bob = ImmutableMap.builder();
- for (Direction direction : values()) {
+ for (Direction direction : Direction.values()) {
bob.put(direction.name(), direction);
}
STUPID_ENUM_MAP = bob.build();
@@ -75,7 +75,7 @@ public static Direction fromString(String name)
Direction direction = STUPID_ENUM_MAP.get(upperName);
if (direction == null) {
- for (Direction dir : values()) {
+ for (Direction dir : Direction.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 b5df9e212a2e..131920177d38 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 ColumnAnalysis fold(ColumnAnalysis rhs)
}
if (isError() && rhs.isError()) {
- return errorMessage.equals(rhs.getErrorMessage()) ? this : error("multiple_errors");
+ return errorMessage.equals(rhs.getErrorMessage()) ? this : ColumnAnalysis.error("multiple_errors");
} else if (isError()) {
return this;
} else if (rhs.isError()) {
@@ -159,13 +159,13 @@ public ColumnAnalysis fold(ColumnAnalysis rhs)
}
if (!Objects.equals(type, rhs.getType())) {
- return error(
+ return ColumnAnalysis.error(
StringUtils.format("cannot_merge_diff_types: [%s] and [%s]", type, rhs.getType())
);
}
if (!Objects.equals(typeSignature, rhs.getTypeSignature())) {
- return error(
+ return ColumnAnalysis.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 1e365ea4b516..f2d434bab8a5 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 DimFilter getFilter()
@Override
public String getType()
{
- return SEGMENT_METADATA;
+ return Query.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 97d053491eba..79a8ebdb19d2 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 DimFilter getFilter()
@Override
public String getType()
{
- return WINDOW_OPERATOR;
+ return Query.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 eb44210d911d..650b259ed562 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 int hashCode()
@Override
public String toString()
{
- return LEXICOGRAPHIC_NAME;
+ return StringComparators.LEXICOGRAPHIC_NAME;
}
@Override
@@ -286,7 +286,7 @@ public int hashCode()
@Override
public String toString()
{
- return ALPHANUMERIC_NAME;
+ return StringComparators.ALPHANUMERIC_NAME;
}
@Override
@@ -340,7 +340,7 @@ public int hashCode()
@Override
public String toString()
{
- return STRLEN_NAME;
+ return StringComparators.STRLEN_NAME;
}
@Override
@@ -404,7 +404,7 @@ public int compare(String o1, String o2)
if (bd1 == null && bd2 == null) {
// both Strings are unparseable, just compare lexicographically to have a well-defined ordering
- return LEXICOGRAPHIC.compare(o1, o2);
+ return StringComparators.LEXICOGRAPHIC.compare(o1, o2);
}
if (bd1 == null) {
@@ -417,7 +417,7 @@ public int compare(String o1, String o2)
@Override
public String toString()
{
- return NUMERIC_NAME;
+ return StringComparators.NUMERIC_NAME;
}
@Override
@@ -469,7 +469,7 @@ public int compare(String o1, String o2)
@Override
public String toString()
{
- return VERSION_NAME;
+ return StringComparators.VERSION_NAME;
}
@Override
@@ -520,7 +520,7 @@ public int compare(String o1, String o2)
@Override
public String toString()
{
- return NATURAL_NAME;
+ return StringComparators.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 48e93f10e759..d6bc1026a98d 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 Builder add(String name, Column col)
public MapOfColumnsRowsAndColumns build()
{
- return fromMap(cols);
+ return MapOfColumnsRowsAndColumns.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 06ef3aa0a32b..aa10b6ab5790 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 DimFilter getFilter()
@Override
public String getType()
{
- return SEARCH;
+ return Query.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 95913b77940b..47412f7d7d50 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 DimFilter getFilter()
@Override
public String getType()
{
- return TIME_BOUNDARY;
+ return Query.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 f85237c8be88..b2165cd5b704 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 DimFilter getFilter()
@Override
public String getType()
{
- return TIMESERIES;
+ return Query.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 f31b6c1e6560..e79ad59b0fca 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)
{
- SPECIALIZE_GENERIC_ONE_AGG_POOLED_TOPN = value;
+ PooledTopNAlgorithm.SPECIALIZE_GENERIC_ONE_AGG_POOLED_TOPN = value;
computeSpecializedScanAndAggregateImplementations();
}
@VisibleForTesting
static void setSpecializeGeneric2AggPooledTopN(boolean value)
{
- SPECIALIZE_GENERIC_TWO_AGG_POOLED_TOPN = value;
+ PooledTopNAlgorithm.SPECIALIZE_GENERIC_TWO_AGG_POOLED_TOPN = value;
computeSpecializedScanAndAggregateImplementations();
}
@VisibleForTesting
static void setSpecializeHistorical1SimpleDoubleAggPooledTopN(boolean value)
{
- SPECIALIZE_HISTORICAL_ONE_SIMPLE_DOUBLE_AGG_POOLED_TOPN = value;
+ PooledTopNAlgorithm.SPECIALIZE_HISTORICAL_ONE_SIMPLE_DOUBLE_AGG_POOLED_TOPN = value;
computeSpecializedScanAndAggregateImplementations();
}
@VisibleForTesting
static void setSpecializeHistoricalSingleValueDimSelector1SimpleDoubleAggPooledTopN(boolean value)
{
- SPECIALIZE_HISTORICAL_SINGLE_VALUE_DIM_SELECTOR_ONE_SIMPLE_DOUBLE_AGG_POOLED_TOPN = value;
+ PooledTopNAlgorithm.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 1953c887b953..dafd7dc96005 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 ProcessedValue> processField(ArrayList fieldPath, @Null
ExprEval> eval = ExprEval.bestEffortOf(fieldValue);
FieldIndexer fieldIndexer = fieldIndexers.get(fieldName);
if (fieldIndexer == null) {
- estimatedFieldKeySize += estimateStringSize(fieldName);
+ estimatedFieldKeySize += StructuredDataProcessor.estimateStringSize(fieldName);
fieldIndexer = new FieldIndexer(globalDictionary);
fieldIndexers.put(fieldName, fieldIndexer);
}
@@ -120,7 +120,7 @@ public ProcessedValue> processArrayField(
final String fieldName = NestedPathFinder.toNormalizedJsonPath(fieldPath);
FieldIndexer fieldIndexer = fieldIndexers.get(fieldName);
if (fieldIndexer == null) {
- estimatedFieldKeySize += estimateStringSize(fieldName);
+ estimatedFieldKeySize += StructuredDataProcessor.estimateStringSize(fieldName);
fieldIndexer = new FieldIndexer(globalDictionary);
fieldIndexers.put(fieldName, fieldIndexer);
}
diff --git a/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java b/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java
index 18e1334af44a..e129ceb41778 100644
--- a/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java
+++ b/processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java
@@ -327,7 +327,7 @@ public static Long convertObjectToLong(
} else if (valObj instanceof Boolean) {
return Evals.asLong((Boolean) valObj);
} else if (valObj instanceof String) {
- Long ret = getExactLongFromDecimalString((String) valObj);
+ Long ret = DimensionHandlerUtils.getExactLongFromDecimalString((String) valObj);
if (reportParseExceptions && ret == null) {
final String message;
if (objectKey != null) {
@@ -518,7 +518,7 @@ public static Object convertObjectToType(
case ARRAY:
return coerceToObjectArrayWithElementCoercionFunction(
obj,
- x -> convertObjectToType(x, type.getElementType(), reportParseExceptions, fieldName)
+ x -> DimensionHandlerUtils.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 2be3966b6509..7da89edaff75 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 @@ private File multiphaseMerge(
List tempDirs = new ArrayList<>();
- if (maxColumnsToMerge == UNLIMITED_MAX_COLUMNS_TO_MERGE) {
+ if (maxColumnsToMerge == IndexMerger.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 fcf9677b0760..cf9527f43342 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 @@
*/
public class IndexSpec
{
- public static final IndexSpec DEFAULT = builder().build();
+ public static final IndexSpec DEFAULT = IndexSpec.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 1eef86db7d87..366f5d86278d 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 ProcessedValue> processField(ArrayList fieldPath, @Null
ExprEval> eval = ExprEval.bestEffortOf(fieldValue);
FieldIndexer fieldIndexer = fieldIndexers.get(fieldName);
if (fieldIndexer == null) {
- estimatedFieldKeySize += estimateStringSize(fieldName);
+ estimatedFieldKeySize += StructuredDataProcessor.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 8fff2da8f869..035e036f153f 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 void inspectRuntimeShape(RuntimeShapeInspector inspector)
@Override
public int getValueCardinality()
{
- return CARDINALITY_UNKNOWN;
+ return DimensionDictionarySelector.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 014dfe2227c1..59f0e18c0ae8 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 boolean isUnknown()
public Capable coerceUnknownToBoolean(boolean unknownIsTrue)
{
- return this == UNKNOWN ? of(unknownIsTrue) : this;
+ return this == UNKNOWN ? Capable.of(unknownIsTrue) : this;
}
public Capable and(Capable other)
@@ -146,7 +146,7 @@ public static Capable of(boolean bool)
@JsonCreator
public static Capable ofNullable(@Nullable Boolean bool)
{
- return bool == null ? UNKNOWN : of(bool);
+ return bool == null ? Capable.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 956352e1c288..f0b13a7115ea 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 static ColumnCapabilitiesImpl snapshot(@Nullable final ColumnCapabilities
*/
public static ColumnCapabilitiesImpl createDefault()
{
- return snapshot(new ColumnCapabilitiesImpl(), ALL_FALSE);
+ return ColumnCapabilitiesImpl.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 60da75855fc1..b670d8f4370f 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 static ColumnType leastRestrictiveType(@Nullable ColumnType type, @Nullab
}
// if either is nested data, use nested data, otherwise error
if (type.is(ValueType.COMPLEX) || other.is(ValueType.COMPLEX)) {
- if (NESTED_DATA.equals(type) || NESTED_DATA.equals(other)) {
- return NESTED_DATA;
+ if (ColumnType.NESTED_DATA.equals(type) || ColumnType.NESTED_DATA.equals(other)) {
+ return ColumnType.NESTED_DATA;
}
throw new Types.IncompatibleTypeException(type, other);
}
@@ -198,14 +198,14 @@ public static ColumnType leastRestrictiveType(@Nullable ColumnType type, @Nullab
(ColumnType) other.getElementType()
);
- return ofArray(commonElementType);
+ return ColumnType.ofArray(commonElementType);
} else {
commonElementType = leastRestrictiveType(
(ColumnType) type.getElementType(),
other
);
}
- return ofArray(commonElementType);
+ return ColumnType.ofArray(commonElementType);
}
if (other.isArray()) {
if (type.equals(type.getElementType())) {
@@ -217,22 +217,22 @@ public static ColumnType leastRestrictiveType(@Nullable ColumnType type, @Nullab
type,
(ColumnType) other.getElementType()
);
- return ofArray(commonElementType);
+ return ColumnType.ofArray(commonElementType);
}
// if either argument is a string, type becomes a string
if (Types.is(type, ValueType.STRING) || Types.is(other, ValueType.STRING)) {
- return STRING;
+ return ColumnType.STRING;
}
// all numbers win over longs
if (Types.is(type, ValueType.LONG) && Types.isNullOr(other, ValueType.LONG)) {
- return LONG;
+ return ColumnType.LONG;
}
// doubles win over floats
if (Types.is(type, ValueType.FLOAT) && Types.isNullOr(other, ValueType.FLOAT)) {
- return FLOAT;
+ return ColumnType.FLOAT;
}
- return DOUBLE;
+ return ColumnType.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 083e87bf5fc9..6e114ec89955 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 boolean isArray()
@Override
public boolean isPrimitive()
{
- return STRING.equals(this) || isNumeric(this);
+ return this.equals(ValueType.STRING) || isNumeric(this);
}
@Nullable
@@ -143,11 +143,11 @@ public static ValueType fromString(@Nullable String name)
public static boolean isNumeric(ValueType type)
{
- return type == LONG || type == FLOAT || type == DOUBLE;
+ return type == ValueType.LONG || type == ValueType.FLOAT || type == ValueType.DOUBLE;
}
public static boolean isArray(ValueType type)
{
- return type == ARRAY;
+ return type == ValueType.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 f2320f4bf097..55d4c2d1f883 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 byte getId()
static final Map ID_MAP = new HashMap<>();
static {
- for (LongEncodingFormat format : values()) {
+ for (LongEncodingFormat format : LongEncodingFormat.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 34eb269851a5..18ea27cc4044 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 static CompressionStrategy fromString(String name)
static final Map ID_MAP = new HashMap<>();
static {
- for (CompressionStrategy strategy : values()) {
+ for (CompressionStrategy strategy : CompressionStrategy.values()) {
ID_MAP.put(strategy.getId(), strategy);
}
}
@@ -171,7 +171,7 @@ public static CompressionStrategy forId(byte id)
// 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(values(), NONE);
+ return (CompressionStrategy[]) ArrayUtils.removeElement(CompressionStrategy.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 4adc39e87aaf..58231fd26029 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 != V0 && version != V1) {
+ if (version != FrontCodedIndexed.V0 && version != FrontCodedIndexed.V1) {
throw new IAE(
"Unknown format version for FrontCodedIndexed [%s], must be [%s] or [%s]",
version,
- V0,
- V1
+ FrontCodedIndexed.V0,
+ FrontCodedIndexed.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 a2fffd81cb8b..9c1b36720078 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 int size()
@Override
public T get(int index)
{
- checkIndex(index, 0);
+ Indexed.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 1d83e2eda11c..1c0893b4a052 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 static Filter convertToCNFFromQueryContext(Query query, @Nullable Filter
}
boolean useCNF = query.context().getBoolean(QueryContexts.USE_FILTER_CNF_KEY, QueryContexts.DEFAULT_USE_FILTER_CNF);
try {
- return useCNF ? toCnf(filter) : filter;
+ return useCNF ? Filters.toCnf(filter) : filter;
}
catch (CNFFilterExplosionException cnfFilterExplosionException) {
return filter; // cannot convert to CNF, return the filter as is
@@ -321,7 +321,7 @@ public static Optional maybeOr(final List filters)
*/
public static List toNormalizedOrClauses(Filter filter) throws CNFFilterExplosionException
{
- Filter normalizedFilter = toCnf(filter);
+ Filter normalizedFilter = Filters.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 a543f56fa9fd..344fbbb70cbf 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 void inspectRuntimeShape(RuntimeShapeInspector inspector)
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 allFalse();
+ return ValueMatchers.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 4476d70f1126..a9819fd75cb3 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 BitmapColumnIndex forSortedValues(@Nonnull List> sortedValues, TypeSign
} else {
tailSet = baseSet;
}
- if (tailSet.size() > SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) {
+ if (tailSet.size() > ValueSetIndexes.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 7750b8645449..b00af7a132f0 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 void write(MutableTypeSet types) throws IOException
byte typeByte = types.getByteValue();
// adjust for empty array if needed
if (types.hasUntypedArray()) {
- Set columnTypes = convertToSet(types.getByteValue());
+ Set columnTypes = FieldTypeInfo.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 acaa9a32c12b..88b5c240e1b0 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 @@ protected static void copyFromTempSmoosh(FileSmoosher smoosher, SmooshedFileMapp
public static void writeV0Header(WritableByteChannel channel, ByteBuffer columnNameBuffer) throws IOException
{
- channel.write(ByteBuffer.wrap(new byte[]{V0}));
+ channel.write(ByteBuffer.wrap(new byte[]{NestedCommonFormatColumnSerializer.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 f32907595536..3947013274c5 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 BitmapColumnIndex forValue(@Nullable String value)
@Override
public int estimatedComputeCost()
{
- return INDEX_COMPUTE_SCALE;
+ return NestedVariantIndexes.INDEX_COMPUTE_SCALE;
}
@Override
@@ -1357,10 +1357,10 @@ public BitmapColumnIndex forSortedValues(SortedSet values)
@Override
public int estimatedComputeCost()
{
- if (values.size() >= Integer.MAX_VALUE / INDEX_COMPUTE_SCALE) {
+ if (values.size() >= Integer.MAX_VALUE / NestedVariantIndexes.INDEX_COMPUTE_SCALE) {
return Integer.MAX_VALUE;
}
- return values.size() * INDEX_COMPUTE_SCALE;
+ return values.size() * NestedVariantIndexes.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 4c52eb2810da..8d1dd4227730 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 BitmapColumnIndex forSortedValues(@Nonnull List> sortedValues, TypeSign
final List tailSet;
final List baseSet = (List) sortedValues;
- if (sortedValues.size() >= SIZE_WORTH_CHECKING_MIN) {
+ if (sortedValues.size() >= ValueSetIndexes.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 BitmapColumnIndex forSortedValues(@Nonnull List> sortedValues, TypeSign
} else {
tailSet = baseSet;
}
- if (tailSet.size() > SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) {
+ if (tailSet.size() > ValueSetIndexes.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 1e572f6069ec..5a55a5f7c145 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 BitmapColumnIndex forSortedValues(@Nonnull List> sortedValues, TypeSign
final List tailSet;
final List baseSet = (List) sortedValues;
- if (sortedValues.size() >= SIZE_WORTH_CHECKING_MIN) {
+ if (sortedValues.size() >= ValueSetIndexes.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 BitmapColumnIndex forSortedValues(@Nonnull List> sortedValues, TypeSign
} else {
tailSet = baseSet;
}
- if (tailSet.size() > SORTED_SCAN_RATIO_THRESHOLD * dictionary.size()) {
+ if (tailSet.size() > ValueSetIndexes.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 536b562ebdaa..02e7f5b4d397 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 enum VERSION
public static VERSION fromByte(byte b)
{
- final VERSION[] values = values();
+ final VERSION[] values = VERSION.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 a9773551d2b6..dd70b3566e16 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 @@ List getArrayAsList(ExprEval evaluated)
@Override
String getArrayValue(ExprEval evaluated, int i)
{
- return extractionFn.apply(getArrayElement(evaluated, i));
+ return extractionFn.apply(ExpressionMultiValueDimensionSelector.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 88dc833a2503..b8a4e2d82f92 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,6 +26,7 @@
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;
@@ -56,7 +57,7 @@ public SingleStringInputDeferredEvaluationExpressionDimensionSelector(
)
{
// Verify selector has a working dictionary.
- if (selector.getValueCardinality() == CARDINALITY_UNKNOWN
+ if (selector.getValueCardinality() == DimensionDictionarySelector.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 47586c753b54..5a1dd4955069 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,6 +24,7 @@
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;
@@ -52,7 +53,7 @@ public SingleStringInputDeferredEvaluationExpressionDimensionVectorSelector(
)
{
// Verify selector has a working dictionary.
- if (selector.getValueCardinality() == CARDINALITY_UNKNOWN
+ if (selector.getValueCardinality() == DimensionDictionarySelector.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 b564fbdc50b7..d1fa6a349ba4 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 void configureGuice(CoreInjectorBuilder builder, List overrideMod
installForServerModules(builder);
builder.add(new QueryRunnerFactoryModule());
- overrideModules.addAll(brokerModules());
+ overrideModules.addAll(ExposedAsBrokerQueryComponentSupplierWrapper.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 dc34b25697c4..d95de9f3f764 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 QuidemRecorder(URI quidemURI, DruidHookDispatcher hookDispatcher, File fi
printStream.println("#started " + new Date());
printStream.println("!use " + quidemURI);
printStream.println("!set outputformat mysql");
- hookDispatcher.register(SQL, this);
+ hookDispatcher.register(DruidHook.SQL, this);
}
@Override
@@ -63,13 +63,13 @@ public synchronized void close()
printStream.close();
printStream = null;
}
- hookDispatcher.unregister(SQL, this);
+ hookDispatcher.unregister(DruidHook.SQL, this);
}
@Override
public synchronized void invoke(HookKey key, String query)
{
- if (SQL.equals(key)) {
+ if (DruidHook.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 88cfcc1a587a..d0ac6c31e76b 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 static List concatLists(
*/
public static String getNonBlankString(Map args, String parameter)
{
- String value = getString(args, parameter);
+ String value = CatalogUtils.getString(args, parameter);
if (value != null) {
value = value.trim();
if (value.isEmpty()) {
@@ -215,7 +215,7 @@ public static String getNonBlankString(Map args, String paramete
public static List getUriListArg(Map args, String parameter)
{
- String urisString = getString(args, parameter);
+ String urisString = CatalogUtils.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 e349ffb7ede4..297188dd9cc1 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 @@ protected void validateColumn(ColumnSpec spec)
public static boolean isDatasource(String tableType)
{
- return TABLE_TYPE.equals(tableType);
+ return DatasourceDefn.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 42abbb23f2a0..44ce7ff98246 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 DruidNodeDiscovery getForService(String serviceName)
serviceName,
service -> {
- Set nodeRolesToWatch = SERVICE_TO_NODE_TYPES.get(service);
+ Set nodeRolesToWatch = DruidNodeDiscoveryProvider.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 b243930d6191..fbec4f6219ff 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 static class QueryLogicBinder
public QueryLogicBinder(Binder binder)
{
this.binder = binder;
- queryLogicMapBinder = queryLogicBinderType(binder);
+ queryLogicMapBinder = DruidBinders.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 d7e0de4677d0..afabd0cde59a 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 String toString()
@JsonCreator
public static SortOrder fromValue(String value)
{
- for (SortOrder b : values()) {
+ for (SortOrder b : SortOrder.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(values()).map(SortOrder::toString).collect(Collectors.toList())
+ value, Arrays.stream(SortOrder.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 52b2e8379156..a0d9a5e3725c 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 BrokerClient makeBrokerClient(
clientFactory.makeClient(
NodeRole.BROKER.getJsonName(),
serviceLocator,
- StandardRetryPolicy.builder().maxAttempts(CLIENT_MAX_ATTEMPTS).build()
+ StandardRetryPolicy.builder().maxAttempts(ServiceClientModule.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 a2e6385b46f2..fd53ed38c257 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 @@ private static CompactionStatus configChanged(
Function stringFunction
)
{
- return incomplete(
+ return CompactionStatus.incomplete(
"'%s' mismatch: required[%s], current[%s]",
field,
target == null ? null : stringFunction.apply(target),
@@ -298,7 +298,7 @@ private Evaluator(
private CompactionStatus segmentsHaveBeenCompactedAtLeastOnce()
{
if (lastCompactionState == null) {
- return incomplete("not compacted yet");
+ return CompactionStatus.incomplete("not compacted yet");
} else {
return COMPLETE;
}
@@ -312,7 +312,7 @@ private CompactionStatus allCandidatesHaveSameCompactionState()
if (allHaveSameCompactionState) {
return COMPLETE;
} else {
- return incomplete("segments have different last compaction states");
+ return CompactionStatus.incomplete("segments have different last compaction states");
}
}
@@ -322,7 +322,7 @@ private CompactionStatus partitionsSpecIsUpToDate()
if (existingPartionsSpec instanceof DimensionRangePartitionsSpec) {
existingPartionsSpec = getEffectiveRangePartitionsSpec((DimensionRangePartitionsSpec) existingPartionsSpec);
}
- return completeIfEqual(
+ return CompactionStatus.completeIfEqual(
"partitionsSpec",
findPartitionsSpecFromConfig(tuningConfig),
existingPartionsSpec,
@@ -332,7 +332,7 @@ private CompactionStatus partitionsSpecIsUpToDate()
private CompactionStatus indexSpecIsUpToDate()
{
- return completeIfEqual(
+ return CompactionStatus.completeIfEqual(
"indexSpec",
Configs.valueOrDefault(tuningConfig.getIndexSpec(), IndexSpec.DEFAULT),
objectMapper.convertValue(lastCompactionState.getIndexSpec(), IndexSpec.class),
@@ -360,13 +360,13 @@ private CompactionStatus segmentGranularityIsUpToDate()
segment -> !configuredSegmentGranularity.isAligned(segment.getInterval())
);
if (needsCompaction) {
- return incomplete(
+ return CompactionStatus.incomplete(
"segmentGranularity: segments do not align with target[%s]",
asString(configuredSegmentGranularity)
);
}
} else {
- return configChanged(
+ return CompactionStatus.configChanged(
"segmentGranularity",
configuredSegmentGranularity,
existingSegmentGranularity,
@@ -382,7 +382,7 @@ private CompactionStatus rollupIsUpToDate()
if (configuredGranularitySpec == null) {
return COMPLETE;
} else {
- return completeIfEqual(
+ return CompactionStatus.completeIfEqual(
"rollup",
configuredGranularitySpec.isRollup(),
existingGranularitySpec == null ? null : existingGranularitySpec.isRollup(),
@@ -396,7 +396,7 @@ private CompactionStatus queryGranularityIsUpToDate()
if (configuredGranularitySpec == null) {
return COMPLETE;
} else {
- return completeIfEqual(
+ return CompactionStatus.completeIfEqual(
"queryGranularity",
configuredGranularitySpec.getQueryGranularity(),
existingGranularitySpec == null ? null : existingGranularitySpec.getQueryGranularity(),
@@ -426,7 +426,7 @@ private CompactionStatus dimensionsSpecIsUpToDate()
compactionConfig.getTuningConfig() == null ? null : compactionConfig.getTuningConfig().getPartitionsSpec()
);
{
- return completeIfEqual(
+ return CompactionStatus.completeIfEqual(
"dimensionsSpec",
configuredDimensions,
existingDimensions,
@@ -449,7 +449,7 @@ private CompactionStatus metricsSpecIsUpToDate()
? null : objectMapper.convertValue(metricSpecList, AggregatorFactory[].class);
if (existingMetricsSpec == null || !Arrays.deepEquals(configuredMetricsSpec, existingMetricsSpec)) {
- return configChanged(
+ return CompactionStatus.configChanged(
"metricsSpec",
configuredMetricsSpec,
existingMetricsSpec,
@@ -470,7 +470,7 @@ private CompactionStatus transformSpecFilterIsUpToDate()
lastCompactionState.getTransformSpec(),
ClientCompactionTaskTransformSpec.class
);
- return completeIfEqual(
+ return CompactionStatus.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 28d83adab5b9..3a11027311e6 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 static BroadcastDatasourceLoadingSpec createFromContext(Map(broadcastDatasourcesToLoad));
+ return BroadcastDatasourceLoadingSpec.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 829a662d1af4..59d6f6bcc61b 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 static ServerType fromNodeRole(NodeRole nodeRole)
{
// this doesn't actually check that the NodeRole is a typical data node
if (nodeRole.equals(NodeRole.HISTORICAL)) {
- return HISTORICAL;
+ return ServerType.HISTORICAL;
} else if (nodeRole.equals(NodeRole.BROKER)) {
- return BROKER;
+ return ServerType.BROKER;
} else {
- return INDEXER_EXECUTOR;
+ return ServerType.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 a84d63ebe76c..01c7da44c116 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,8 +70,10 @@ public static int computeNumSegmentsToMoveInTier(
).sum();
// Move at least some segments to ensure that the cluster is always balancing itself
- final int minSegmentsToMove = computeMinSegmentsToMoveInTier(totalSegments);
- final int segmentsToMoveToFixDeviation = computeNumSegmentsToMoveToBalanceTier(tier, historicals);
+ final int minSegmentsToMove = SegmentToMoveCalculator
+ .computeMinSegmentsToMoveInTier(totalSegments);
+ final int segmentsToMoveToFixDeviation = SegmentToMoveCalculator
+ .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 6a76ebc89ff6..297e86f38984 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 static HostAndPortWithScheme fromString(String hostPortMaybeSchemeString)
if (colonIndex == -1) {
throw new IAE("Invalid host with scheme string: [%s]", hostPortMaybeSchemeString);
}
- return fromString(
+ return HostAndPortWithScheme.fromString(
hostPortMaybeSchemeString.substring(0, colonIndex),
hostPortMaybeSchemeString.substring(colonIndex + 1)
);
}
- return fromString("http", hostPortMaybeSchemeString);
+ return HostAndPortWithScheme.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 b6d79e930f41..2f12ff2402c8 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 static void deduplicateHeadersInProxyServlet(
final Response serverResponse
)
{
- for (final String headerName : STANDARD_HEADERS) {
+ for (final String headerName : StandardResponseHeaderFilterHolder.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 2d798e657ea0..4665bdd18cf4 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 static LookupLoadingSpec createFromContext(Map context, L
if (lookupsToLoad == null || lookupsToLoad.isEmpty()) {
throw InvalidInput.exception("Set of lookups to load cannot be %s for mode[ONLY_REQUIRED].", lookupsToLoad);
}
- return loadOnly(new HashSet<>(lookupsToLoad));
+ return LookupLoadingSpec.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 fd06b3adb830..25e124c19837 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 static Map extractDimensions(Properties props, List dimensionsMap = new HashMap<>();
for (String property : props.stringPropertyNames()) {
- if (property.startsWith(METRIC_DIMENSION_PREFIX)) {
- String dimension = property.substring(METRIC_DIMENSION_PREFIX.length());
+ if (property.startsWith(MonitorsConfig.METRIC_DIMENSION_PREFIX)) {
+ String dimension = property.substring(MonitorsConfig.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 af0ba920a85e..431819da8a42 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 static Map> filterAuthorizedRes
throw new ISE("Request already had authorization check.");
}
- final AuthenticationResult authenticationResult = authenticationResultFromRequest(request);
+ final AuthenticationResult authenticationResult = AuthorizationUtils.authenticationResultFromRequest(request);
Map> filteredResources = new HashMap<>();
for (Map.Entry> entry : unfilteredResources.entrySet()) {
@@ -413,7 +413,7 @@ public static Map> filterAuthorizedRes
}
final List filteredList = Lists.newArrayList(
- filterAuthorizedResources(
+ AuthorizationUtils.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 af57df6f562c..c26fe21c6922 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 RelOptCost makeCost(double dRows, double dCpu, double dIo)
@Override
public RelOptCost makeHugeCost()
{
- return HUGE;
+ return DruidVolcanoCost.HUGE;
}
@Override
public RelOptCost makeInfiniteCost()
{
- return INFINITY;
+ return DruidVolcanoCost.INFINITY;
}
@Override
public RelOptCost makeTinyCost()
{
- return TINY;
+ return DruidVolcanoCost.TINY;
}
@Override
public RelOptCost makeZeroCost()
{
- return ZERO;
+ return DruidVolcanoCost.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 eb8fbd502001..4f29b276a544 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 @@ private static AggregatorFactory createMaxAggregatorFactory(
default:
// This error refers to the Druid type. But, we're in SQL validation.
// It should refer to the SQL type.
- throw badTypeException(fieldName, "MAX", aggregationType);
+ throw SimpleSqlAggregator.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 4d83c64da526..93b87d376b52 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 @@ private static AggregatorFactory createMinAggregatorFactory(
case DOUBLE:
return new DoubleMinAggregatorFactory(name, fieldName, null, macroTable);
default:
- throw badTypeException(fieldName, "MIN", aggregationType);
+ throw SimpleSqlAggregator.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 e7244f463860..29790ab7154a 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 @@ static AggregatorFactory createSumAggregatorFactory(
case DOUBLE:
return new DoubleSumAggregatorFactory(name, fieldName, null, macroTable);
default:
- throw badTypeException(fieldName, "SUM", aggregationType);
+ throw SimpleSqlAggregator.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 99a446c270c5..a52ce5707c14 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 DefaultOperandTypeChecker build()
operandNames,
operandTypes,
computedRequiredOperandCount,
- buildNullableOperands(computedRequiredOperandCount, operandTypes.size(), notNullOperands),
+ DefaultOperandTypeChecker.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 5d58988dda54..413d75fbc6dc 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 CollectSelectors(final List orExprs, final RowSignature source
@Override
protected Pair> getCollectibleComparison(DimFilter filter)
{
- return splitAnd(
+ return ConvertSelectorsToIns.splitAnd(
filter,
SelectorDimFilter.class,
@@ -217,7 +217,7 @@ public CollectEqualities(final List orExprs)
@Override
protected Pair> getCollectibleComparison(DimFilter filter)
{
- return splitAnd(
+ return ConvertSelectorsToIns.splitAnd(
filter,
EqualityFilter.class,
@@ -275,7 +275,7 @@ public CollectEqualitiesDefaultValueMode(final List orExprs)
@Override
protected Pair> getCollectibleComparison(DimFilter filter)
{
- return splitAnd(
+ return ConvertSelectorsToIns.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 08a5df39d98c..f8b5cdabb769 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
@@ -278,7 +278,7 @@ public List programs(final PlannerContext plannerContext)
private Program buildDecoupledLogicalOptimizationProgram(PlannerContext plannerContext)
{
final HepProgramBuilder builder = HepProgram.builder();
- builder.addMatchLimit(HEP_DEFAULT_MATCH_LIMIT);
+ builder.addMatchLimit(CalciteRulesManager.HEP_DEFAULT_MATCH_LIMIT);
builder.addRuleCollection(baseRuleSet(plannerContext));
builder.addRuleInstance(CoreRules.UNION_MERGE);
builder.addRuleInstance(JoinExtractFilterRule.Config.DEFAULT.toRule());
@@ -331,7 +331,7 @@ private Program sqlToRelWorkaroundProgram()
private Program buildPreVolcanoManipulationProgram(final PlannerContext plannerContext)
{
final HepProgramBuilder builder = HepProgram.builder();
- builder.addMatchLimit(HEP_DEFAULT_MATCH_LIMIT);
+ builder.addMatchLimit(CalciteRulesManager.HEP_DEFAULT_MATCH_LIMIT);
// Apply FILTER_INTO_JOIN early, if using a join algorithm that requires subqueries anyway.
if (plannerContext.getJoinAlgorithm().requiresSubquery()) {
@@ -351,7 +351,7 @@ private Program buildPreVolcanoManipulationProgram(final PlannerContext plannerC
private Program buildReductionProgram(final PlannerContext plannerContext, final boolean isDruid)
{
final HepProgramBuilder builder = HepProgram.builder();
- builder.addMatchLimit(HEP_DEFAULT_MATCH_LIMIT);
+ builder.addMatchLimit(CalciteRulesManager.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 32e74887bf2d..6310b23543de 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 static RelDataType createSqlTypeWithNullability(
case VARCHAR:
dataType = typeFactory.createTypeWithCharsetAndCollation(
typeFactory.createSqlType(typeName),
- defaultCharset(),
+ Calcites.defaultCharset(),
SqlCollation.IMPLICIT
);
break;
@@ -566,7 +566,7 @@ public RelDataType inferReturnType(SqlOperatorBinding opBinding)
if (SqlTypeUtil.isArray(type)) {
return type;
}
- return createSqlArrayTypeWithNullability(
+ return Calcites.createSqlArrayTypeWithNullability(
opBinding.getTypeFactory(),
type.getSqlTypeName(),
true
@@ -583,7 +583,7 @@ public RelDataType inferReturnType(SqlOperatorBinding opBinding)
if (SqlTypeUtil.isArray(type)) {
return type;
}
- return createSqlArrayTypeWithNullability(
+ return Calcites.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 6d1cd1243e21..0fb1c9fb9ff0 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 static boolean isFunctionSyntax(final SqlSyntax syntax)
private static SqlSyntax normalizeSyntax(final SqlSyntax syntax)
{
- if (!isFunctionSyntax(syntax)) {
+ if (!DruidOperatorTable.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 1041269090d4..521291c3244d 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 @@
public class DruidTypeSystem implements RelDataTypeSystem
{
public static final DruidTypeSystem INSTANCE = new DruidTypeSystem();
- public static final RelDataTypeFactory TYPE_FACTORY = new SqlTypeFactoryImpl(INSTANCE);
+ public static final RelDataTypeFactory TYPE_FACTORY = new SqlTypeFactoryImpl(DruidTypeSystem.INSTANCE);
/**
* Druid uses millisecond precision for timestamps internally. This is also the default at the SQL layer.
@@ -43,7 +43,7 @@ private DruidTypeSystem()
@Override
public int getMaxScale(final SqlTypeName typeName)
{
- return DEFAULT.getMaxScale(typeName);
+ return RelDataTypeSystem.DEFAULT.getMaxScale(typeName);
}
@Override
@@ -54,7 +54,7 @@ public int getDefaultPrecision(final SqlTypeName typeName)
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
return DEFAULT_TIMESTAMP_PRECISION;
default:
- return DEFAULT.getDefaultPrecision(typeName);
+ return RelDataTypeSystem.DEFAULT.getDefaultPrecision(typeName);
}
}
@@ -64,44 +64,44 @@ public int getMaxPrecision(final SqlTypeName typeName)
if (typeName == SqlTypeName.TIME || typeName == SqlTypeName.TIMESTAMP) {
return DEFAULT_TIMESTAMP_PRECISION;
} else {
- return DEFAULT.getMaxPrecision(typeName);
+ return RelDataTypeSystem.DEFAULT.getMaxPrecision(typeName);
}
}
@Override
public int getMaxNumericScale()
{
- return DEFAULT.getMaxNumericScale();
+ return RelDataTypeSystem.DEFAULT.getMaxNumericScale();
}
@Override
public int getMaxNumericPrecision()
{
- return DEFAULT.getMaxNumericPrecision();
+ return RelDataTypeSystem.DEFAULT.getMaxNumericPrecision();
}
@Override
public String getLiteral(final SqlTypeName typeName, final boolean isPrefix)
{
- return DEFAULT.getLiteral(typeName, isPrefix);
+ return RelDataTypeSystem.DEFAULT.getLiteral(typeName, isPrefix);
}
@Override
public boolean isCaseSensitive(final SqlTypeName typeName)
{
- return DEFAULT.isCaseSensitive(typeName);
+ return RelDataTypeSystem.DEFAULT.isCaseSensitive(typeName);
}
@Override
public boolean isAutoincrement(final SqlTypeName typeName)
{
- return DEFAULT.isAutoincrement(typeName);
+ return RelDataTypeSystem.DEFAULT.isAutoincrement(typeName);
}
@Override
public int getNumTypeRadix(final SqlTypeName typeName)
{
- return DEFAULT.getNumTypeRadix(typeName);
+ return RelDataTypeSystem.DEFAULT.getNumTypeRadix(typeName);
}
@Override
@@ -132,25 +132,25 @@ public RelDataType deriveCovarType(
final RelDataType arg1Type
)
{
- return DEFAULT.deriveCovarType(typeFactory, arg0Type, arg1Type);
+ return RelDataTypeSystem.DEFAULT.deriveCovarType(typeFactory, arg0Type, arg1Type);
}
@Override
public RelDataType deriveFractionalRankType(final RelDataTypeFactory typeFactory)
{
- return DEFAULT.deriveFractionalRankType(typeFactory);
+ return RelDataTypeSystem.DEFAULT.deriveFractionalRankType(typeFactory);
}
@Override
public RelDataType deriveRankType(final RelDataTypeFactory typeFactory)
{
- return DEFAULT.deriveRankType(typeFactory);
+ return RelDataTypeSystem.DEFAULT.deriveRankType(typeFactory);
}
@Override
public boolean isSchemaCaseSensitive()
{
- return DEFAULT.isSchemaCaseSensitive();
+ return RelDataTypeSystem.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 dbc2be0b0910..589d68d43055 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 Map getNonDefaultAsQueryContext()
);
}
- PlannerConfig newConfig = builder().withOverrides(overrides).build();
+ PlannerConfig newConfig = PlannerConfig.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 dbdc79883da0..8bcf1544fc89 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 Grouping applyProject(final PlannerContext plannerContext, final Project
newSubtotals = subtotals;
}
- return create(
+ return Grouping.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 d4dbd674d862..27a027d0abd6 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 @@ static void writeHeader(
if (includeTypes) {
jsonGenerator.writeStringField(
- TYPE_HEADER_NAME,
+ ObjectWriter.TYPE_HEADER_NAME,
signature.getColumnType(i).map(TypeSignature::asTypeString).orElse(null)
);
}
if (includeSqlTypes) {
jsonGenerator.writeStringField(
- SQL_TYPE_HEADER_NAME,
+ ObjectWriter.SQL_TYPE_HEADER_NAME,
rowType.getFieldList().get(i).getType().getSqlTypeName().getName()
);
}
@@ -162,7 +162,7 @@ static void writeHeader(
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField(
- TYPE_HEADER_NAME,
+ ObjectWriter.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 9af6e15e0357..d957e7155b5e 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 SqlResourceQueryResultPusher(
jsonMapper,
responseContextConfig,
selfNode,
- QUERY_METRIC_COUNTER,
+ SqlResource.QUERY_METRIC_COUNTER,
sqlQueryId,
MediaType.APPLICATION_JSON_TYPE,
headers