mirror of https://github.com/apache/druid.git
Remove null and empty fields from native queries (#12634)
* Remove null and empty fields from native queries * Test fixes * Attempted IT fix. * Revisions from review comments * Build fixes resulting from changes suggested by reviews * IT fix for changed segment size
This commit is contained in:
parent
f050069767
commit
893759de91
|
@ -46,7 +46,10 @@
|
||||||
<Or>
|
<Or>
|
||||||
<Class name="org.apache.druid.query.scan.ScanQuery$ScanRowsLimitJsonIncludeFilter"/>
|
<Class name="org.apache.druid.query.scan.ScanQuery$ScanRowsLimitJsonIncludeFilter"/>
|
||||||
<Class name="org.apache.druid.query.scan.ScanQuery$ScanTimeOrderJsonIncludeFilter"/>
|
<Class name="org.apache.druid.query.scan.ScanQuery$ScanTimeOrderJsonIncludeFilter"/>
|
||||||
|
<Class name="org.apache.druid.query.scan.ScanQuery$BatchSizeJsonIncludeFilter"/>
|
||||||
|
<Class name="org.apache.druid.query.scan.ScanQuery$IsLegacyJsonIncludeFilter"/>
|
||||||
<Class name="org.apache.druid.query.groupby.orderby.DefaultLimitSpec$LimitJsonIncludeFilter"/>
|
<Class name="org.apache.druid.query.groupby.orderby.DefaultLimitSpec$LimitJsonIncludeFilter"/>
|
||||||
|
<Class name="org.apache.druid.segment.VirtualColumns$JsonIncludeFilter"/>
|
||||||
</Or>
|
</Or>
|
||||||
</And>
|
</And>
|
||||||
</Match>
|
</Match>
|
||||||
|
@ -56,6 +59,12 @@
|
||||||
<Class name="org.apache.druid.server.AsyncQueryForwardingServlet" />
|
<Class name="org.apache.druid.server.AsyncQueryForwardingServlet" />
|
||||||
</And>
|
</And>
|
||||||
</Match>
|
</Match>
|
||||||
|
<Match>
|
||||||
|
<And>
|
||||||
|
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
|
||||||
|
<Class name="org.apache.druid.sql.calcite.planner.CapturedState" />
|
||||||
|
</And>
|
||||||
|
</Match>
|
||||||
|
|
||||||
<Bug pattern="AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION"/>
|
<Bug pattern="AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION"/>
|
||||||
<Bug pattern="BC_UNCONFIRMED_CAST"/>
|
<Bug pattern="BC_UNCONFIRMED_CAST"/>
|
||||||
|
|
|
@ -90,7 +90,6 @@ public class EmitterTest
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MockHttpClient httpClient;
|
MockHttpClient httpClient;
|
||||||
HttpPostEmitter emitter;
|
HttpPostEmitter emitter;
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
|
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
|
||||||
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
||||||
|
@ -211,7 +210,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
Assert.assertSame(HashBasedNumberedShardSpec.class, segment.getShardSpec().getClass());
|
Assert.assertSame(HashBasedNumberedShardSpec.class, segment.getShardSpec().getClass());
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new HashedPartitionsSpec(null, 3, null),
|
new HashedPartitionsSpec(null, 3, null),
|
||||||
|
@ -259,7 +257,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
Assert.assertSame(SingleDimensionShardSpec.class, segment.getShardSpec().getClass());
|
Assert.assertSame(SingleDimensionShardSpec.class, segment.getShardSpec().getClass());
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new SingleDimensionPartitionsSpec(7, null, "dim", false),
|
new SingleDimensionPartitionsSpec(7, null, "dim", false),
|
||||||
|
@ -310,7 +307,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
Assert.assertSame(DimensionRangeShardSpec.class, segment.getShardSpec().getClass());
|
Assert.assertSame(DimensionRangeShardSpec.class, segment.getShardSpec().getClass());
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new DimensionRangePartitionsSpec(7, null, Arrays.asList("dim1", "dim2"), false),
|
new DimensionRangePartitionsSpec(7, null, Arrays.asList("dim1", "dim2"), false),
|
||||||
|
@ -358,7 +354,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
Assert.assertSame(SingleDimensionShardSpec.class, segment.getShardSpec().getClass());
|
Assert.assertSame(SingleDimensionShardSpec.class, segment.getShardSpec().getClass());
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new SingleDimensionPartitionsSpec(7, null, "dim", false),
|
new SingleDimensionPartitionsSpec(7, null, "dim", false),
|
||||||
|
@ -409,7 +404,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
Assert.assertSame(DimensionRangeShardSpec.class, segment.getShardSpec().getClass());
|
Assert.assertSame(DimensionRangeShardSpec.class, segment.getShardSpec().getClass());
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new DimensionRangePartitionsSpec(7, null, Arrays.asList("dim1", "dim2"), false),
|
new DimensionRangePartitionsSpec(7, null, Arrays.asList("dim1", "dim2"), false),
|
||||||
|
@ -490,7 +484,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
|
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
|
||||||
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
||||||
|
@ -545,7 +538,6 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
|
new DynamicPartitionsSpec(null, Long.MAX_VALUE),
|
||||||
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
||||||
|
|
|
@ -202,7 +202,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
return new CompactionState(
|
return new CompactionState(
|
||||||
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
|
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
|
||||||
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
||||||
|
@ -355,7 +354,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
CompactionState expectedState = new CompactionState(
|
CompactionState expectedState = new CompactionState(
|
||||||
new HashedPartitionsSpec(null, 3, null),
|
new HashedPartitionsSpec(null, 3, null),
|
||||||
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
||||||
|
@ -648,7 +646,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
CompactionState expectedCompactionState = new CompactionState(
|
CompactionState expectedCompactionState = new CompactionState(
|
||||||
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
|
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
|
||||||
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
||||||
|
@ -710,7 +707,6 @@ public class CompactionTaskRunTest extends IngestionTestBase
|
||||||
expectedLongSumMetric.put("type", "longSum");
|
expectedLongSumMetric.put("type", "longSum");
|
||||||
expectedLongSumMetric.put("name", "val");
|
expectedLongSumMetric.put("name", "val");
|
||||||
expectedLongSumMetric.put("fieldName", "val");
|
expectedLongSumMetric.put("fieldName", "val");
|
||||||
expectedLongSumMetric.put("expression", null);
|
|
||||||
CompactionState expectedCompactionState = new CompactionState(
|
CompactionState expectedCompactionState = new CompactionState(
|
||||||
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
|
new DynamicPartitionsSpec(5000000, Long.MAX_VALUE),
|
||||||
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim"))),
|
||||||
|
|
|
@ -115,9 +115,6 @@ public class RemoteTaskRunnerTest
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final TestRule timeout = new DeadlockDetectingTimeout(60, TimeUnit.SECONDS);
|
public final TestRule timeout = new DeadlockDetectingTimeout(60, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void setup() throws Exception
|
public void setup() throws Exception
|
||||||
{
|
{
|
||||||
// Set comapction slot to 5
|
// Set compaction slot to 5
|
||||||
updateCompactionTaskSlot(0.5, 10, null);
|
updateCompactionTaskSlot(0.5, 10, null);
|
||||||
fullDatasourceName = "wikipedia_index_test_" + UUID.randomUUID() + config.getExtraDatasourceNameSuffix();
|
fullDatasourceName = "wikipedia_index_test_" + UUID.randomUUID() + config.getExtraDatasourceNameSuffix();
|
||||||
}
|
}
|
||||||
|
@ -458,8 +458,8 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
|
||||||
fullDatasourceName,
|
fullDatasourceName,
|
||||||
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
||||||
0,
|
0,
|
||||||
14906,
|
14762,
|
||||||
14905,
|
14761,
|
||||||
0,
|
0,
|
||||||
2,
|
2,
|
||||||
2,
|
2,
|
||||||
|
@ -476,7 +476,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
|
||||||
fullDatasourceName,
|
fullDatasourceName,
|
||||||
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
||||||
0,
|
0,
|
||||||
23372,
|
23156,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
3,
|
3,
|
||||||
|
@ -592,8 +592,8 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
|
||||||
getAndAssertCompactionStatus(
|
getAndAssertCompactionStatus(
|
||||||
fullDatasourceName,
|
fullDatasourceName,
|
||||||
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
||||||
14906,
|
14762,
|
||||||
14905,
|
14761,
|
||||||
0,
|
0,
|
||||||
2,
|
2,
|
||||||
2,
|
2,
|
||||||
|
@ -601,7 +601,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
0);
|
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
|
// Run compaction again to compact the remaining day
|
||||||
// Remaining day compacted (1 new segment). Now both days compacted (2 total)
|
// Remaining day compacted (1 new segment). Now both days compacted (2 total)
|
||||||
forceTriggerAutoCompaction(2);
|
forceTriggerAutoCompaction(2);
|
||||||
|
@ -612,7 +612,7 @@ public class ITAutoCompactionTest extends AbstractIndexerTest
|
||||||
fullDatasourceName,
|
fullDatasourceName,
|
||||||
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
AutoCompactionSnapshot.AutoCompactionScheduleStatus.RUNNING,
|
||||||
0,
|
0,
|
||||||
23372,
|
23156,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
3,
|
3,
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.apache.druid.query;
|
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.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
@ -101,6 +103,7 @@ public abstract class BaseQuery<T> implements Query<T>
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Override
|
@Override
|
||||||
|
@JsonInclude(Include.NON_DEFAULT)
|
||||||
public boolean isDescending()
|
public boolean isDescending()
|
||||||
{
|
{
|
||||||
return descending;
|
return descending;
|
||||||
|
@ -165,6 +168,7 @@ public abstract class BaseQuery<T> implements Query<T>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(Include.NON_DEFAULT)
|
||||||
public Map<String, Object> getContext()
|
public Map<String, Object> getContext()
|
||||||
{
|
{
|
||||||
return context.getMergedParams();
|
return context.getMergedParams();
|
||||||
|
|
|
@ -21,6 +21,8 @@ package org.apache.druid.query;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JacksonInject;
|
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
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.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableList;
|
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 org.apache.druid.segment.join.JoinType;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -176,6 +179,7 @@ public class JoinDataSource implements DataSource
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonInclude(Include.NON_NULL)
|
||||||
public DimFilter getLeftFilter()
|
public DimFilter getLeftFilter()
|
||||||
{
|
{
|
||||||
return leftFilter;
|
return leftFilter;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import java.util.Set;
|
||||||
public class QueryDataSource implements DataSource
|
public class QueryDataSource implements DataSource
|
||||||
{
|
{
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
private final Query query;
|
private final Query<?> query;
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public QueryDataSource(@JsonProperty("query") Query query)
|
public QueryDataSource(@JsonProperty("query") Query query)
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.druid.query.aggregation;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JacksonInject;
|
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -204,6 +205,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public Set<String> getFields()
|
public Set<String> getFields()
|
||||||
{
|
{
|
||||||
return fields;
|
return fields;
|
||||||
|
@ -211,6 +213,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getAccumulatorIdentifier()
|
public String getAccumulatorIdentifier()
|
||||||
{
|
{
|
||||||
return accumulatorId;
|
return accumulatorId;
|
||||||
|
@ -260,6 +263,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
|
||||||
|
|
||||||
@JsonProperty("compare")
|
@JsonProperty("compare")
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getCompareExpressionString()
|
public String getCompareExpressionString()
|
||||||
{
|
{
|
||||||
return compareExpressionString;
|
return compareExpressionString;
|
||||||
|
@ -267,6 +271,7 @@ public class ExpressionLambdaAggregatorFactory extends AggregatorFactory
|
||||||
|
|
||||||
@JsonProperty("finalize")
|
@JsonProperty("finalize")
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getFinalizeExpressionString()
|
public String getFinalizeExpressionString()
|
||||||
{
|
{
|
||||||
return finalizeExpressionString;
|
return finalizeExpressionString;
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.apache.druid.query.aggregation;
|
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.guice.annotations.ExtensionPoint;
|
||||||
import org.apache.druid.java.util.common.Cacheable;
|
import org.apache.druid.java.util.common.Cacheable;
|
||||||
import org.apache.druid.segment.ColumnInspector;
|
import org.apache.druid.segment.ColumnInspector;
|
||||||
|
@ -45,6 +47,7 @@ public interface PostAggregator extends Cacheable
|
||||||
Object compute(Map<String, Object> combinedAggregators);
|
Object compute(Map<String, Object> combinedAggregators);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonInclude(Include.NON_NULL)
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.query.aggregation;
|
package org.apache.druid.query.aggregation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -234,6 +235,7 @@ public abstract class SimpleDoubleAggregatorFactory extends NullableNumericAggre
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getFieldName()
|
public String getFieldName()
|
||||||
{
|
{
|
||||||
return fieldName;
|
return fieldName;
|
||||||
|
@ -241,6 +243,7 @@ public abstract class SimpleDoubleAggregatorFactory extends NullableNumericAggre
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getExpression()
|
public String getExpression()
|
||||||
{
|
{
|
||||||
return expression;
|
return expression;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.query.aggregation;
|
package org.apache.druid.query.aggregation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -212,6 +213,7 @@ public abstract class SimpleFloatAggregatorFactory extends NullableNumericAggreg
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getFieldName()
|
public String getFieldName()
|
||||||
{
|
{
|
||||||
return fieldName;
|
return fieldName;
|
||||||
|
@ -219,6 +221,7 @@ public abstract class SimpleFloatAggregatorFactory extends NullableNumericAggreg
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getExpression()
|
public String getExpression()
|
||||||
{
|
{
|
||||||
return expression;
|
return expression;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.query.aggregation;
|
package org.apache.druid.query.aggregation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Supplier;
|
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 org.apache.druid.segment.vector.VectorValueSelector;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -215,6 +217,7 @@ public abstract class SimpleLongAggregatorFactory extends NullableNumericAggrega
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getFieldName()
|
public String getFieldName()
|
||||||
{
|
{
|
||||||
return fieldName;
|
return fieldName;
|
||||||
|
@ -222,6 +225,7 @@ public abstract class SimpleLongAggregatorFactory extends NullableNumericAggrega
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getExpression()
|
public String getExpression()
|
||||||
{
|
{
|
||||||
return expression;
|
return expression;
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
package org.apache.druid.query.aggregation.post;
|
package org.apache.druid.query.aggregation.post;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
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.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import org.apache.druid.common.config.NullHandling;
|
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 org.apache.druid.segment.column.ColumnType;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -169,6 +172,7 @@ public class ArithmeticPostAggregator implements PostAggregator
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("ordering")
|
@JsonProperty("ordering")
|
||||||
|
@JsonInclude(Include.NON_NULL)
|
||||||
public String getOrdering()
|
public String getOrdering()
|
||||||
{
|
{
|
||||||
return ordering;
|
return ordering;
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.druid.query.aggregation.post;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JacksonInject;
|
import com.fasterxml.jackson.annotation.JacksonInject;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
@ -213,6 +214,7 @@ public class ExpressionPostAggregator implements PostAggregator
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty("ordering")
|
@JsonProperty("ordering")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getOrdering()
|
public String getOrdering()
|
||||||
{
|
{
|
||||||
return ordering;
|
return ordering;
|
||||||
|
|
|
@ -132,6 +132,7 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getUpper()
|
public String getUpper()
|
||||||
{
|
{
|
||||||
return upper;
|
return upper;
|
||||||
|
@ -139,18 +140,21 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getLower()
|
public String getLower()
|
||||||
{
|
{
|
||||||
return lower;
|
return lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
|
||||||
public boolean isLowerStrict()
|
public boolean isLowerStrict()
|
||||||
{
|
{
|
||||||
return lowerStrict;
|
return lowerStrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
|
||||||
public boolean isUpperStrict()
|
public boolean isUpperStrict()
|
||||||
{
|
{
|
||||||
return upperStrict;
|
return upperStrict;
|
||||||
|
@ -168,6 +172,7 @@ public class BoundDimFilter extends AbstractOptimizableDimFilter implements DimF
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public ExtractionFn getExtractionFn()
|
public ExtractionFn getExtractionFn()
|
||||||
{
|
{
|
||||||
return extractionFn;
|
return extractionFn;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.druid.segment.filter.DimensionPredicateFilter;
|
||||||
import org.apache.druid.segment.filter.SelectorFilter;
|
import org.apache.druid.segment.filter.SelectorFilter;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -116,6 +117,9 @@ public class SelectorDimFilter extends AbstractOptimizableDimFilter implements D
|
||||||
return dimension;
|
return dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value to filter against. If {@code null}, then the meaning is `is null`.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public String getValue()
|
public String getValue()
|
||||||
|
@ -125,14 +129,15 @@ public class SelectorDimFilter extends AbstractOptimizableDimFilter implements D
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public ExtractionFn getExtractionFn()
|
public ExtractionFn getExtractionFn()
|
||||||
{
|
{
|
||||||
return extractionFn;
|
return extractionFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public FilterTuning getFilterTuning()
|
public FilterTuning getFilterTuning()
|
||||||
{
|
{
|
||||||
return filterTuning;
|
return filterTuning;
|
||||||
|
|
|
@ -73,6 +73,7 @@ import org.joda.time.DateTime;
|
||||||
import org.joda.time.Interval;
|
import org.joda.time.Interval;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -271,6 +272,7 @@ public class GroupByQuery extends BaseQuery<ResultRow>
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Override
|
@Override
|
||||||
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
|
||||||
public VirtualColumns getVirtualColumns()
|
public VirtualColumns getVirtualColumns()
|
||||||
{
|
{
|
||||||
return virtualColumns;
|
return virtualColumns;
|
||||||
|
@ -278,6 +280,7 @@ public class GroupByQuery extends BaseQuery<ResultRow>
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty("filter")
|
@JsonProperty("filter")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public DimFilter getDimFilter()
|
public DimFilter getDimFilter()
|
||||||
{
|
{
|
||||||
return dimFilter;
|
return dimFilter;
|
||||||
|
@ -290,18 +293,21 @@ public class GroupByQuery extends BaseQuery<ResultRow>
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("aggregations")
|
@JsonProperty("aggregations")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public List<AggregatorFactory> getAggregatorSpecs()
|
public List<AggregatorFactory> getAggregatorSpecs()
|
||||||
{
|
{
|
||||||
return aggregatorSpecs;
|
return aggregatorSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("postAggregations")
|
@JsonProperty("postAggregations")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public List<PostAggregator> getPostAggregatorSpecs()
|
public List<PostAggregator> getPostAggregatorSpecs()
|
||||||
{
|
{
|
||||||
return postAggregatorSpecs;
|
return postAggregatorSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("having")
|
@JsonProperty("having")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public HavingSpec getHavingSpec()
|
public HavingSpec getHavingSpec()
|
||||||
{
|
{
|
||||||
return havingSpec;
|
return havingSpec;
|
||||||
|
@ -313,9 +319,12 @@ public class GroupByQuery extends BaseQuery<ResultRow>
|
||||||
return limitSpec;
|
return limitSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
/**
|
||||||
@JsonProperty("subtotalsSpec")
|
* Subtotals spec may be empty which has a distinct meaning from {@code null}.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonProperty("subtotalsSpec")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public List<List<String>> getSubtotalsSpec()
|
public List<List<String>> getSubtotalsSpec()
|
||||||
{
|
{
|
||||||
return subtotalsSpec;
|
return subtotalsSpec;
|
||||||
|
|
|
@ -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
|
* 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
|
@JsonProperty
|
||||||
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = LimitJsonIncludeFilter.class)
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = LimitJsonIncludeFilter.class)
|
||||||
|
@ -580,24 +580,16 @@ public class DefaultLimitSpec implements LimitSpec
|
||||||
/**
|
/**
|
||||||
* {@link JsonInclude} filter for {@link #getLimit()}.
|
* {@link JsonInclude} filter for {@link #getLimit()}.
|
||||||
*
|
*
|
||||||
* This API works by "creative" use of equals. It requires warnings to be suppressed and also requires spotbugs
|
* This API works by "creative" use of equals. It requires warnings to be suppressed
|
||||||
* exclusions (see spotbugs-exclude.xml).
|
* and also requires spotbugs exclusions (see spotbugs-exclude.xml).
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"EqualsAndHashcode", "EqualsHashCode"})
|
@SuppressWarnings({"EqualsAndHashcode", "EqualsHashCode"})
|
||||||
static class LimitJsonIncludeFilter // lgtm [java/inconsistent-equals-and-hashcode]
|
public static class LimitJsonIncludeFilter // lgtm [java/inconsistent-equals-and-hashcode]
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (obj == null) {
|
return obj instanceof Integer && (Integer) obj == Integer.MAX_VALUE;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj.getClass() == this.getClass()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj instanceof Long && (long) obj == Long.MAX_VALUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class DataSourceAnalysis
|
||||||
|
|
||||||
if (!(subQuery instanceof BaseQuery)) {
|
if (!(subQuery instanceof BaseQuery)) {
|
||||||
// We must verify that the subQuery is a BaseQuery, because it is required to make "getBaseQuerySegmentSpec"
|
// 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());
|
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
|
* the datasource tree. This is the query that will be applied to the base datasource plus any joinables that might
|
||||||
* be present.
|
* be present.
|
||||||
*
|
*
|
||||||
|
|
|
@ -171,6 +171,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
* the query is sent to).
|
* the query is sent to).
|
||||||
*/
|
*/
|
||||||
public static final String CTX_KEY_OUTERMOST = "scanOutermost";
|
public static final String CTX_KEY_OUTERMOST = "scanOutermost";
|
||||||
|
public static final int DEFAULT_BATCH_SIZE = 4096 * 5;
|
||||||
|
|
||||||
private final VirtualColumns virtualColumns;
|
private final VirtualColumns virtualColumns;
|
||||||
private final ResultFormat resultFormat;
|
private final ResultFormat resultFormat;
|
||||||
|
@ -205,7 +206,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
super(dataSource, querySegmentSpec, false, context);
|
super(dataSource, querySegmentSpec, false, context);
|
||||||
this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns);
|
this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns);
|
||||||
this.resultFormat = (resultFormat == null) ? ResultFormat.RESULT_FORMAT_LIST : resultFormat;
|
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(
|
Preconditions.checkArgument(
|
||||||
this.batchSize > 0,
|
this.batchSize > 0,
|
||||||
"batchSize must be greater than 0"
|
"batchSize must be greater than 0"
|
||||||
|
@ -284,6 +285,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Override
|
@Override
|
||||||
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
|
||||||
public VirtualColumns getVirtualColumns()
|
public VirtualColumns getVirtualColumns()
|
||||||
{
|
{
|
||||||
return virtualColumns;
|
return virtualColumns;
|
||||||
|
@ -296,6 +298,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = BatchSizeJsonIncludeFilter.class)
|
||||||
public int getBatchSize()
|
public int getBatchSize()
|
||||||
{
|
{
|
||||||
return batchSize;
|
return batchSize;
|
||||||
|
@ -313,7 +316,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limit for this query; behaves like SQL "LIMIT". Will always be positive. {@link Long#MAX_VALUE} is used in
|
* 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")
|
@JsonProperty("limit")
|
||||||
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = ScanRowsLimitJsonIncludeFilter.class)
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = ScanRowsLimitJsonIncludeFilter.class)
|
||||||
|
@ -389,6 +392,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public DimFilter getFilter()
|
public DimFilter getFilter()
|
||||||
{
|
{
|
||||||
return dimFilter;
|
return dimFilter;
|
||||||
|
@ -413,7 +417,7 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = IsLegacyJsonIncludeFilter.class)
|
||||||
public Boolean isLegacy()
|
public Boolean isLegacy()
|
||||||
{
|
{
|
||||||
return legacy;
|
return legacy;
|
||||||
|
@ -643,4 +647,37 @@ public class ScanQuery extends BaseQuery<ScanResultValue>
|
||||||
return obj instanceof Long && (long) obj == Long.MAX_VALUE;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.query.timeboundary;
|
package org.apache.druid.query.timeboundary;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import it.unimi.dsi.fastutil.bytes.ByteArrays;
|
import it.unimi.dsi.fastutil.bytes.ByteArrays;
|
||||||
import org.apache.druid.java.util.common.DateTimes;
|
import org.apache.druid.java.util.common.DateTimes;
|
||||||
|
@ -79,6 +80,7 @@ public class TimeBoundaryQuery extends BaseQuery<Result<TimeBoundaryResultValue>
|
||||||
|
|
||||||
@JsonProperty("filter")
|
@JsonProperty("filter")
|
||||||
@Override
|
@Override
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public DimFilter getFilter()
|
public DimFilter getFilter()
|
||||||
{
|
{
|
||||||
return dimFilter;
|
return dimFilter;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.query.timeseries;
|
package org.apache.druid.query.timeseries;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import com.google.common.base.Preconditions;
|
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.AggregatorFactory;
|
||||||
import org.apache.druid.query.aggregation.PostAggregator;
|
import org.apache.druid.query.aggregation.PostAggregator;
|
||||||
import org.apache.druid.query.filter.DimFilter;
|
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.query.spec.QuerySegmentSpec;
|
||||||
import org.apache.druid.segment.VirtualColumns;
|
import org.apache.druid.segment.VirtualColumns;
|
||||||
|
|
||||||
|
@ -116,30 +118,35 @@ public class TimeseriesQuery extends BaseQuery<Result<TimeseriesResultValue>>
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Override
|
@Override
|
||||||
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
|
||||||
public VirtualColumns getVirtualColumns()
|
public VirtualColumns getVirtualColumns()
|
||||||
{
|
{
|
||||||
return virtualColumns;
|
return virtualColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("filter")
|
@JsonProperty("filter")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public DimFilter getDimensionsFilter()
|
public DimFilter getDimensionsFilter()
|
||||||
{
|
{
|
||||||
return dimFilter;
|
return dimFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("aggregations")
|
@JsonProperty("aggregations")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public List<AggregatorFactory> getAggregatorSpecs()
|
public List<AggregatorFactory> getAggregatorSpecs()
|
||||||
{
|
{
|
||||||
return aggregatorSpecs;
|
return aggregatorSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("postAggregations")
|
@JsonProperty("postAggregations")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public List<PostAggregator> getPostAggregatorSpecs()
|
public List<PostAggregator> getPostAggregatorSpecs()
|
||||||
{
|
{
|
||||||
return postAggregatorSpecs;
|
return postAggregatorSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("limit")
|
@JsonProperty("limit")
|
||||||
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = LimitJsonIncludeFilter.class)
|
||||||
public int getLimit()
|
public int getLimit()
|
||||||
{
|
{
|
||||||
return limit;
|
return limit;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.query.topn;
|
package org.apache.druid.query.topn;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.apache.druid.java.util.common.StringUtils;
|
import org.apache.druid.java.util.common.StringUtils;
|
||||||
import org.apache.druid.query.aggregation.AggregatorFactory;
|
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.apache.druid.query.ordering.StringComparators;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -59,7 +62,9 @@ public class DimensionTopNMetricSpec implements TopNMetricSpec
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public String getPreviousStop()
|
public String getPreviousStop()
|
||||||
{
|
{
|
||||||
return previousStop;
|
return previousStop;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.query.topn;
|
package org.apache.druid.query.topn;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
@ -38,6 +39,7 @@ import org.apache.druid.query.spec.QuerySegmentSpec;
|
||||||
import org.apache.druid.segment.VirtualColumns;
|
import org.apache.druid.segment.VirtualColumns;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -118,6 +120,7 @@ public class TopNQuery extends BaseQuery<Result<TopNResultValue>>
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
@Override
|
@Override
|
||||||
|
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = VirtualColumns.JsonIncludeFilter.class)
|
||||||
public VirtualColumns getVirtualColumns()
|
public VirtualColumns getVirtualColumns()
|
||||||
{
|
{
|
||||||
return virtualColumns;
|
return virtualColumns;
|
||||||
|
@ -141,7 +144,9 @@ public class TopNQuery extends BaseQuery<Result<TopNResultValue>>
|
||||||
return threshold;
|
return threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
@JsonProperty("filter")
|
@JsonProperty("filter")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public DimFilter getDimensionsFilter()
|
public DimFilter getDimensionsFilter()
|
||||||
{
|
{
|
||||||
return dimFilter;
|
return dimFilter;
|
||||||
|
@ -154,6 +159,7 @@ public class TopNQuery extends BaseQuery<Result<TopNResultValue>>
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("postAggregations")
|
@JsonProperty("postAggregations")
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public List<PostAggregator> getPostAggregatorSpecs()
|
public List<PostAggregator> getPostAggregatorSpecs()
|
||||||
{
|
{
|
||||||
return postAggregatorSpecs;
|
return postAggregatorSpecs;
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class DoubleDimensionIndexer implements DimensionIndexer<Double, Double,
|
||||||
if (dimValues instanceof List) {
|
if (dimValues instanceof List) {
|
||||||
throw new UnsupportedOperationException("Numeric columns do not support multivalue rows.");
|
throw new UnsupportedOperationException("Numeric columns do not support multivalue rows.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Double d = DimensionHandlerUtils.convertObjectToDouble(dimValues, reportParseExceptions);
|
Double d = DimensionHandlerUtils.convertObjectToDouble(dimValues, reportParseExceptions);
|
||||||
if (d == null) {
|
if (d == null) {
|
||||||
hasNulls = NullHandling.sqlCompatible();
|
hasNulls = NullHandling.sqlCompatible();
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.util.Objects;
|
||||||
|
|
||||||
public class LongDimensionIndexer implements DimensionIndexer<Long, Long, Long>
|
public class LongDimensionIndexer implements DimensionIndexer<Long, Long, Long>
|
||||||
{
|
{
|
||||||
public static final Comparator LONG_COMPARATOR = Comparators.<Long>naturalNullsFirst();
|
public static final Comparator<Long> LONG_COMPARATOR = Comparators.naturalNullsFirst();
|
||||||
|
|
||||||
private volatile boolean hasNulls = false;
|
private volatile boolean hasNulls = false;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.apache.druid.segment;
|
package org.apache.druid.segment;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
@ -501,4 +502,20 @@ public class VirtualColumns implements Cacheable
|
||||||
return virtualColumns.toString();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,22 +43,15 @@ public class ScanQuerySpecTest
|
||||||
String legacy =
|
String legacy =
|
||||||
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
||||||
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"market\",\"quality\",\"index\"],"
|
+ "\"columns\":[\"market\",\"quality\",\"index\"],"
|
||||||
+ "\"limit\":3,"
|
+ "\"limit\":3}";
|
||||||
+ "\"context\":null}";
|
|
||||||
|
|
||||||
String current =
|
String current =
|
||||||
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
||||||
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"resultFormat\":\"list\","
|
+ "\"resultFormat\":\"list\","
|
||||||
+ "\"batchSize\":20480,"
|
|
||||||
+ "\"limit\":3,"
|
+ "\"limit\":3,"
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"market\",\"quality\",\"index\"],"
|
+ "\"columns\":[\"market\",\"quality\",\"index\"],"
|
||||||
+ "\"context\":{},"
|
|
||||||
+ "\"descending\":false,"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"}}";
|
+ "\"granularity\":{\"type\":\"all\"}}";
|
||||||
|
|
||||||
ScanQuery query = new ScanQuery(
|
ScanQuery query = new ScanQuery(
|
||||||
|
@ -89,15 +82,10 @@ public class ScanQuerySpecTest
|
||||||
String originalJson =
|
String originalJson =
|
||||||
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
||||||
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"resultFormat\":\"list\","
|
+ "\"resultFormat\":\"list\","
|
||||||
+ "\"batchSize\":20480,"
|
|
||||||
+ "\"limit\":3,"
|
+ "\"limit\":3,"
|
||||||
+ "\"order\":\"ascending\","
|
+ "\"order\":\"ascending\","
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"market\",\"quality\",\"index\",\"__time\"],"
|
+ "\"columns\":[\"market\",\"quality\",\"index\",\"__time\"],"
|
||||||
+ "\"context\":{},"
|
|
||||||
+ "\"descending\":false,"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"}}";
|
+ "\"granularity\":{\"type\":\"all\"}}";
|
||||||
|
|
||||||
ScanQuery expectedQuery = new ScanQuery(
|
ScanQuery expectedQuery = new ScanQuery(
|
||||||
|
@ -132,15 +120,10 @@ public class ScanQuerySpecTest
|
||||||
String originalJson =
|
String originalJson =
|
||||||
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
"{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"testing\"},"
|
||||||
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
+ "\"intervals\":{\"type\":\"LegacySegmentSpec\",\"intervals\":[\"2011-01-12T00:00:00.000Z/2011-01-14T00:00:00.000Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"resultFormat\":\"list\","
|
+ "\"resultFormat\":\"list\","
|
||||||
+ "\"batchSize\":20480,"
|
|
||||||
+ "\"limit\":3,"
|
+ "\"limit\":3,"
|
||||||
+ "\"orderBy\":[{\"columnName\":\"quality\",\"order\":\"ascending\"}],"
|
+ "\"orderBy\":[{\"columnName\":\"quality\",\"order\":\"ascending\"}],"
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"market\",\"quality\",\"index\",\"__time\"],"
|
+ "\"columns\":[\"market\",\"quality\",\"index\",\"__time\"],"
|
||||||
+ "\"context\":{},"
|
|
||||||
+ "\"descending\":false,"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"}}";
|
+ "\"granularity\":{\"type\":\"all\"}}";
|
||||||
|
|
||||||
ScanQuery expectedQuery = new ScanQuery(
|
ScanQuery expectedQuery = new ScanQuery(
|
||||||
|
|
|
@ -72,7 +72,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
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:
|
* This class is responsible for:
|
||||||
*
|
*
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class QueryLifecycle
|
||||||
throw new ISE("Unauthorized");
|
throw new ISE("Unauthorized");
|
||||||
}
|
}
|
||||||
|
|
||||||
final QueryLifecycle.QueryResponse queryResponse = execute();
|
final QueryResponse queryResponse = execute();
|
||||||
results = queryResponse.getResults();
|
results = queryResponse.getResults();
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
|
@ -278,7 +278,7 @@ public class QueryLifecycle
|
||||||
|
|
||||||
final ResponseContext responseContext = DirectDruidClient.makeResponseContextForQuery();
|
final ResponseContext responseContext = DirectDruidClient.makeResponseContextForQuery();
|
||||||
|
|
||||||
final Sequence res = QueryPlus.wrap(baseQuery)
|
final Sequence<?> res = QueryPlus.wrap(baseQuery)
|
||||||
.withIdentity(authenticationResult.getIdentity())
|
.withIdentity(authenticationResult.getIdentity())
|
||||||
.run(texasRanger, responseContext);
|
.run(texasRanger, responseContext);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class ClientCompactionTaskTransformSpecTest
|
||||||
Assert.assertEquals(expected, fromJson);
|
Assert.assertEquals(expected, fromJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void testAsMap()
|
public void testAsMap()
|
||||||
{
|
{
|
||||||
|
@ -67,9 +68,9 @@ public class ClientCompactionTaskTransformSpecTest
|
||||||
final ClientCompactionTaskTransformSpec spec = new ClientCompactionTaskTransformSpec(new SelectorDimFilter(dimension, value, null));
|
final ClientCompactionTaskTransformSpec spec = new ClientCompactionTaskTransformSpec(new SelectorDimFilter(dimension, value, null));
|
||||||
final Map<String, Object> map = spec.asMap(objectMapper);
|
final Map<String, Object> map = spec.asMap(objectMapper);
|
||||||
Assert.assertNotNull(map);
|
Assert.assertNotNull(map);
|
||||||
Assert.assertEquals(4, ((Map) map.get("filter")).size());
|
Assert.assertEquals(3, ((Map<String, Object>) map.get("filter")).size());
|
||||||
Assert.assertEquals(dimension, ((Map) map.get("filter")).get("dimension"));
|
Assert.assertEquals(dimension, ((Map<String, Object>) map.get("filter")).get("dimension"));
|
||||||
Assert.assertEquals(value, ((Map) map.get("filter")).get("value"));
|
Assert.assertEquals(value, ((Map<String, Object>) map.get("filter")).get("value"));
|
||||||
ClientCompactionTaskTransformSpec actual = objectMapper.convertValue(map, ClientCompactionTaskTransformSpec.class);
|
ClientCompactionTaskTransformSpec actual = objectMapper.convertValue(map, ClientCompactionTaskTransformSpec.class);
|
||||||
Assert.assertEquals(spec, actual);
|
Assert.assertEquals(spec, actual);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,12 @@ public class DefaultRequestLogEventTest
|
||||||
nativeLine);
|
nativeLine);
|
||||||
|
|
||||||
String logEventJson = objectMapper.writeValueAsString(defaultRequestLogEvent);
|
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));
|
Assert.assertEquals(objectMapper.readTree(expected), objectMapper.readTree(logEventJson));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,8 +242,6 @@ public abstract class DruidAvaticaHandlerTest extends CalciteTestBase
|
||||||
clientLosAngeles = DriverManager.getConnection(url, propertiesLosAngeles);
|
clientLosAngeles = DriverManager.getConnection(url, propertiesLosAngeles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception
|
public void tearDown() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -380,7 +378,7 @@ public abstract class DruidAvaticaHandlerTest extends CalciteTestBase
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
"PLAN",
|
"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
|
DUMMY_SQL_QUERY_ID
|
||||||
),
|
),
|
||||||
"RESOURCES",
|
"RESOURCES",
|
||||||
|
|
|
@ -392,8 +392,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTopNLimitWrapping() throws Exception
|
public void testTopNLimitWrapping() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -431,7 +429,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTopNLimitWrappingOrderByAgg() throws Exception
|
public void testTopNLimitWrappingOrderByAgg() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -1554,7 +1551,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
@Test
|
@Test
|
||||||
public void testOrderByLatestFloat() throws Exception
|
public void testOrderByLatestFloat() throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
List<Object[]> expected;
|
List<Object[]> expected;
|
||||||
if (NullHandling.replaceWithDefault()) {
|
if (NullHandling.replaceWithDefault()) {
|
||||||
expected = ImmutableList.of(
|
expected = ImmutableList.of(
|
||||||
|
@ -2566,7 +2562,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
@Test
|
@Test
|
||||||
public void testTopNWithSelectAndOrderByProjections() throws Exception
|
public void testTopNWithSelectAndOrderByProjections() throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
testQuery(
|
testQuery(
|
||||||
"SELECT\n"
|
"SELECT\n"
|
||||||
+ " dim1,"
|
+ " dim1,"
|
||||||
|
@ -3130,7 +3125,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPruneDeadAggregators() throws Exception
|
public void testPruneDeadAggregators() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -3414,7 +3408,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNullFloatFilter() throws Exception
|
public void testNullFloatFilter() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -4372,18 +4365,14 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
skipVectorize();
|
skipVectorize();
|
||||||
|
|
||||||
final String query = "EXPLAIN PLAN FOR SELECT COUNT(*) FROM view.aview WHERE dim1_firstchar <> 'z'";
|
final String query = "EXPLAIN PLAN FOR SELECT COUNT(*) FROM view.aview WHERE dim1_firstchar <> 'z'";
|
||||||
final String legacyExplanation = "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\":{\"type\":\"and\",\"fields\":[{\"type\":\"selector\",\"dimension\":\"dim2\",\"value\":\"a\",\"extractionFn\":null},{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"z\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}}]},\"granularity\":{\"type\":\"all\"},\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],\"postAggregations\":[],\"limit\":2147483647,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}}], signature=[{a0:LONG}])\n";
|
final String legacyExplanation = "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\"]},\"filter\":{\"type\":\"and\",\"fields\":[{\"type\":\"selector\",\"dimension\":\"dim2\",\"value\":\"a\"},{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"z\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}}]},\"granularity\":{\"type\":\"all\"},\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}}], signature=[{a0:LONG}])\n";
|
||||||
final String explanation = "[{"
|
final String explanation = "[{"
|
||||||
+ "\"query\":{\"queryType\":\"timeseries\","
|
+ "\"query\":{\"queryType\":\"timeseries\","
|
||||||
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
||||||
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
||||||
+ "\"descending\":false,"
|
+ "\"filter\":{\"type\":\"and\",\"fields\":[{\"type\":\"selector\",\"dimension\":\"dim2\",\"value\":\"a\"},{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"z\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}}]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"filter\":{\"type\":\"and\",\"fields\":[{\"type\":\"selector\",\"dimension\":\"dim2\",\"value\":\"a\",\"extractionFn\":null},{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"z\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}}]},"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"},"
|
+ "\"granularity\":{\"type\":\"all\"},"
|
||||||
+ "\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],"
|
+ "\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],"
|
||||||
+ "\"postAggregations\":[],"
|
|
||||||
+ "\"limit\":2147483647,"
|
|
||||||
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}},"
|
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}},"
|
||||||
+ "\"signature\":[{\"name\":\"a0\",\"type\":\"LONG\"}]"
|
+ "\"signature\":[{\"name\":\"a0\",\"type\":\"LONG\"}]"
|
||||||
+ "}]";
|
+ "}]";
|
||||||
|
@ -4668,7 +4657,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleAggregations() throws Exception
|
public void testSimpleAggregations() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -5399,7 +5387,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
"SELECT foo.dim1, foo.dim2, l.k, l.v\n"
|
"SELECT foo.dim1, foo.dim2, l.k, l.v\n"
|
||||||
+ "FROM foo INNER JOIN lookup.lookyloo l ON CHARACTER_LENGTH(foo.dim2 || l.k) > 3\n",
|
+ "FROM foo INNER JOIN lookup.lookyloo l ON CHARACTER_LENGTH(foo.dim2 || l.k) > 3\n",
|
||||||
"Possible error: SQL requires a join with 'GREATER_THAN' condition that is not supported."
|
"Possible error: SQL requires a join with 'GREATER_THAN' condition that is not supported."
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for (final Map.Entry<String, String> queryErrorPair : queries.entrySet()) {
|
for (final Map.Entry<String, String> queryErrorPair : queries.entrySet()) {
|
||||||
|
@ -5505,7 +5492,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCountStarWithBoundFilterSimplifyAnd() throws Exception
|
public void testCountStarWithBoundFilterSimplifyAnd() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -6563,7 +6549,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
@Test
|
@Test
|
||||||
public void testNestedGroupBy() throws Exception
|
public void testNestedGroupBy() throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
testQuery(
|
testQuery(
|
||||||
"SELECT\n"
|
"SELECT\n"
|
||||||
+ " FLOOR(__time to hour) AS __time,\n"
|
+ " FLOOR(__time to hour) AS __time,\n"
|
||||||
|
@ -7129,7 +7114,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExplainExactCountDistinctOfSemiJoinResult() throws Exception
|
public void testExplainExactCountDistinctOfSemiJoinResult() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -7145,24 +7129,19 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
+ " )\n"
|
+ " )\n"
|
||||||
+ ")";
|
+ ")";
|
||||||
final String legacyExplanation =
|
final String legacyExplanation =
|
||||||
"DruidOuterQueryRel(query=[{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"query\",\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"__subquery__\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"list\",\"batchSize\":20480,\"filter\":null,\"context\":{},\"descending\":false,\"granularity\":{\"type\":\"all\"}}},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"filter\":null,\"granularity\":{\"type\":\"all\"},\"dimensions\":[],\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],\"postAggregations\":[],\"having\":null,\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false}], signature=[{a0:LONG}])\n"
|
"DruidOuterQueryRel(query=[{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"query\",\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"__subquery__\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"list\",\"granularity\":{\"type\":\"all\"}}},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"granularity\":{\"type\":\"all\"},\"dimensions\":[],\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}}], signature=[{a0:LONG}])\n"
|
||||||
+ " DruidJoinQueryRel(condition=[=(SUBSTRING($3, 1, 1), $8)], joinType=[inner], query=[{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"table\",\"name\":\"__join__\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"filter\":null,\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"default\",\"dimension\":\"dim2\",\"outputName\":\"d0\",\"outputType\":\"STRING\"}],\"aggregations\":[],\"postAggregations\":[],\"having\":null,\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false}], signature=[{d0:STRING}])\n"
|
+ " DruidJoinQueryRel(condition=[=(SUBSTRING($3, 1, 1), $8)], joinType=[inner], query=[{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"table\",\"name\":\"__join__\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"default\",\"dimension\":\"dim2\",\"outputName\":\"d0\",\"outputType\":\"STRING\"}],\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}}], signature=[{d0:STRING}])\n"
|
||||||
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":null,\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n"
|
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n"
|
||||||
+ " DruidQueryRel(query=[{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"filter\":{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":null,\"extractionFn\":null}},\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"extraction\",\"dimension\":\"dim1\",\"outputName\":\"d0\",\"outputType\":\"STRING\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}],\"aggregations\":[],\"postAggregations\":[],\"having\":null,\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false}], signature=[{d0:STRING}])\n";
|
+ " DruidQueryRel(query=[{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"filter\":{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":null}},\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"extraction\",\"dimension\":\"dim1\",\"outputName\":\"d0\",\"outputType\":\"STRING\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}],\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}}], signature=[{d0:STRING}])\n";
|
||||||
final String explanation = "["
|
final String explanation = "["
|
||||||
+ "{\"query\":{\"queryType\":\"groupBy\","
|
+ "{\"query\":{\"queryType\":\"groupBy\","
|
||||||
+ "\"dataSource\":{\"type\":\"query\",\"query\":{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"join\",\"left\":{\"type\":\"table\",\"name\":\"foo\"},\"right\":{\"type\":\"query\",\"query\":{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"filter\":{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":null,\"extractionFn\":null}},\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"extraction\",\"dimension\":\"dim1\",\"outputName\":\"d0\",\"outputType\":\"STRING\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}],\"aggregations\":[],\"postAggregations\":[],\"having\":null,\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false}},\"rightPrefix\":\"j0.\",\"condition\":\"(substring(\\\"dim2\\\", 0, 1) == \\\"j0.d0\\\")\",\"joinType\":\"INNER\",\"leftFilter\":null},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"filter\":null,\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"default\",\"dimension\":\"dim2\",\"outputName\":\"d0\",\"outputType\":\"STRING\"}],\"aggregations\":[],\"postAggregations\":[],\"having\":null,\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false}},"
|
+ "\"dataSource\":{\"type\":\"query\",\"query\":{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"join\",\"left\":{\"type\":\"table\",\"name\":\"foo\"},\"right\":{\"type\":\"query\",\"query\":{\"queryType\":\"groupBy\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"filter\":{\"type\":\"not\",\"field\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":null}},\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"extraction\",\"dimension\":\"dim1\",\"outputName\":\"d0\",\"outputType\":\"STRING\",\"extractionFn\":{\"type\":\"substring\",\"index\":0,\"length\":1}}],\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}}},\"rightPrefix\":\"j0.\",\"condition\":\"(substring(\\\"dim2\\\", 0, 1) == \\\"j0.d0\\\")\",\"joinType\":\"INNER\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"granularity\":{\"type\":\"all\"},\"dimensions\":[{\"type\":\"default\",\"dimension\":\"dim2\",\"outputName\":\"d0\",\"outputType\":\"STRING\"}],\"limitSpec\":{\"type\":\"NoopLimitSpec\"},\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}}},"
|
||||||
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"},"
|
+ "\"granularity\":{\"type\":\"all\"},"
|
||||||
+ "\"dimensions\":[],"
|
+ "\"dimensions\":[],"
|
||||||
+ "\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],"
|
+ "\"aggregations\":[{\"type\":\"count\",\"name\":\"a0\"}],"
|
||||||
+ "\"postAggregations\":[],"
|
|
||||||
+ "\"having\":null,"
|
|
||||||
+ "\"limitSpec\":{\"type\":\"NoopLimitSpec\"},"
|
+ "\"limitSpec\":{\"type\":\"NoopLimitSpec\"},"
|
||||||
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"}},"
|
||||||
+ "\"descending\":false},"
|
|
||||||
+ "\"signature\":[{\"name\":\"a0\",\"type\":\"LONG\"}]"
|
+ "\"signature\":[{\"name\":\"a0\",\"type\":\"LONG\"}]"
|
||||||
+ "}]";
|
+ "}]";
|
||||||
final String resources = "[{\"name\":\"foo\",\"type\":\"DATASOURCE\"}]";
|
final String resources = "[{\"name\":\"foo\",\"type\":\"DATASOURCE\"}]";
|
||||||
|
@ -7196,20 +7175,15 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
|
|
||||||
// Skip vectorization since otherwise the "context" will change for each subtest.
|
// Skip vectorization since otherwise the "context" will change for each subtest.
|
||||||
skipVectorize();
|
skipVectorize();
|
||||||
String legacyExplanation = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":null,\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n";
|
String legacyExplanation = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n";
|
||||||
String legacyExplanationWithContext = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":null,\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"useNativeQueryExplain\":false},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n";
|
String legacyExplanationWithContext = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"useNativeQueryExplain\":false},\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n";
|
||||||
String explanation = "[{"
|
String explanation = "[{"
|
||||||
+ "\"query\":{\"queryType\":\"scan\","
|
+ "\"query\":{\"queryType\":\"scan\","
|
||||||
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
||||||
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"resultFormat\":\"compactedList\","
|
+ "\"resultFormat\":\"compactedList\","
|
||||||
+ "\"batchSize\":20480,"
|
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],"
|
+ "\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],"
|
||||||
+ "\"legacy\":false,"
|
|
||||||
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
||||||
+ "\"descending\":false,"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"}},"
|
+ "\"granularity\":{\"type\":\"all\"}},"
|
||||||
+ "\"signature\":[{\"name\":\"__time\",\"type\":\"LONG\"},{\"name\":\"cnt\",\"type\":\"LONG\"},{\"name\":\"dim1\",\"type\":\"STRING\"},{\"name\":\"dim2\",\"type\":\"STRING\"},{\"name\":\"dim3\",\"type\":\"STRING\"},{\"name\":\"m1\",\"type\":\"FLOAT\"},{\"name\":\"m2\",\"type\":\"DOUBLE\"},{\"name\":\"unique_dim1\",\"type\":\"COMPLEX<hyperUnique>\"}]"
|
+ "\"signature\":[{\"name\":\"__time\",\"type\":\"LONG\"},{\"name\":\"cnt\",\"type\":\"LONG\"},{\"name\":\"dim1\",\"type\":\"STRING\"},{\"name\":\"dim2\",\"type\":\"STRING\"},{\"name\":\"dim3\",\"type\":\"STRING\"},{\"name\":\"m1\",\"type\":\"FLOAT\"},{\"name\":\"m2\",\"type\":\"DOUBLE\"},{\"name\":\"unique_dim1\",\"type\":\"COMPLEX<hyperUnique>\"}]"
|
||||||
+ "}]";
|
+ "}]";
|
||||||
|
@ -7218,14 +7192,9 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
+ "\"query\":{\"queryType\":\"scan\","
|
+ "\"query\":{\"queryType\":\"scan\","
|
||||||
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
||||||
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"resultFormat\":\"compactedList\","
|
+ "\"resultFormat\":\"compactedList\","
|
||||||
+ "\"batchSize\":20480,"
|
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],"
|
+ "\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],"
|
||||||
+ "\"legacy\":false,"
|
|
||||||
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"useNativeQueryExplain\":true,\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"useNativeQueryExplain\":true,\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
||||||
+ "\"descending\":false,"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"}},"
|
+ "\"granularity\":{\"type\":\"all\"}},"
|
||||||
+ "\"signature\":[{\"name\":\"__time\",\"type\":\"LONG\"},{\"name\":\"cnt\",\"type\":\"LONG\"},{\"name\":\"dim1\",\"type\":\"STRING\"},{\"name\":\"dim2\",\"type\":\"STRING\"},{\"name\":\"dim3\",\"type\":\"STRING\"},{\"name\":\"m1\",\"type\":\"FLOAT\"},{\"name\":\"m2\",\"type\":\"DOUBLE\"},{\"name\":\"unique_dim1\",\"type\":\"COMPLEX<hyperUnique>\"}]"
|
+ "\"signature\":[{\"name\":\"__time\",\"type\":\"LONG\"},{\"name\":\"cnt\",\"type\":\"LONG\"},{\"name\":\"dim1\",\"type\":\"STRING\"},{\"name\":\"dim2\",\"type\":\"STRING\"},{\"name\":\"dim3\",\"type\":\"STRING\"},{\"name\":\"m1\",\"type\":\"FLOAT\"},{\"name\":\"m2\",\"type\":\"DOUBLE\"},{\"name\":\"unique_dim1\",\"type\":\"COMPLEX<hyperUnique>\"}]"
|
||||||
+ "}]";
|
+ "}]";
|
||||||
|
@ -7273,21 +7242,21 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
+ "UNION ALL (SELECT dim1 FROM druid.foo WHERE dim1 = '42'\n"
|
+ "UNION ALL (SELECT dim1 FROM druid.foo WHERE dim1 = '42'\n"
|
||||||
+ "UNION ALL SELECT dim1 FROM druid.foo WHERE dim1 = '44')";
|
+ "UNION ALL SELECT dim1 FROM druid.foo WHERE dim1 = '44')";
|
||||||
final String legacyExplanation = "DruidUnionRel(limit=[-1])\n"
|
final String legacyExplanation = "DruidUnionRel(limit=[-1])\n"
|
||||||
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":null,\"columns\":[\"dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING}])\n"
|
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"columns\":[\"dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING}])\n"
|
||||||
+ " DruidUnionRel(limit=[-1])\n"
|
+ " DruidUnionRel(limit=[-1])\n"
|
||||||
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"42\",\"extractionFn\":null},\"columns\":[\"dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING}])\n"
|
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"42\"},\"columns\":[\"dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING}])\n"
|
||||||
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"44\",\"extractionFn\":null},\"columns\":[\"dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING}])\n";
|
+ " DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"44\"},\"columns\":[\"dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}}], signature=[{dim1:STRING}])\n";
|
||||||
final String explanation = "["
|
final String explanation = "["
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":null,\"columns\":[\"dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}},"
|
+ "\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"columns\":[\"dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}},"
|
||||||
+ "\"signature\":[{\"name\":\"dim1\",\"type\":\"STRING\"}]"
|
+ "\"signature\":[{\"name\":\"dim1\",\"type\":\"STRING\"}]"
|
||||||
+ "},"
|
+ "},"
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"42\",\"extractionFn\":null},\"columns\":[\"dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}},"
|
+ "\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"42\"},\"columns\":[\"dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}},"
|
||||||
+ "\"signature\":[{\"name\":\"dim1\",\"type\":\"STRING\"}]"
|
+ "\"signature\":[{\"name\":\"dim1\",\"type\":\"STRING\"}]"
|
||||||
+ "},"
|
+ "},"
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"44\",\"extractionFn\":null},\"columns\":[\"dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}},"
|
+ "\"query\":{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"filter\":{\"type\":\"selector\",\"dimension\":\"dim1\",\"value\":\"44\"},\"columns\":[\"dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}},"
|
||||||
+ "\"signature\":[{\"name\":\"dim1\",\"type\":\"STRING\"}]"
|
+ "\"signature\":[{\"name\":\"dim1\",\"type\":\"STRING\"}]"
|
||||||
+ "}]";
|
+ "}]";
|
||||||
final String resources = "[{\"name\":\"foo\",\"type\":\"DATASOURCE\"}]";
|
final String resources = "[{\"name\":\"foo\",\"type\":\"DATASOURCE\"}]";
|
||||||
|
@ -7402,7 +7371,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
"SELECT\n"
|
"SELECT\n"
|
||||||
+ " SUM(cnt),\n"
|
+ " SUM(cnt),\n"
|
||||||
+ " COUNT(*)\n"
|
+ " COUNT(*)\n"
|
||||||
+ "FROM (SELECT dim2, SUM(cnt) AS cnt FROM druid.foo GROUP BY dim2 LIMIT 1)"
|
+ "FROM (SELECT dim2, SUM(cnt) AS cnt FROM druid.foo GROUP BY dim2 LIMIT 1)\n"
|
||||||
+ "WHERE cnt > 0",
|
+ "WHERE cnt > 0",
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
GroupByQuery.builder()
|
GroupByQuery.builder()
|
||||||
|
@ -8073,8 +8042,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFilterOnCurrentTimestampLosAngeles() throws Exception
|
public void testFilterOnCurrentTimestampLosAngeles() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -11029,7 +10996,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTimeExtractWithTooFewArguments() throws Exception
|
public void testTimeExtractWithTooFewArguments() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -11047,7 +11013,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUsingSubqueryAsFilterOnTwoColumns() throws Exception
|
public void testUsingSubqueryAsFilterOnTwoColumns() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -11247,7 +11212,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOrderByAlongWithAliasOrderByTimeGroupByMulti() throws Exception
|
public void testOrderByAlongWithAliasOrderByTimeGroupByMulti() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -11281,7 +11245,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOrderByAlongWithAliasOrderByTimeGroupByOneCol() throws Exception
|
public void testOrderByAlongWithAliasOrderByTimeGroupByOneCol() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -11413,7 +11376,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProjectAfterSort3WithoutAmbiguity() throws Exception
|
public void testProjectAfterSort3WithoutAmbiguity() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -11836,7 +11798,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// nested groupby only requires time condition for inner most query
|
// nested GROUP BY only requires time condition for inner most query
|
||||||
testQuery(
|
testQuery(
|
||||||
PLANNER_CONFIG_REQUIRE_TIME_CONDITION,
|
PLANNER_CONFIG_REQUIRE_TIME_CONDITION,
|
||||||
"SELECT\n"
|
"SELECT\n"
|
||||||
|
@ -12884,10 +12846,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRoundFuc() throws Exception
|
public void testRoundFunc() throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
testQuery(
|
testQuery(
|
||||||
|
@ -13337,8 +13297,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringAgg() throws Exception
|
public void testStringAgg() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -13785,7 +13743,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* see {@link CalciteTests#RAW_ROWS1_WITH_NUMERIC_DIMS} for the input data source of this test
|
* see {@link CalciteTests#RAW_ROWS1_WITH_NUMERIC_DIMS} for the input data source of this test
|
||||||
*/
|
*/
|
||||||
|
@ -13887,8 +13844,8 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
this.expectedException.expect(SqlPlanningException.class);
|
this.expectedException.expect(SqlPlanningException.class);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* frankly speaking, the exception message thrown here is a little bit confusion
|
* frankly speaking, the exception message thrown here is a little bit confusing
|
||||||
* it says it's 'expecting 1 arguments' but acturally HUMAN_READABLE_BINARY_BYTE_FORMAT supports 1 or 2 arguments
|
* it says it's 'expecting 1 arguments' but actually HUMAN_READABLE_BINARY_BYTE_FORMAT supports 1 or 2 arguments
|
||||||
*
|
*
|
||||||
* The message is returned from {@link org.apache.calcite.sql.validate.SqlValidatorImpl#handleUnresolvedFunction},
|
* The message is returned from {@link org.apache.calcite.sql.validate.SqlValidatorImpl#handleUnresolvedFunction},
|
||||||
* and we can see from its implementation that it gets the min number arguments to format the exception message.
|
* and we can see from its implementation that it gets the min number arguments to format the exception message.
|
||||||
|
@ -13996,7 +13953,7 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReturnEmptyRowWhenGroupByIsConvertedToTimeseriesWithMutlipleConstantDimensions() throws Exception
|
public void testReturnEmptyRowWhenGroupByIsConvertedToTimeseriesWithMultipleConstantDimensions() throws Exception
|
||||||
{
|
{
|
||||||
skipVectorize();
|
skipVectorize();
|
||||||
testQuery(
|
testQuery(
|
||||||
|
|
|
@ -534,18 +534,13 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
||||||
+ "\"query\":{\"queryType\":\"scan\","
|
+ "\"query\":{\"queryType\":\"scan\","
|
||||||
+ "\"dataSource\":{\"type\":\"inline\",\"columnNames\":[\"EXPR$0\"],\"columnTypes\":[\"LONG\"],\"rows\":[[2]]},"
|
+ "\"dataSource\":{\"type\":\"inline\",\"columnNames\":[\"EXPR$0\"],\"columnTypes\":[\"LONG\"],\"rows\":[[2]]},"
|
||||||
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"resultFormat\":\"compactedList\","
|
+ "\"resultFormat\":\"compactedList\","
|
||||||
+ "\"batchSize\":20480,"
|
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"EXPR$0\"],"
|
+ "\"columns\":[\"EXPR$0\"],"
|
||||||
+ "\"legacy\":false,"
|
|
||||||
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
||||||
+ "\"descending\":false,"
|
|
||||||
+ "\"granularity\":{\"type\":\"all\"}},"
|
+ "\"granularity\":{\"type\":\"all\"}},"
|
||||||
+ "\"signature\":[{\"name\":\"EXPR$0\",\"type\":\"LONG\"}]"
|
+ "\"signature\":[{\"name\":\"EXPR$0\",\"type\":\"LONG\"}]"
|
||||||
+ "}]";
|
+ "}]";
|
||||||
final String legacyExplanation = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"inline\",\"columnNames\":[\"EXPR$0\"],\"columnTypes\":[\"LONG\"],\"rows\":[[2]]},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":null,\"columns\":[\"EXPR$0\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{EXPR$0:LONG}])\n";
|
final String legacyExplanation = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"inline\",\"columnNames\":[\"EXPR$0\"],\"columnTypes\":[\"LONG\"],\"rows\":[[2]]},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"columns\":[\"EXPR$0\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}}], signature=[{EXPR$0:LONG}])\n";
|
||||||
final String resources = "[]";
|
final String resources = "[]";
|
||||||
|
|
||||||
testQuery(
|
testQuery(
|
||||||
|
@ -1275,22 +1270,17 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
||||||
skipVectorize();
|
skipVectorize();
|
||||||
|
|
||||||
final String query = "EXPLAIN PLAN FOR SELECT * FROM druid.foo";
|
final String query = "EXPLAIN PLAN FOR SELECT * FROM druid.foo";
|
||||||
final String legacyExplanation = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"virtualColumns\":[],\"resultFormat\":\"compactedList\",\"batchSize\":20480,\"filter\":null,\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"legacy\":false,\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"descending\":false,\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n";
|
final String legacyExplanation = "DruidQueryRel(query=[{\"queryType\":\"scan\",\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},\"resultFormat\":\"compactedList\",\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},\"granularity\":{\"type\":\"all\"}}], signature=[{__time:LONG, cnt:LONG, dim1:STRING, dim2:STRING, dim3:STRING, m1:FLOAT, m2:DOUBLE, unique_dim1:COMPLEX<hyperUnique>}])\n";
|
||||||
final String explanation = "[{"
|
final String explanation = "[{"
|
||||||
+ "\"query\":{\"queryType\":\"scan\","
|
+ "\"query\":{\"queryType\":\"scan\","
|
||||||
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
+ "\"dataSource\":{\"type\":\"table\",\"name\":\"foo\"},"
|
||||||
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
+ "\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z\"]},"
|
||||||
+ "\"virtualColumns\":[],"
|
|
||||||
+ "\"resultFormat\":\"compactedList\","
|
+ "\"resultFormat\":\"compactedList\","
|
||||||
+ "\"batchSize\":20480,"
|
|
||||||
+ "\"filter\":null,"
|
|
||||||
+ "\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],"
|
+ "\"columns\":[\"__time\",\"cnt\",\"dim1\",\"dim2\",\"dim3\",\"m1\",\"m2\",\"unique_dim1\"],"
|
||||||
+ "\"legacy\":false,"
|
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
||||||
+ "\"context\":{\"defaultTimeout\":300000,\"maxScatterGatherBytes\":9223372036854775807,\"sqlCurrentTimestamp\":\"2000-01-01T00:00:00Z\",\"sqlQueryId\":\"dummy\",\"vectorize\":\"false\",\"vectorizeVirtualColumns\":\"false\"},"
|
+ "\"granularity\":{\"type\":\"all\"}},"
|
||||||
+ "\"descending\":false,"
|
+ "\"signature\":[{\"name\":\"__time\",\"type\":\"LONG\"},{\"name\":\"cnt\",\"type\":\"LONG\"},{\"name\":\"dim1\",\"type\":\"STRING\"},{\"name\":\"dim2\",\"type\":\"STRING\"},{\"name\":\"dim3\",\"type\":\"STRING\"},{\"name\":\"m1\",\"type\":\"FLOAT\"},{\"name\":\"m2\",\"type\":\"DOUBLE\"},{\"name\":\"unique_dim1\",\"type\":\"COMPLEX<hyperUnique>\"}]"
|
||||||
+ "\"granularity\":{\"type\":\"all\"}},"
|
+ "}]";
|
||||||
+ "\"signature\":[{\"name\":\"__time\",\"type\":\"LONG\"},{\"name\":\"cnt\",\"type\":\"LONG\"},{\"name\":\"dim1\",\"type\":\"STRING\"},{\"name\":\"dim2\",\"type\":\"STRING\"},{\"name\":\"dim3\",\"type\":\"STRING\"},{\"name\":\"m1\",\"type\":\"FLOAT\"},{\"name\":\"m2\",\"type\":\"DOUBLE\"},{\"name\":\"unique_dim1\",\"type\":\"COMPLEX<hyperUnique>\"}]"
|
|
||||||
+ "}]";
|
|
||||||
final String resources = "[{\"name\":\"foo\",\"type\":\"DATASOURCE\"}]";
|
final String resources = "[{\"name\":\"foo\",\"type\":\"DATASOURCE\"}]";
|
||||||
|
|
||||||
testQuery(
|
testQuery(
|
||||||
|
|
|
@ -86,11 +86,11 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DruidSchemaTest extends DruidSchemaTestCommon
|
public class DruidSchemaTest extends DruidSchemaTestCommon
|
||||||
{
|
{
|
||||||
private SpecificSegmentsQuerySegmentWalker walker = null;
|
private SpecificSegmentsQuerySegmentWalker walker;
|
||||||
private TestServerInventoryView serverView;
|
private TestServerInventoryView serverView;
|
||||||
private List<ImmutableDruidServer> druidServers;
|
private List<ImmutableDruidServer> druidServers;
|
||||||
private DruidSchema schema = null;
|
private DruidSchema schema;
|
||||||
private DruidSchema schema2 = null;
|
private DruidSchema schema2;
|
||||||
private CountDownLatch buildTableLatch = new CountDownLatch(1);
|
private CountDownLatch buildTableLatch = new CountDownLatch(1);
|
||||||
private CountDownLatch markDataSourceLatch = new CountDownLatch(1);
|
private CountDownLatch markDataSourceLatch = new CountDownLatch(1);
|
||||||
private static final ObjectMapper MAPPER = TestHelper.makeJsonMapper();
|
private static final ObjectMapper MAPPER = TestHelper.makeJsonMapper();
|
||||||
|
|
|
@ -1171,7 +1171,7 @@ public class SqlResourceTest extends CalciteTestBase
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
"PLAN",
|
"PLAN",
|
||||||
StringUtils.format(
|
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\"}}], signature=[{a0:LONG}])\n",
|
"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\"}}], signature=[{a0:LONG}])\n",
|
||||||
DUMMY_SQL_QUERY_ID
|
DUMMY_SQL_QUERY_ID
|
||||||
),
|
),
|
||||||
"RESOURCES",
|
"RESOURCES",
|
||||||
|
|
Loading…
Reference in New Issue