diff --git a/codestyle/spotbugs-exclude.xml b/codestyle/spotbugs-exclude.xml
index b35b138d3df..ef0c139f322 100644
--- a/codestyle/spotbugs-exclude.xml
+++ b/codestyle/spotbugs-exclude.xml
@@ -46,7 +46,10 @@
+
+
+
@@ -56,6 +59,12 @@
+
+
+
+
+
+
diff --git a/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java b/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java
index 7f07b5a960f..39b55596ca0 100644
--- a/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java
+++ b/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java
@@ -90,7 +90,6 @@ public class EmitterTest
return builder;
}
-
MockHttpClient httpClient;
HttpPostEmitter emitter;
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java
index 8e60639513b..b1e911497b5 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java
@@ -164,7 +164,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
CompactionState expectedState = new CompactionState(
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
@@ -211,7 +210,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
Assert.assertSame(HashBasedNumberedShardSpec.class, segment.getShardSpec().getClass());
CompactionState expectedState = new CompactionState(
new HashedPartitionsSpec(null, 3, null),
@@ -259,7 +257,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
Assert.assertSame(SingleDimensionShardSpec.class, segment.getShardSpec().getClass());
CompactionState expectedState = new CompactionState(
new SingleDimensionPartitionsSpec(7, null, "dim", false),
@@ -310,7 +307,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
Assert.assertSame(DimensionRangeShardSpec.class, segment.getShardSpec().getClass());
CompactionState expectedState = new CompactionState(
new DimensionRangePartitionsSpec(7, null, Arrays.asList("dim1", "dim2"), false),
@@ -358,7 +354,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
Assert.assertSame(SingleDimensionShardSpec.class, segment.getShardSpec().getClass());
CompactionState expectedState = new CompactionState(
new SingleDimensionPartitionsSpec(7, null, "dim", false),
@@ -409,7 +404,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
Assert.assertSame(DimensionRangeShardSpec.class, segment.getShardSpec().getClass());
CompactionState expectedState = new CompactionState(
new DimensionRangePartitionsSpec(7, null, Arrays.asList("dim1", "dim2"), false),
@@ -490,7 +484,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
CompactionState expectedState = new CompactionState(
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
@@ -545,7 +538,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
CompactionState expectedState = new CompactionState(
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunTest.java
index dfcee9b7e7a..7652a043ada 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunTest.java
@@ -202,7 +202,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
return new CompactionState(
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
@@ -355,7 +354,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
CompactionState expectedState = new CompactionState(
new HashedPartitionsSpec(null, 3, null),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
@@ -648,7 +646,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
CompactionState expectedCompactionState = new CompactionState(
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
@@ -710,7 +707,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
expectedLongSumMetric.put("type", "longSum");
expectedLongSumMetric.put("name", "val");
expectedLongSumMetric.put("fieldName", "val");
- expectedLongSumMetric.put("expression", null);
CompactionState expectedCompactionState = new CompactionState(
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java
index 808dcce8821..2be0cc65411 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/RemoteTaskRunnerTest.java
@@ -115,9 +115,6 @@ public class RemoteTaskRunnerTest
}
};
-
-
-
@Rule
public final TestRule timeout = new DeadlockDetectingTimeout(60, TimeUnit.SECONDS);
diff --git a/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java b/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java
index edfe3873659..be953775fda 100644
--- a/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java
+++ b/integration-tests/src/test/java/org/apache/druid/tests/coordinator/duty/ITAutoCompactionTest.java
@@ -117,7 +117,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
@BeforeMethod
public void setup() throws Exception
{
- // Set comapction slot to 5
+ // Set compaction slot to 5
updateCompactionTaskSlot(0.5, 10, null);
fullDatasourceName = "wikipedia_index_test_" + UUID.randomUUID() + config.getExtraDatasourceNameSuffix();
}
@@ -458,8 +458,8 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
fullDatasourceName,
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
0,
- 14906,
- 14905,
+ 14762,
+ 14761,
0,
2,
2,
@@ -476,7 +476,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
fullDatasourceName,
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
0,
- 23372,
+ 23156,
0,
0,
3,
@@ -592,8 +592,8 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
getAndAssertCompactionStatus(
fullDatasourceName,
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
- 14906,
- 14905,
+ 14762,
+ 14761,
0,
2,
2,
@@ -601,7 +601,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
1,
1,
0);
- Assert.assertEquals(compactionResource.getCompactionProgress(fullDatasourceName).get("remainingSegmentSize"), "14906");
+ Assert.assertEquals(compactionResource.getCompactionProgress(fullDatasourceName).get("remainingSegmentSize"), "14762");
// Run compaction again to compact the remaining day
// Remaining day compacted (1 new segment). Now both days compacted (2 total)
forceTriggerAutoCompaction(2);
@@ -612,7 +612,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
fullDatasourceName,
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
0,
- 23372,
+ 23156,
0,
0,
3,
@@ -645,7 +645,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
// Four data segments (two months) and 10 tombstones for remaining months
// 3d compaction: SEMESTER: 5 rows @ 2013-08-31 (two segments), 5 rows @ 2013-09-01 (two segments),
// 2 compactions were generated for year 2013; one for each semester to be compacted of the whole year.
- //
+ //
loadData(INDEX_TASK);
try (final Closeable ignored = unloader(fullDatasourceName)) {
diff --git a/processing/src/main/java/org/apache/druid/query/BaseQuery.java b/processing/src/main/java/org/apache/druid/query/BaseQuery.java
index 794dfc204bf..bc45380d265 100644
--- a/processing/src/main/java/org/apache/druid/query/BaseQuery.java
+++ b/processing/src/main/java/org/apache/druid/query/BaseQuery.java
@@ -19,6 +19,8 @@
package org.apache.druid.query;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
@@ -101,6 +103,7 @@ public abstract class BaseQuery implements Query
@JsonProperty
@Override
+ @JsonInclude(Include.NON_DEFAULT)
public boolean isDescending()
{
return descending;
@@ -165,6 +168,7 @@ public abstract class BaseQuery implements Query
@Override
@JsonProperty
+ @JsonInclude(Include.NON_DEFAULT)
public Map getContext()
{
return context.getMergedParams();
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 8d16c0aaf82..a6206bc4619 100644
--- a/processing/src/main/java/org/apache/druid/query/JoinDataSource.java
+++ b/processing/src/main/java/org/apache/druid/query/JoinDataSource.java
@@ -21,6 +21,8 @@ package org.apache.druid.query;
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@@ -33,6 +35,7 @@ import org.apache.druid.segment.join.JoinPrefixUtils;
import org.apache.druid.segment.join.JoinType;
import javax.annotation.Nullable;
+
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@@ -176,6 +179,7 @@ public class JoinDataSource implements DataSource
@JsonProperty
@Nullable
+ @JsonInclude(Include.NON_NULL)
public DimFilter getLeftFilter()
{
return leftFilter;
diff --git a/processing/src/main/java/org/apache/druid/query/QueryDataSource.java b/processing/src/main/java/org/apache/druid/query/QueryDataSource.java
index c0571d98bc7..475368112c0 100644
--- a/processing/src/main/java/org/apache/druid/query/QueryDataSource.java
+++ b/processing/src/main/java/org/apache/druid/query/QueryDataSource.java
@@ -34,7 +34,7 @@ import java.util.Set;
public class QueryDataSource implements DataSource
{
@JsonProperty
- private final Query query;
+ private final Query> query;
@JsonCreator
public QueryDataSource(@JsonProperty("query") Query query)
diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregatorFactory.java b/processing/src/main/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregatorFactory.java
index 8fcb7f3bc08..588e45db3d3 100644
--- a/processing/src/main/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregatorFactory.java
+++ b/processing/src/main/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregatorFactory.java
@@ -21,6 +21,7 @@ package org.apache.druid.query.aggregation;
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
@@ -204,6 +205,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
@JsonProperty
@Nullable
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
public Set getFields()
{
return fields;
@@ -211,6 +213,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
@JsonProperty
@Nullable
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getAccumulatorIdentifier()
{
return accumulatorId;
@@ -260,6 +263,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
@JsonProperty("compare")
@Nullable
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getCompareExpressionString()
{
return compareExpressionString;
@@ -267,6 +271,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
@JsonProperty("finalize")
@Nullable
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getFinalizeExpressionString()
{
return finalizeExpressionString;
diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/PostAggregator.java b/processing/src/main/java/org/apache/druid/query/aggregation/PostAggregator.java
index 399947afb34..09435853120 100644
--- a/processing/src/main/java/org/apache/druid/query/aggregation/PostAggregator.java
+++ b/processing/src/main/java/org/apache/druid/query/aggregation/PostAggregator.java
@@ -19,6 +19,8 @@
package org.apache.druid.query.aggregation;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.druid.guice.annotations.ExtensionPoint;
import org.apache.druid.java.util.common.Cacheable;
import org.apache.druid.segment.ColumnInspector;
@@ -45,6 +47,7 @@ public interface PostAggregator extends Cacheable
Object compute(Map combinedAggregators);
@Nullable
+ @JsonInclude(Include.NON_NULL)
String getName();
/**
diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/SimpleDoubleAggregatorFactory.java b/processing/src/main/java/org/apache/druid/query/aggregation/SimpleDoubleAggregatorFactory.java
index 5ab0c305be9..324a10bb4d1 100644
--- a/processing/src/main/java/org/apache/druid/query/aggregation/SimpleDoubleAggregatorFactory.java
+++ b/processing/src/main/java/org/apache/druid/query/aggregation/SimpleDoubleAggregatorFactory.java
@@ -20,6 +20,7 @@
package org.apache.druid.query.aggregation;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
@@ -234,6 +235,7 @@ public abstract class SimpleDoubleAggregatorFactory extends NullableNumericAggre
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getFieldName()
{
return fieldName;
@@ -241,6 +243,7 @@ public abstract class SimpleDoubleAggregatorFactory extends NullableNumericAggre
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getExpression()
{
return expression;
diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/SimpleFloatAggregatorFactory.java b/processing/src/main/java/org/apache/druid/query/aggregation/SimpleFloatAggregatorFactory.java
index 23fb08c7bf8..7633d39d972 100644
--- a/processing/src/main/java/org/apache/druid/query/aggregation/SimpleFloatAggregatorFactory.java
+++ b/processing/src/main/java/org/apache/druid/query/aggregation/SimpleFloatAggregatorFactory.java
@@ -20,6 +20,7 @@
package org.apache.druid.query.aggregation;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
@@ -212,6 +213,7 @@ public abstract class SimpleFloatAggregatorFactory extends NullableNumericAggreg
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getFieldName()
{
return fieldName;
@@ -219,6 +221,7 @@ public abstract class SimpleFloatAggregatorFactory extends NullableNumericAggreg
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getExpression()
{
return expression;
diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/SimpleLongAggregatorFactory.java b/processing/src/main/java/org/apache/druid/query/aggregation/SimpleLongAggregatorFactory.java
index dcaffe95aa1..e01b61ad348 100644
--- a/processing/src/main/java/org/apache/druid/query/aggregation/SimpleLongAggregatorFactory.java
+++ b/processing/src/main/java/org/apache/druid/query/aggregation/SimpleLongAggregatorFactory.java
@@ -20,6 +20,7 @@
package org.apache.druid.query.aggregation;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
@@ -38,6 +39,7 @@ import org.apache.druid.segment.vector.VectorColumnSelectorFactory;
import org.apache.druid.segment.vector.VectorValueSelector;
import javax.annotation.Nullable;
+
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -215,6 +217,7 @@ public abstract class SimpleLongAggregatorFactory extends NullableNumericAggrega
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getFieldName()
{
return fieldName;
@@ -222,6 +225,7 @@ public abstract class SimpleLongAggregatorFactory extends NullableNumericAggrega
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getExpression()
{
return expression;
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 d428a2ba63e..d79682dbff5 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
@@ -20,6 +20,8 @@
package org.apache.druid.query.aggregation.post;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import org.apache.druid.common.config.NullHandling;
@@ -33,6 +35,7 @@ import org.apache.druid.segment.ColumnInspector;
import org.apache.druid.segment.column.ColumnType;
import javax.annotation.Nullable;
+
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@@ -169,6 +172,7 @@ public class ArithmeticPostAggregator implements PostAggregator
}
@JsonProperty("ordering")
+ @JsonInclude(Include.NON_NULL)
public String getOrdering()
{
return ordering;
diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/post/ExpressionPostAggregator.java b/processing/src/main/java/org/apache/druid/query/aggregation/post/ExpressionPostAggregator.java
index d3fa29b622a..4291a6e40a9 100644
--- a/processing/src/main/java/org/apache/druid/query/aggregation/post/ExpressionPostAggregator.java
+++ b/processing/src/main/java/org/apache/druid/query/aggregation/post/ExpressionPostAggregator.java
@@ -21,6 +21,7 @@ package org.apache.druid.query.aggregation.post;
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
@@ -213,6 +214,7 @@ public class ExpressionPostAggregator implements PostAggregator
@Nullable
@JsonProperty("ordering")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getOrdering()
{
return ordering;
diff --git a/processing/src/main/java/org/apache/druid/query/filter/BoundDimFilter.java b/processing/src/main/java/org/apache/druid/query/filter/BoundDimFilter.java
index 51ce29378a0..1e317c5fbcc 100644
--- a/processing/src/main/java/org/apache/druid/query/filter/BoundDimFilter.java
+++ b/processing/src/main/java/org/apache/druid/query/filter/BoundDimFilter.java
@@ -132,6 +132,7 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getUpper()
{
return upper;
@@ -139,18 +140,21 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getLower()
{
return lower;
}
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
public boolean isLowerStrict()
{
return lowerStrict;
}
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
public boolean isUpperStrict()
{
return upperStrict;
@@ -168,6 +172,7 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public ExtractionFn getExtractionFn()
{
return extractionFn;
@@ -374,7 +379,7 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
try {
lowerLongBound = lowerBigDecimal.longValueExact();
hasLowerLongBound = true;
- }
+ }
catch (ArithmeticException ae) { // the BigDecimal can't be contained in a long
hasLowerLongBound = false;
lowerLongBound = 0L;
@@ -452,7 +457,7 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
BigDecimal convertedBD;
try {
convertedBD = new BigDecimal(floatStr);
- }
+ }
catch (NumberFormatException nfe) {
return null;
}
@@ -470,7 +475,7 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
BigDecimal convertedBD;
try {
convertedBD = new BigDecimal(floatStr);
- }
+ }
catch (NumberFormatException nfe) {
return null;
}
diff --git a/processing/src/main/java/org/apache/druid/query/filter/SelectorDimFilter.java b/processing/src/main/java/org/apache/druid/query/filter/SelectorDimFilter.java
index 340943a0842..5d8e56774c2 100644
--- a/processing/src/main/java/org/apache/druid/query/filter/SelectorDimFilter.java
+++ b/processing/src/main/java/org/apache/druid/query/filter/SelectorDimFilter.java
@@ -34,6 +34,7 @@ import org.apache.druid.segment.filter.DimensionPredicateFilter;
import org.apache.druid.segment.filter.SelectorFilter;
import javax.annotation.Nullable;
+
import java.util.Objects;
import java.util.Set;
@@ -116,6 +117,9 @@ public class SelectorDimFilter extends AbstractOptimizableDimFilter implements D
return dimension;
}
+ /**
+ * Value to filter against. If {@code null}, then the meaning is `is null`.
+ */
@Nullable
@JsonProperty
public String getValue()
@@ -125,14 +129,15 @@ public class SelectorDimFilter extends AbstractOptimizableDimFilter implements D
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public ExtractionFn getExtractionFn()
{
return extractionFn;
}
@Nullable
- @JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public FilterTuning getFilterTuning()
{
return filterTuning;
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 0493145cf31..17a30f732f5 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
@@ -73,6 +73,7 @@ import org.joda.time.DateTime;
import org.joda.time.Interval;
import javax.annotation.Nullable;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -271,6 +272,7 @@ public class GroupByQuery extends BaseQuery
@JsonProperty
@Override
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
public VirtualColumns getVirtualColumns()
{
return virtualColumns;
@@ -278,6 +280,7 @@ public class GroupByQuery extends BaseQuery
@Nullable
@JsonProperty("filter")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public DimFilter getDimFilter()
{
return dimFilter;
@@ -290,18 +293,21 @@ public class GroupByQuery extends BaseQuery
}
@JsonProperty("aggregations")
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
public List getAggregatorSpecs()
{
return aggregatorSpecs;
}
@JsonProperty("postAggregations")
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
public List getPostAggregatorSpecs()
{
return postAggregatorSpecs;
}
@JsonProperty("having")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public HavingSpec getHavingSpec()
{
return havingSpec;
@@ -313,9 +319,12 @@ public class GroupByQuery extends BaseQuery
return limitSpec;
}
- @JsonInclude(JsonInclude.Include.NON_NULL)
- @JsonProperty("subtotalsSpec")
+ /**
+ * Subtotals spec may be empty which has a distinct meaning from {@code null}.
+ */
@Nullable
+ @JsonProperty("subtotalsSpec")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public List> getSubtotalsSpec()
{
return subtotalsSpec;
diff --git a/processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java b/processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java
index c52c14bae75..335b220b74d 100644
--- a/processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java
+++ b/processing/src/main/java/org/apache/druid/query/groupby/orderby/DefaultLimitSpec.java
@@ -156,7 +156,7 @@ public class DefaultLimitSpec implements LimitSpec
/**
* Limit for this query; behaves like SQL "LIMIT". Will always be positive. {@link Integer#MAX_VALUE} is used in
- * situations where the user wants an effectively unlimited resultset.
+ * situations where the user wants an effectively unlimited result set.
*/
@JsonProperty
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = LimitJsonIncludeFilter.class)
@@ -580,24 +580,16 @@ public class DefaultLimitSpec implements LimitSpec
/**
* {@link JsonInclude} filter for {@link #getLimit()}.
*
- * This API works by "creative" use of equals. It requires warnings to be suppressed and also requires spotbugs
- * exclusions (see spotbugs-exclude.xml).
+ * This API works by "creative" use of equals. It requires warnings to be suppressed
+ * and also requires spotbugs exclusions (see spotbugs-exclude.xml).
*/
@SuppressWarnings({"EqualsAndHashcode", "EqualsHashCode"})
- static class LimitJsonIncludeFilter // lgtm [java/inconsistent-equals-and-hashcode]
+ public static class LimitJsonIncludeFilter // lgtm [java/inconsistent-equals-and-hashcode]
{
@Override
public boolean equals(Object obj)
{
- if (obj == null) {
- return false;
- }
-
- if (obj.getClass() == this.getClass()) {
- return true;
- }
-
- return obj instanceof Long && (long) obj == Long.MAX_VALUE;
+ return obj instanceof Integer && (Integer) obj == Integer.MAX_VALUE;
}
}
}
diff --git a/processing/src/main/java/org/apache/druid/query/planning/DataSourceAnalysis.java b/processing/src/main/java/org/apache/druid/query/planning/DataSourceAnalysis.java
index eb4ca04f260..c329e3a5708 100644
--- a/processing/src/main/java/org/apache/druid/query/planning/DataSourceAnalysis.java
+++ b/processing/src/main/java/org/apache/druid/query/planning/DataSourceAnalysis.java
@@ -117,7 +117,7 @@ public class DataSourceAnalysis
if (!(subQuery instanceof BaseQuery)) {
// We must verify that the subQuery is a BaseQuery, because it is required to make "getBaseQuerySegmentSpec"
- // work properly. All builtin query types are BaseQuery, so we only expect this with funky extension queries.
+ // work properly. All built-in query types are BaseQuery, so we only expect this with funky extension queries.
throw new IAE("Cannot analyze subquery of class[%s]", subQuery.getClass().getName());
}
@@ -213,7 +213,7 @@ public class DataSourceAnalysis
}
/**
- * Returns the bottommost (i.e. innermost) {@link Query} from a possible stack of outer queries at the root of
+ * Returns the bottom-most (i.e. innermost) {@link Query} from a possible stack of outer queries at the root of
* the datasource tree. This is the query that will be applied to the base datasource plus any joinables that might
* be present.
*
diff --git a/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java b/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java
index 20fddd75942..86200dd0067 100644
--- a/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java
+++ b/processing/src/main/java/org/apache/druid/query/scan/ScanQuery.java
@@ -171,6 +171,7 @@ public class ScanQuery extends BaseQuery
* the query is sent to).
*/
public static final String CTX_KEY_OUTERMOST = "scanOutermost";
+ public static final int DEFAULT_BATCH_SIZE = 4096 * 5;
private final VirtualColumns virtualColumns;
private final ResultFormat resultFormat;
@@ -205,7 +206,7 @@ public class ScanQuery extends BaseQuery
super(dataSource, querySegmentSpec, false, context);
this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns);
this.resultFormat = (resultFormat == null) ? ResultFormat.RESULT_FORMAT_LIST : resultFormat;
- this.batchSize = (batchSize == 0) ? 4096 * 5 : batchSize;
+ this.batchSize = (batchSize == 0) ? DEFAULT_BATCH_SIZE : batchSize;
Preconditions.checkArgument(
this.batchSize > 0,
"batchSize must be greater than 0"
@@ -284,6 +285,7 @@ public class ScanQuery extends BaseQuery
@JsonProperty
@Override
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
public VirtualColumns getVirtualColumns()
{
return virtualColumns;
@@ -296,6 +298,7 @@ public class ScanQuery extends BaseQuery
}
@JsonProperty
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = BatchSizeJsonIncludeFilter.class)
public int getBatchSize()
{
return batchSize;
@@ -313,7 +316,7 @@ public class ScanQuery extends BaseQuery
/**
* Limit for this query; behaves like SQL "LIMIT". Will always be positive. {@link Long#MAX_VALUE} is used in
- * situations where the user wants an effectively unlimited resultset.
+ * situations where the user wants an effectively unlimited result set.
*/
@JsonProperty("limit")
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = ScanRowsLimitJsonIncludeFilter.class)
@@ -389,6 +392,7 @@ public class ScanQuery extends BaseQuery
@Override
@Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public DimFilter getFilter()
{
return dimFilter;
@@ -413,7 +417,7 @@ public class ScanQuery extends BaseQuery
*/
@Nullable
@JsonProperty
- @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = IsLegacyJsonIncludeFilter.class)
public Boolean isLegacy()
{
return legacy;
@@ -643,4 +647,37 @@ public class ScanQuery extends BaseQuery
return obj instanceof Long && (long) obj == Long.MAX_VALUE;
}
}
+
+ /**
+ * {@link JsonInclude} filter for {@link #getBatchSize()}.
+ *
+ * This API works by "creative" use of equals. It requires warnings to be suppressed and also requires spotbugs
+ * exclusions (see spotbugs-exclude.xml).
+ */
+ @SuppressWarnings({"EqualsAndHashcode", "EqualsHashCode"})
+ static class BatchSizeJsonIncludeFilter // lgtm [java/inconsistent-equals-and-hashcode]
+ {
+ @Override
+ public boolean equals(Object obj)
+ {
+ return obj instanceof Integer && (int) obj == DEFAULT_BATCH_SIZE;
+ }
+ }
+
+ /**
+ * {@link JsonInclude} filter for {@link #isLegacy()}.
+ *
+ * This API works by "creative" use of equals. It requires warnings to be suppressed and also requires spotbugs
+ * exclusions (see spotbugs-exclude.xml).
+ */
+ @SuppressWarnings({"EqualsAndHashcode", "EqualsHashCode"})
+ static class IsLegacyJsonIncludeFilter // lgtm [java/inconsistent-equals-and-hashcode]
+ {
+ @Override
+ public boolean equals(Object obj)
+ {
+ return obj == null ||
+ obj instanceof Boolean && !(Boolean) obj;
+ }
+ }
}
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 240ede642a1..aac161c2728 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
@@ -20,6 +20,7 @@
package org.apache.druid.query.timeboundary;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import it.unimi.dsi.fastutil.bytes.ByteArrays;
import org.apache.druid.java.util.common.DateTimes;
@@ -79,6 +80,7 @@ public class TimeBoundaryQuery extends BaseQuery
@JsonProperty("filter")
@Override
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public DimFilter getFilter()
{
return dimFilter;
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 63c12de3670..1e7300588c8 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
@@ -20,6 +20,7 @@
package org.apache.druid.query.timeseries;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Preconditions;
@@ -35,6 +36,7 @@ import org.apache.druid.query.Result;
import org.apache.druid.query.aggregation.AggregatorFactory;
import org.apache.druid.query.aggregation.PostAggregator;
import org.apache.druid.query.filter.DimFilter;
+import org.apache.druid.query.groupby.orderby.DefaultLimitSpec.LimitJsonIncludeFilter;
import org.apache.druid.query.spec.QuerySegmentSpec;
import org.apache.druid.segment.VirtualColumns;
@@ -116,30 +118,35 @@ public class TimeseriesQuery extends BaseQuery>
@JsonProperty
@Override
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
public VirtualColumns getVirtualColumns()
{
return virtualColumns;
}
@JsonProperty("filter")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public DimFilter getDimensionsFilter()
{
return dimFilter;
}
@JsonProperty("aggregations")
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
public List getAggregatorSpecs()
{
return aggregatorSpecs;
}
@JsonProperty("postAggregations")
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
public List getPostAggregatorSpecs()
{
return postAggregatorSpecs;
}
@JsonProperty("limit")
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = LimitJsonIncludeFilter.class)
public int getLimit()
{
return limit;
diff --git a/processing/src/main/java/org/apache/druid/query/topn/DimensionTopNMetricSpec.java b/processing/src/main/java/org/apache/druid/query/topn/DimensionTopNMetricSpec.java
index 6878288de03..f4f909669af 100644
--- a/processing/src/main/java/org/apache/druid/query/topn/DimensionTopNMetricSpec.java
+++ b/processing/src/main/java/org/apache/druid/query/topn/DimensionTopNMetricSpec.java
@@ -20,6 +20,7 @@
package org.apache.druid.query.topn;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.query.aggregation.AggregatorFactory;
@@ -29,6 +30,8 @@ import org.apache.druid.query.ordering.StringComparator;
import org.apache.druid.query.ordering.StringComparators;
import org.joda.time.DateTime;
+import javax.annotation.Nullable;
+
import java.nio.ByteBuffer;
import java.util.Comparator;
import java.util.List;
@@ -59,7 +62,9 @@ public class DimensionTopNMetricSpec implements TopNMetricSpec
{
}
+ @Nullable
@JsonProperty
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public String getPreviousStop()
{
return previousStop;
diff --git a/processing/src/main/java/org/apache/druid/query/topn/TopNQuery.java b/processing/src/main/java/org/apache/druid/query/topn/TopNQuery.java
index 7724a6d60fa..4c36737e124 100644
--- a/processing/src/main/java/org/apache/druid/query/topn/TopNQuery.java
+++ b/processing/src/main/java/org/apache/druid/query/topn/TopNQuery.java
@@ -20,6 +20,7 @@
package org.apache.druid.query.topn;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@@ -38,6 +39,7 @@ import org.apache.druid.query.spec.QuerySegmentSpec;
import org.apache.druid.segment.VirtualColumns;
import javax.annotation.Nullable;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -118,6 +120,7 @@ public class TopNQuery extends BaseQuery>
@JsonProperty
@Override
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
public VirtualColumns getVirtualColumns()
{
return virtualColumns;
@@ -141,7 +144,9 @@ public class TopNQuery extends BaseQuery>
return threshold;
}
+ @Nullable
@JsonProperty("filter")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
public DimFilter getDimensionsFilter()
{
return dimFilter;
@@ -154,6 +159,7 @@ public class TopNQuery extends BaseQuery>
}
@JsonProperty("postAggregations")
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
public List getPostAggregatorSpecs()
{
return postAggregatorSpecs;
diff --git a/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java b/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java
index 53207b51d1f..63be88a6d2f 100644
--- a/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java
+++ b/processing/src/main/java/org/apache/druid/segment/DoubleDimensionIndexer.java
@@ -49,6 +49,7 @@ public class DoubleDimensionIndexer implements DimensionIndexer
{
- public static final Comparator LONG_COMPARATOR = Comparators.naturalNullsFirst();
+ public static final Comparator LONG_COMPARATOR = Comparators.naturalNullsFirst();
private volatile boolean hasNulls = false;
diff --git a/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java b/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java
index 3384222df7b..c3815286d90 100644
--- a/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java
+++ b/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java
@@ -20,6 +20,7 @@
package org.apache.druid.segment;
import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
@@ -501,4 +502,20 @@ public class VirtualColumns implements Cacheable
return virtualColumns.toString();
}
+ /**
+ * {@link JsonInclude} filter for {@code getVirtualColumns()}.
+ *
+ * This API works by "creative" use of equals. It requires warnings to be suppressed
+ * and also requires spotbugs exclusions (see spotbugs-exclude.xml).
+ */
+ @SuppressWarnings({"EqualsAndHashcode", "EqualsHashCode"})
+ public static class JsonIncludeFilter // lgtm [java/inconsistent-equals-and-hashcode]
+ {
+ @Override
+ public boolean equals(Object obj)
+ {
+ return obj instanceof VirtualColumns &&
+ ((VirtualColumns) obj).virtualColumns.isEmpty();
+ }
+ }
}
diff --git a/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java b/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java
index acca9ab8ff6..1bc1ff18a58 100644
--- a/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java
+++ b/processing/src/test/java/org/apache/druid/query/scan/ScanQuerySpecTest.java
@@ -43,22 +43,15 @@ public class ScanQuerySpecTest
String legacy =
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
- + "\"filter\":null,"
+ "\"columns\":[\"market\",\"quality\",\"index\"],"
- + "\"limit\":3,"
- + "\"context\":null}";
+ + "\"limit\":3}";
String current =
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
- + "\"virtualColumns\":[],"
+ "\"resultFormat\":\"list\","
- + "\"batchSize\":20480,"
+ "\"limit\":3,"
- + "\"filter\":null,"
+ "\"columns\":[\"market\",\"quality\",\"index\"],"
- + "\"context\":{},"
- + "\"descending\":false,"
+ "\"granularity\":{\"type\":\"all\"}}";
ScanQuery query = new ScanQuery(
@@ -89,15 +82,10 @@ public class ScanQuerySpecTest
String originalJson =
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
- + "\"virtualColumns\":[],"
+ "\"resultFormat\":\"list\","
- + "\"batchSize\":20480,"
+ "\"limit\":3,"
+ "\"order\":\"ascending\","
- + "\"filter\":null,"
+ "\"columns\":[\"market\",\"quality\",\"index\",\"__time\"],"
- + "\"context\":{},"
- + "\"descending\":false,"
+ "\"granularity\":{\"type\":\"all\"}}";
ScanQuery expectedQuery = new ScanQuery(
@@ -132,15 +120,10 @@ public class ScanQuerySpecTest
String originalJson =
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
- + "\"virtualColumns\":[],"
+ "\"resultFormat\":\"list\","
- + "\"batchSize\":20480,"
+ "\"limit\":3,"
+ "\"orderBy\":[{\"columnName\":\"quality\",\"order\":\"ascending\"}],"
- + "\"filter\":null,"
+ "\"columns\":[\"market\",\"quality\",\"index\",\"__time\"],"
- + "\"context\":{},"
- + "\"descending\":false,"
+ "\"granularity\":{\"type\":\"all\"}}";
ScanQuery expectedQuery = new ScanQuery(
diff --git a/server/src/main/java/org/apache/druid/server/ClientQuerySegmentWalker.java b/server/src/main/java/org/apache/druid/server/ClientQuerySegmentWalker.java
index 86a813bc226..136953e8719 100644
--- a/server/src/main/java/org/apache/druid/server/ClientQuerySegmentWalker.java
+++ b/server/src/main/java/org/apache/druid/server/ClientQuerySegmentWalker.java
@@ -72,7 +72,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
- * Query handler for Broker processes (see CliBroker).
+ * Query handler for the Broker processes (see CliBroker).
*
* This class is responsible for:
*
diff --git a/server/src/main/java/org/apache/druid/server/QueryLifecycle.java b/server/src/main/java/org/apache/druid/server/QueryLifecycle.java
index ecada161cf6..1bdba451519 100644
--- a/server/src/main/java/org/apache/druid/server/QueryLifecycle.java
+++ b/server/src/main/java/org/apache/druid/server/QueryLifecycle.java
@@ -157,7 +157,7 @@ public class QueryLifecycle
throw new ISE("Unauthorized");
}
- final QueryLifecycle.QueryResponse queryResponse = execute();
+ final QueryResponse queryResponse = execute();
results = queryResponse.getResults();
}
catch (Throwable e) {
@@ -278,7 +278,7 @@ public class QueryLifecycle
final ResponseContext responseContext = DirectDruidClient.makeResponseContextForQuery();
- final Sequence res = QueryPlus.wrap(baseQuery)
+ final Sequence> res = QueryPlus.wrap(baseQuery)
.withIdentity(authenticationResult.getIdentity())
.run(texasRanger, responseContext);
diff --git a/server/src/test/java/org/apache/druid/client/indexing/ClientCompactionTaskTransformSpecTest.java b/server/src/test/java/org/apache/druid/client/indexing/ClientCompactionTaskTransformSpecTest.java
index aa5c7d4481e..750ad82a348 100644
--- a/server/src/test/java/org/apache/druid/client/indexing/ClientCompactionTaskTransformSpecTest.java
+++ b/server/src/test/java/org/apache/druid/client/indexing/ClientCompactionTaskTransformSpecTest.java
@@ -57,6 +57,7 @@ public class ClientCompactionTaskTransformSpecTest
Assert.assertEquals(expected, fromJson);
}
+ @SuppressWarnings("unchecked")
@Test
public void testAsMap()
{
@@ -67,9 +68,9 @@ public class ClientCompactionTaskTransformSpecTest
final ClientCompactionTaskTransformSpec spec = new ClientCompactionTaskTransformSpec(new SelectorDimFilter(dimension, value, null));
final Map map = spec.asMap(objectMapper);
Assert.assertNotNull(map);
- Assert.assertEquals(4, ((Map) map.get("filter")).size());
- Assert.assertEquals(dimension, ((Map) map.get("filter")).get("dimension"));
- Assert.assertEquals(value, ((Map) map.get("filter")).get("value"));
+ Assert.assertEquals(3, ((Map) map.get("filter")).size());
+ Assert.assertEquals(dimension, ((Map) map.get("filter")).get("dimension"));
+ Assert.assertEquals(value, ((Map) map.get("filter")).get("value"));
ClientCompactionTaskTransformSpec actual = objectMapper.convertValue(map, ClientCompactionTaskTransformSpec.class);
Assert.assertEquals(spec, actual);
}
diff --git a/server/src/test/java/org/apache/druid/server/log/DefaultRequestLogEventTest.java b/server/src/test/java/org/apache/druid/server/log/DefaultRequestLogEventTest.java
index 0a515ee78a6..16398d440c6 100644
--- a/server/src/test/java/org/apache/druid/server/log/DefaultRequestLogEventTest.java
+++ b/server/src/test/java/org/apache/druid/server/log/DefaultRequestLogEventTest.java
@@ -70,7 +70,12 @@ public class DefaultRequestLogEventTest
nativeLine);
String logEventJson = objectMapper.writeValueAsString(defaultRequestLogEvent);
- String expected = "{\"feed\":\"feed\",\"query\":{\"queryType\":\"timeseries\",\"dataSource\":{\"type\":\"table\",\"name\":\"dummy\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"2015-01-01T00:00:00.000Z/2015-01-02T00:00:00.000Z\"]},\"descending\":true,\"virtualColumns\":[],\"filter\":null,\"granularity\":{\"type\":\"all\"},\"aggregations\":[],\"postAggregations\":[],\"limit\":5,\"context\":{\"key\":\"value\"}},\"host\":\"127.0.0.1\",\"timestamp\":\"2019-12-12T03:01:00.000Z\",\"service\":\"druid-service\",\"sql\":null,\"sqlQueryContext\":{},\"remoteAddr\":\"127.0.0.1\",\"queryStats\":{\"query/time\":13,\"query/bytes\":10,\"success\":true,\"identity\":\"allowAll\"}}";
+ String expected = "{\"feed\":\"feed\",\"query\":{\"queryType\":\"timeseries\",\"dataSource\":{\"type\":\"table\",\"name\":\"dummy\"},"
+ + "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"2015-01-01T00:00:00.000Z/2015-01-02T00:00:00.000Z\"]},"
+ + "\"descending\":true,\"granularity\":{\"type\":\"all\"},\"limit\":5,"
+ + "\"context\":{\"key\":\"value\"}},\"host\":\"127.0.0.1\",\"timestamp\":\"2019-12-12T03:01:00.000Z\","
+ + "\"service\":\"druid-service\",\"sql\":null,\"sqlQueryContext\":{},\"remoteAddr\":\"127.0.0.1\","
+ + "\"queryStats\":{\"query/time\":13,\"query/bytes\":10,\"success\":true,\"identity\":\"allowAll\"}}";
Assert.assertEquals(objectMapper.readTree(expected), objectMapper.readTree(logEventJson));
}
diff --git a/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java b/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java
index 85c1599dfe5..f20fca2af3a 100644
--- a/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java
+++ b/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java
@@ -242,8 +242,6 @@ public abstract class DruidAvaticaHandlerTest extends CalciteTestBase
clientLosAngeles = DriverManager.getConnection(url, propertiesLosAngeles);
}
-
-
@After
public void tearDown() throws Exception
{
@@ -380,7 +378,7 @@ public abstract class DruidAvaticaHandlerTest extends CalciteTestBase
ImmutableList.of(
ImmutableMap.of(
"PLAN",
- StringUtils.format("DruidQueryRel(query=[{\"queryType\":\"timeseries\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"descending\":false,\"virtualColumns\":[],\"filter\":null,\"granularity\":{\"type\":\"all\"},\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],\"postAggregations\":[],\"limit\":2147483647,\"context\":{\"sqlQueryId\":\"%s\",\"sqlStringifyArrays\":false,\"sqlTimeZone\":\"America/Los_Angeles\"}}], signature=[{a0:LONG}])\n",
+ StringUtils.format("DruidQueryRel(query=[{\"queryType\":\"timeseries\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"granularity\":{\"type\":\"all\"},\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],\"context\":{\"sqlQueryId\":\"%s\",\"sqlStringifyArrays\":false,\"sqlTimeZone\":\"America/Los_Angeles\"}}], signature=[{a0:LONG}])\n",
DUMMY_SQL_QUERY_ID
),
"RESOURCES",
diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
index 1af59214f8f..cafd1e5f277 100644
--- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
+++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
@@ -392,8 +392,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
-
-
@Test
public void testTopNLimitWrapping() throws Exception
{
@@ -431,7 +429,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
-
@Test
public void testTopNLimitWrappingOrderByAgg() throws Exception
{
@@ -1554,7 +1551,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
@Test
public void testOrderByLatestFloat() throws Exception
{
-
List