[Backport] Patches (#17039) (#17173) (#17216) (#17224) (#17230) (#17238) (#17251)

* SQL: Use regular filters for time filtering in subqueries. (#17173)
* RunWorkOrder: Account for two simultaneous statistics collectors. (#17216)
* DartTableInputSpecSlicer: Fix for TLS workers. (#17224)
* Upgrade avro - minor version (#17230)
* SuperSorter: Don't set allDone if it's already set. (#17238)
* Decoupled planning: improve join support (#17039)
---------
Co-authored-by: Gian Merlino <gianmerlino@gmail.com>
Co-authored-by: Abhishek Agarwal <1477457+abhishekagarwal87@users.noreply.github.com>
Co-authored-by: Zoltan Haindrich <kirk@rxd.hu>
This commit is contained in:
Kashif Faraz 2024-10-05 09:22:57 +05:30 committed by GitHub
parent 351330b990
commit 10528a6d9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 2662 additions and 868 deletions

View File

@ -168,7 +168,7 @@ public class DartTableInputSpecSlicer implements InputSpecSlicer
return UNKNOWN;
}
final String serverHostAndPort = server.getServer().getHostAndPort();
final String serverHostAndPort = server.getServer().getHost();
final int workerNumber = workerIdToNumber.getInt(serverHostAndPort);
// The worker number may be UNKNOWN in a race condition, such as the set of Historicals changing while

View File

@ -1024,7 +1024,8 @@ public class RunWorkOrder
{
final StageDefinition stageDefinition = workOrder.getStageDefinition();
final List<OutputChannel> retVal = new ArrayList<>();
final List<KeyStatisticsCollectionProcessor> processors = new ArrayList<>();
final int numOutputChannels = channels.getAllChannels().size();
final List<KeyStatisticsCollectionProcessor> processors = new ArrayList<>(numOutputChannels);
for (final OutputChannel outputChannel : channels.getAllChannels()) {
final BlockingQueueFrameChannel channel = BlockingQueueFrameChannel.minimal();
@ -1037,7 +1038,9 @@ public class RunWorkOrder
stageDefinition.getFrameReader(),
stageDefinition.getClusterBy(),
stageDefinition.createResultKeyStatisticsCollector(
frameContext.memoryParameters().getPartitionStatisticsMaxRetainedBytes()
// Divide by two: half for the per-processor collectors together, half for the combined collector.
// Then divide by numOutputChannels: one portion per processor.
frameContext.memoryParameters().getPartitionStatisticsMaxRetainedBytes() / 2 / numOutputChannels
)
)
);
@ -1049,7 +1052,9 @@ public class RunWorkOrder
ProcessorManagers.of(processors)
.withAccumulation(
stageDefinition.createResultKeyStatisticsCollector(
frameContext.memoryParameters().getPartitionStatisticsMaxRetainedBytes()
// Divide by two: half for the per-processor collectors, half for the
// combined collector.
frameContext.memoryParameters().getPartitionStatisticsMaxRetainedBytes() / 2
),
ClusterByStatisticsCollector::addAll
),

View File

@ -281,7 +281,7 @@ public class WorkerMemoryParameters
frameSize,
superSorterConcurrentProcessors,
superSorterMaxChannelsPerMerger,
Math.min(Integer.MAX_VALUE, partitionStatsMemory / numProcessingThreads),
partitionStatsMemory,
hasBroadcastInputs ? computeBroadcastBufferMemory(bundleMemory) : 0
);
}

View File

@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.apache.druid.collections.ResourceHolder;
import org.apache.druid.error.DruidException;
import org.apache.druid.frame.Frame;
import org.apache.druid.frame.channel.FrameWithPartition;
import org.apache.druid.frame.channel.ReadableFrameChannel;
@ -64,7 +65,6 @@ import org.apache.druid.query.Order;
import org.apache.druid.query.scan.ScanQuery;
import org.apache.druid.query.scan.ScanQueryEngine;
import org.apache.druid.query.scan.ScanResultValue;
import org.apache.druid.query.spec.MultipleIntervalSegmentSpec;
import org.apache.druid.query.spec.SpecificSegmentSpec;
import org.apache.druid.segment.ColumnSelectorFactory;
import org.apache.druid.segment.CompleteSegment;
@ -312,13 +312,14 @@ public class ScanQueryFrameProcessor extends BaseLeafFrameProcessor
);
}
if (!Intervals.ONLY_ETERNITY.equals(query.getIntervals())) {
// runWithInputChannel is for running on subquery results, where we don't expect to see "intervals" set.
// The SQL planner avoid it for subqueries; see DruidQuery#canUseIntervalFiltering.
throw DruidException.defensive("Expected eternity intervals, but got[%s]", query.getIntervals());
}
final CursorHolder nextCursorHolder =
cursorFactory.makeCursorHolder(
ScanQueryEngine.makeCursorBuildSpec(
query.withQuerySegmentSpec(new MultipleIntervalSegmentSpec(Intervals.ONLY_ETERNITY)),
null
)
);
cursorFactory.makeCursorHolder(ScanQueryEngine.makeCursorBuildSpec(query, null));
final Cursor nextCursor = nextCursorHolder.asCursor();
if (nextCursor == null) {

View File

@ -146,10 +146,13 @@ public class DistinctKeyCollector implements KeyCollector<DistinctKeyCollector>
if (retainedKeys.isEmpty()) {
this.spaceReductionFactor = other.spaceReductionFactor;
}
for (final Object2LongMap.Entry<RowKey> otherEntry : other.retainedKeys.object2LongEntrySet()) {
add(otherEntry.getKey(), otherEntry.getLongValue());
this.retainedKeys.putAll(other.retainedKeys);
this.maxBytes = other.maxBytes;
this.totalWeightUnadjusted = other.totalWeightUnadjusted;
} else {
for (final Object2LongMap.Entry<RowKey> otherEntry : other.retainedKeys.object2LongEntrySet()) {
add(otherEntry.getKey(), otherEntry.getLongValue());
}
}
}

View File

@ -86,7 +86,9 @@ public class QuantilesSketchKeyCollector implements KeyCollector<QuantilesSketch
double otherBytesCount = other.averageKeyLength * other.getSketch().getN();
averageKeyLength = ((sketchBytesCount + otherBytesCount) / (sketch.getN() + other.sketch.getN()));
union.union(sketch);
if (!sketch.isEmpty()) {
union.union(sketch);
}
union.union(other.sketch);
sketch = union.getResultAndReset();
}

View File

@ -76,8 +76,8 @@ public class DartTableInputSpecSlicerTest extends InitializedNullHandlingTest
* This makes tests deterministic.
*/
private static final List<DruidServerMetadata> SERVERS = ImmutableList.of(
new DruidServerMetadata("no", "localhost:1001", null, 1, ServerType.HISTORICAL, "__default", 2),
new DruidServerMetadata("no", "localhost:1002", null, 1, ServerType.HISTORICAL, "__default", 1),
new DruidServerMetadata("no", "localhost:1001", null, 1, ServerType.HISTORICAL, "__default", 2), // plaintext
new DruidServerMetadata("no", null, "localhost:1002", 1, ServerType.HISTORICAL, "__default", 1), // TLS
new DruidServerMetadata("no", "localhost:1003", null, 1, ServerType.REALTIME, "__default", 0)
);
@ -86,7 +86,7 @@ public class DartTableInputSpecSlicerTest extends InitializedNullHandlingTest
*/
private static final List<String> WORKER_IDS =
SERVERS.stream()
.map(server -> new WorkerId("http", server.getHostAndPort(), QUERY_ID).toString())
.map(server -> new WorkerId("http", server.getHost(), QUERY_ID).toString())
.collect(Collectors.toList());
/**

View File

@ -91,7 +91,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(892_000_000, frameSize, 4, 199, 22_300_000, 0),
new WorkerMemoryParameters(892_000_000, frameSize, 4, 199, 89_200_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -111,7 +111,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(592_000_000, frameSize, 4, 132, 14_800_000, 200_000_000),
new WorkerMemoryParameters(592_000_000, frameSize, 4, 132, 59_200_000, 200_000_000),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -145,7 +145,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(392_000_000, frameSize, 4, 87, 9_800_000, 0),
new WorkerMemoryParameters(392_000_000, frameSize, 4, 87, 39_200_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 2, 1)
);
}
@ -162,7 +162,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(2_392_000_000L, frameSize, 4, 537, 59_800_000, 0),
new WorkerMemoryParameters(2_392_000_000L, frameSize, 4, 537, 239_200_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 2, 1)
);
}
@ -179,7 +179,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(136_000_000, frameSize, 32, 2, 425_000, 0),
new WorkerMemoryParameters(136_000_000, frameSize, 32, 2, 13_600_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -196,7 +196,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(109_000_000, frameSize, 32, 2, 330_303, 0),
new WorkerMemoryParameters(109_000_000, frameSize, 32, 2, 10_900_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -276,7 +276,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(13_000_000, frameSize, 1, 2, 250_000, 0),
new WorkerMemoryParameters(13_000_000, frameSize, 1, 2, 10_000_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -325,7 +325,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(13_000_000, frameSize, 1, 2, 250_000, 0),
new WorkerMemoryParameters(13_000_000, frameSize, 1, 2, 10_000_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 2, 1)
);
}
@ -342,7 +342,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(1_096_000_000, frameSize, 4, 245, 27_400_000, 0),
new WorkerMemoryParameters(1_096_000_000, frameSize, 4, 245, 109_600_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -359,7 +359,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(1_548_000_000, frameSize, 4, 347, 38_700_000, 0),
new WorkerMemoryParameters(1_548_000_000, frameSize, 4, 347, 154_800_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -376,7 +376,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(96_000_000, frameSize, 4, 20, 2_500_000, 0),
new WorkerMemoryParameters(96_000_000, frameSize, 4, 20, 10_000_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 2, 1)
);
}
@ -393,7 +393,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(1_762_666_666, frameSize, 64, 23, 2_754_166, 0),
new WorkerMemoryParameters(1_762_666_666, frameSize, 64, 23, 176_266_666, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 1, 1)
);
}
@ -410,7 +410,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(429_333_333, frameSize, 64, 5, 670_833, 0),
new WorkerMemoryParameters(429_333_333, frameSize, 64, 5, 42_933_333, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 2, 1)
);
}
@ -428,7 +428,7 @@ public class WorkerMemoryParametersTest
final ShuffleSpec shuffleSpec = makeSortShuffleSpec();
Assert.assertEquals(
new WorkerMemoryParameters(448_000_000, frameSize, 2, 200, 22_400_000, 0),
new WorkerMemoryParameters(448_000_000, frameSize, 2, 200, 44_800_000, 0),
WorkerMemoryParameters.createInstance(memoryIntrospector, frameSize, slices, broadcastInputs, shuffleSpec, 2, 1)
);
}

View File

@ -59,8 +59,11 @@ import org.apache.druid.segment.TestIndex;
import org.apache.druid.segment.column.RowSignature;
import org.apache.druid.segment.incremental.IncrementalIndexCursorFactory;
import org.apache.druid.timeline.SegmentId;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Test;
import org.junit.internal.matchers.ThrowableMessageMatcher;
import java.io.IOException;
import java.util.Collections;
@ -177,7 +180,7 @@ public class ScanQueryFrameProcessorTest extends FrameProcessorTestBase
}
}
// put funny intervals on query to ensure it is adjusted to the segment interval before building cursor
// put funny intervals on query to ensure it is validated before building cursor
final ScanQuery query =
Druids.newScanQueryBuilder()
.dataSource("test")
@ -240,11 +243,16 @@ public class ScanQueryFrameProcessorTest extends FrameProcessorTestBase
FrameReader.create(signature)
);
FrameTestUtil.assertRowsEqual(
FrameTestUtil.readRowsFromCursorFactory(cursorFactory, signature, false),
rowsFromProcessor
final RuntimeException e = Assert.assertThrows(
RuntimeException.class,
rowsFromProcessor::toList
);
Assert.assertEquals(Unit.instance(), retVal.get());
MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString(
"Expected eternity intervals, but got[[2001-01-01T00:00:00.000Z/2011-01-01T00:00:00.000Z, "
+ "2011-01-02T00:00:00.000Z/2021-01-01T00:00:00.000Z]]"))
);
}
}

View File

@ -2953,7 +2953,7 @@ name: Apache Avro
license_category: binary
module: extensions/druid-avro-extensions
license_name: Apache License version 2.0
version: 1.11.3
version: 1.11.4
libraries:
- org.apache.avro: avro
- org.apache.avro: avro-mapred

View File

@ -83,7 +83,7 @@
<gson.version>2.10.1</gson.version>
<scala.library.version>2.13.14</scala.library.version>
<avatica.version>1.25.0</avatica.version>
<avro.version>1.11.3</avro.version>
<avro.version>1.11.4</avro.version>
<!--
The base calcite parser was copied into the project; when updating Calcite run dev/upgrade-calcite-parser to adopt upstream changes
-->

View File

@ -391,6 +391,11 @@ public class SuperSorter
@GuardedBy("runWorkersLock")
private void setAllDoneIfPossible()
{
if (isAllDone()) {
// Already done, no need to set allDone again.
return;
}
try {
if (totalInputFrames == 0 && outputPartitionsFuture.isDone()) {
// No input data -- generate empty output channels.

View File

@ -36,6 +36,7 @@ import org.apache.druid.sql.calcite.rel.DruidQuery;
import org.apache.druid.sql.calcite.rel.PartialDruidQuery;
import org.apache.druid.sql.calcite.rel.PartialDruidQuery.Stage;
import org.apache.druid.sql.calcite.rel.logical.DruidAggregate;
import org.apache.druid.sql.calcite.rel.logical.DruidJoin;
import org.apache.druid.sql.calcite.rel.logical.DruidLogicalNode;
import org.apache.druid.sql.calcite.rel.logical.DruidSort;
@ -58,20 +59,83 @@ public class DruidQueryGenerator
this.vertexFactory = new PDQVertexFactory(plannerContext, rexBuilder);
}
/**
* Tracks the upstream nodes during traversal.
*
* Its main purpose is to provide access to parent nodes;
* so that context sensitive logics can be formalized with it.
*/
static class DruidNodeStack
{
static class Entry
{
public final DruidLogicalNode node;
public final int operandIndex;
public Entry(DruidLogicalNode node, int operandIndex)
{
this.node = node;
this.operandIndex = operandIndex;
}
}
Stack<Entry> stack = new Stack<>();
public void push(DruidLogicalNode item)
{
push(item, 0);
}
public void push(DruidLogicalNode item, int operandIndex)
{
stack.push(new Entry(item, operandIndex));
}
public void pop()
{
stack.pop();
}
public int size()
{
return stack.size();
}
public DruidLogicalNode peekNode()
{
return stack.peek().node;
}
public DruidLogicalNode parentNode()
{
return getNode(1).node;
}
public Entry getNode(int i)
{
return stack.get(stack.size() - 1 - i);
}
public int peekOperandIndex()
{
return stack.peek().operandIndex;
}
}
public DruidQuery buildQuery()
{
Stack<DruidLogicalNode> stack = new Stack<>();
DruidNodeStack stack = new DruidNodeStack();
stack.push(relRoot);
Vertex vertex = buildVertexFor(stack);
return vertex.buildQuery(true);
}
private Vertex buildVertexFor(Stack<DruidLogicalNode> stack)
private Vertex buildVertexFor(DruidNodeStack stack)
{
List<Vertex> newInputs = new ArrayList<>();
for (RelNode input : stack.peek().getInputs()) {
stack.push((DruidLogicalNode) input);
for (RelNode input : stack.peekNode().getInputs()) {
stack.push((DruidLogicalNode) input, newInputs.size());
newInputs.add(buildVertexFor(stack));
stack.pop();
}
@ -79,11 +143,11 @@ public class DruidQueryGenerator
return vertex;
}
private Vertex processNodeWithInputs(Stack<DruidLogicalNode> stack, List<Vertex> newInputs)
private Vertex processNodeWithInputs(DruidNodeStack stack, List<Vertex> newInputs)
{
DruidLogicalNode node = stack.peek();
DruidLogicalNode node = stack.peekNode();
if (node instanceof SourceDescProducer) {
return vertexFactory.createVertex(PartialDruidQuery.create(node), newInputs);
return vertexFactory.createVertex(stack, PartialDruidQuery.create(node), newInputs);
}
if (newInputs.size() == 1) {
Vertex inputVertex = newInputs.get(0);
@ -92,6 +156,7 @@ public class DruidQueryGenerator
return newVertex.get();
}
inputVertex = vertexFactory.createVertex(
stack,
PartialDruidQuery.createOuterQuery(((PDQVertex) inputVertex).partialDruidQuery, vertexFactory.plannerContext),
ImmutableList.of(inputVertex)
);
@ -116,7 +181,7 @@ public class DruidQueryGenerator
/**
* Extends the current vertex to include the specified parent.
*/
Optional<Vertex> extendWith(Stack<DruidLogicalNode> stack);
Optional<Vertex> extendWith(DruidNodeStack stack);
/**
* Decides wether this {@link Vertex} can be unwrapped into an {@link SourceDesc}.
@ -133,6 +198,42 @@ public class DruidQueryGenerator
SourceDesc unwrapSourceDesc();
}
enum JoinSupportTweaks
{
NONE,
LEFT,
RIGHT;
static JoinSupportTweaks analyze(DruidNodeStack stack)
{
if (stack.size() < 2) {
return NONE;
}
DruidLogicalNode possibleJoin = stack.parentNode();
if (!(possibleJoin instanceof DruidJoin)) {
return NONE;
}
if (stack.peekOperandIndex() == 0) {
return LEFT;
} else {
return RIGHT;
}
}
boolean finalizeSubQuery()
{
return this == NONE;
}
boolean forceSubQuery(SourceDesc sourceDesc)
{
if (sourceDesc.dataSource.isGlobal()) {
return false;
}
return this == RIGHT;
}
}
/**
* {@link PartialDruidQuery} based {@link Vertex} factory.
*/
@ -147,20 +248,23 @@ public class DruidQueryGenerator
this.rexBuilder = rexBuilder;
}
Vertex createVertex(PartialDruidQuery partialDruidQuery, List<Vertex> inputs)
Vertex createVertex(DruidNodeStack stack, PartialDruidQuery partialDruidQuery, List<Vertex> inputs)
{
return new PDQVertex(partialDruidQuery, inputs);
JoinSupportTweaks jst = JoinSupportTweaks.analyze(stack);
return new PDQVertex(partialDruidQuery, inputs, jst);
}
public class PDQVertex implements Vertex
{
final PartialDruidQuery partialDruidQuery;
final List<Vertex> inputs;
final JoinSupportTweaks jst;
public PDQVertex(PartialDruidQuery partialDruidQuery, List<Vertex> inputs)
public PDQVertex(PartialDruidQuery partialDruidQuery, List<Vertex> inputs, JoinSupportTweaks jst)
{
this.partialDruidQuery = partialDruidQuery;
this.inputs = inputs;
this.jst = jst;
}
@Override
@ -172,7 +276,7 @@ public class DruidQueryGenerator
source.rowSignature,
plannerContext,
rexBuilder,
!topLevel
!(topLevel) && jst.finalizeSubQuery()
);
}
@ -207,21 +311,22 @@ public class DruidQueryGenerator
* Extends the the current partial query with the new parent if possible.
*/
@Override
public Optional<Vertex> extendWith(Stack<DruidLogicalNode> stack)
public Optional<Vertex> extendWith(DruidNodeStack stack)
{
Optional<PartialDruidQuery> newPartialQuery = extendPartialDruidQuery(stack);
if (!newPartialQuery.isPresent()) {
return Optional.empty();
}
return Optional.of(createVertex(newPartialQuery.get(), inputs));
return Optional.of(createVertex(stack, newPartialQuery.get(), inputs));
}
/**
* Merges the given {@link RelNode} into the current {@link PartialDruidQuery}.
*/
private Optional<PartialDruidQuery> extendPartialDruidQuery(Stack<DruidLogicalNode> stack)
private Optional<PartialDruidQuery> extendPartialDruidQuery(DruidNodeStack stack)
{
DruidLogicalNode parentNode = stack.peek();
DruidLogicalNode parentNode = stack.peekNode();
if (accepts(stack, Stage.WHERE_FILTER, Filter.class)) {
PartialDruidQuery newPartialQuery = partialDruidQuery.withWhereFilter((Filter) parentNode);
return Optional.of(newPartialQuery);
@ -261,12 +366,12 @@ public class DruidQueryGenerator
return Optional.empty();
}
private boolean accepts(Stack<DruidLogicalNode> stack, Stage stage, Class<? extends RelNode> clazz)
private boolean accepts(DruidNodeStack stack, Stage stage, Class<? extends RelNode> clazz)
{
DruidLogicalNode currentNode = stack.peek();
DruidLogicalNode currentNode = stack.peekNode();
if (Project.class == clazz && stack.size() >= 2) {
// peek at parent and postpone project for next query stage
DruidLogicalNode parentNode = stack.get(stack.size() - 2);
DruidLogicalNode parentNode = stack.parentNode();
if (stage.ordinal() > Stage.AGGREGATE.ordinal()
&& parentNode instanceof DruidAggregate
&& !partialDruidQuery.canAccept(Stage.AGGREGATE)) {
@ -295,6 +400,9 @@ public class DruidQueryGenerator
@Override
public boolean canUnwrapSourceDesc()
{
if (jst.forceSubQuery(getSource())) {
return false;
}
if (partialDruidQuery.stage() == Stage.SCAN) {
return true;
}

View File

@ -76,6 +76,7 @@ import org.apache.druid.query.operator.OperatorFactory;
import org.apache.druid.query.operator.ScanOperatorFactory;
import org.apache.druid.query.operator.WindowOperatorQuery;
import org.apache.druid.query.ordering.StringComparator;
import org.apache.druid.query.planning.DataSourceAnalysis;
import org.apache.druid.query.scan.ScanQuery;
import org.apache.druid.query.spec.LegacySegmentSpec;
import org.apache.druid.query.timeboundary.TimeBoundaryQuery;
@ -884,7 +885,8 @@ public class DruidQuery
*/
private static boolean canUseIntervalFiltering(final DataSource dataSource)
{
return dataSource.getAnalysis().isTableBased();
final DataSourceAnalysis analysis = dataSource.getAnalysis();
return !analysis.getBaseQuery().isPresent() && analysis.isTableBased();
}
private static Filtration toFiltration(

View File

@ -232,8 +232,8 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN_EXTRA_COLUMNS, separateDefaultModeTest = true)
@Test
@NotYetSupported(Modes.STACK_OVERFLOW)
public void testJoinOuterGroupByAndSubqueryHasLimit()
{
// Cannot vectorize JOIN operator.
@ -321,7 +321,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
public void testJoinOuterGroupByAndSubqueryNoLimit(Map<String, Object> queryContext)
{
// Fully removing the join allows this query to vectorize.
@ -405,7 +404,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
}
@Test
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
public void testJoinWithLimitBeforeJoining()
{
// Cannot vectorize JOIN operator.
@ -1532,7 +1530,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@DecoupledTestConfig(quidemReason = QuidemTestCaseReason.FINALIZING_FIELD_ACCESS)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinQueryOfLookup(Map<String, Object> queryContext)
@ -1712,7 +1709,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
@DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN_CAST_MATERIALIZED_EARLIER)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse(Map<String, Object> queryContext)
@ -1770,7 +1767,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinLookupTableTable(Map<String, Object> queryContext)
@ -1853,7 +1849,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoinLookupTableTableChained(Map<String, Object> queryContext)
@ -2082,7 +2077,7 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
@DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN_CAST_MATERIALIZED_EARLIER)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testJoinTableLookupTableMismatchedTypesWithoutComma(Map<String, Object> queryContext)
@ -3729,7 +3724,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testLeftJoinWithNotNullFilter(Map<String, Object> queryContext)
@ -3777,7 +3771,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testInnerJoin(Map<String, Object> queryContext)
@ -3832,7 +3825,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
);
}
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
@MethodSource("provideQueryContexts")
@ParameterizedTest(name = "{0}")
public void testJoinWithExplicitIsNotDistinctFromCondition(Map<String, Object> queryContext)
@ -5845,7 +5837,6 @@ public class CalciteJoinQueryTest extends BaseCalciteQueryTest
@SqlTestFrameworkConfig.MinTopNThreshold(1)
@Test
@NotYetSupported(Modes.JOIN_TABLE_TABLE)
public void testJoinWithAliasAndOrderByNoGroupBy()
{
Map<String, Object> context = new HashMap<>(QUERY_CONTEXT_DEFAULT);

View File

@ -116,6 +116,7 @@ import org.apache.druid.query.topn.NumericTopNMetricSpec;
import org.apache.druid.query.topn.TopNQueryBuilder;
import org.apache.druid.segment.VirtualColumn;
import org.apache.druid.segment.VirtualColumns;
import org.apache.druid.segment.column.ColumnHolder;
import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.RowSignature;
import org.apache.druid.segment.join.JoinType;
@ -7726,6 +7727,56 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
);
}
@DecoupledTestConfig(quidemReason = QuidemTestCaseReason.EQUIV_PLAN_EXTRA_COLUMNS, separateDefaultModeTest = true)
@Test
public void testTimeFilterOnSubquery()
{
testQuery(
"SELECT __time, m1 FROM (SELECT * FROM \"foo\" LIMIT 100)\n"
+ "WHERE TIME_IN_INTERVAL(__time, '2000/P1D') OR TIME_IN_INTERVAL(__time, '2001/P1D')",
ImmutableList.of(
newScanQueryBuilder()
.dataSource(
newScanQueryBuilder()
.dataSource(CalciteTests.DATASOURCE1)
.intervals(querySegmentSpec(Filtration.eternity()))
.columns("__time", "m1")
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
.limit(100)
.context(QUERY_CONTEXT_DEFAULT)
.build()
)
.intervals(querySegmentSpec(Filtration.eternity()))
.filters(or(
range(
ColumnHolder.TIME_COLUMN_NAME,
ColumnType.LONG,
DateTimes.of("2000").getMillis(),
DateTimes.of("2000-01-02").getMillis(),
false,
true
),
range(
ColumnHolder.TIME_COLUMN_NAME,
ColumnType.LONG,
DateTimes.of("2001").getMillis(),
DateTimes.of("2001-01-02").getMillis(),
false,
true
)
))
.columns("__time", "m1")
.resultFormat(ScanQuery.ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
.context(QUERY_CONTEXT_DEFAULT)
.build()
),
ImmutableList.of(
new Object[]{DateTimes.of("2000-01-01").getMillis(), 1.0f},
new Object[]{DateTimes.of("2001-01-01").getMillis(), 4.0f}
)
);
}
@SqlTestFrameworkConfig.NumMergeBuffers(4)
@Test
public void testMultipleExactCountDistinctWithGroupingUsingGroupingSets()

View File

@ -21,8 +21,6 @@ package org.apache.druid.sql.calcite;
import org.apache.calcite.rel.rules.CoreRules;
import org.apache.druid.query.QueryContexts;
import org.apache.druid.query.aggregation.post.FinalizingFieldAccessPostAggregator;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -87,9 +85,18 @@ public @interface DecoupledTestConfig
*/
DEFINETLY_WORSE_PLAN,
/**
* A new {@link FinalizingFieldAccessPostAggregator} appeared in the plan.
* Some extra unused columns are being projected.
*
* Example: ScanQuery over a join projects columns=[dim2, j0.m1, m1, m2] instead of just columns=[dim2, m2]
*/
FINALIZING_FIELD_ACCESS;
EQUIV_PLAN_EXTRA_COLUMNS,
/**
* Materialization of a CAST was pushed down to a join branch
*
* instead of joining on condition (CAST("j0.k", 'DOUBLE') == "_j0.m1")
* a vc was computed for CAST("j0.k", 'DOUBLE')
*/
EQUIV_PLAN_CAST_MATERIALIZED_EARLIER;
public boolean isPresent()
{

View File

@ -21,7 +21,6 @@ package org.apache.druid.sql.calcite;
import com.google.common.base.Throwables;
import org.apache.druid.error.DruidException;
import org.apache.druid.java.util.common.ISE;
import org.junit.AssumptionViolatedException;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.InvocationInterceptor;
@ -93,10 +92,8 @@ public @interface NotYetSupported
UNION_MORE_STRICT_ROWTYPE_CHECK(DruidException.class, "Row signature mismatch in Union inputs"),
JOIN_CONDITION_NOT_PUSHED_CONDITION(DruidException.class, "SQL requires a join with '.*' condition"),
JOIN_CONDITION_UNSUPORTED_OPERAND(DruidException.class, "SQL .* unsupported operand type"),
JOIN_TABLE_TABLE(ISE.class, "Cannot handle subquery structure for dataSource: JoinDataSource"),
CORRELATE_CONVERSION(DruidException.class, "Missing conversion( is|s are) LogicalCorrelate"),
SORT_REMOVE_TROUBLE(DruidException.class, "Calcite assertion violated.*Sort\\.<init>"),
STACK_OVERFLOW(StackOverflowError.class, ""),
CANNOT_JOIN_LOOKUP_NON_KEY(RuntimeException.class, "Cannot join lookup with condition referring to non-key"),
SORT_REMOVE_CONSTANT_KEYS_CONFLICT(DruidException.class, "not enough rules");
// @formatter:on

View File

@ -1,113 +0,0 @@
# testInnerJoinQueryOfLookup@all_disabled case-crc:d41a4a0d
# quidem testcase reason: FINALIZING_FIELD_ACCESS
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter false
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim1, dim2, t1.v, t1.v
FROM foo
INNER JOIN
(SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1
ON foo.dim2 = t1.k;
+------+------+------+------+
| dim1 | dim2 | v | v |
+------+------+------+------+
| | a | xabc | xabc |
| 1 | a | xabc | xabc |
+------+------+------+------+
(2 rows)
!ok
LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3])
LogicalJoin(condition=[=($1, $2)], joinType=[inner])
LogicalProject(dim1=[$1], dim2=[$2])
LogicalTableScan(table=[[druid, foo]])
LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)])
LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10])
LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical])
DruidJoin(condition=[=($1, $2)], joinType=[inner])
DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical])
DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "extraction",
"dimension" : "k",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",
"index" : 0,
"length" : 1
}
} ],
"aggregations" : [ {
"type" : "stringAny",
"name" : "a0:a",
"fieldName" : "v",
"maxStringBytes" : 10,
"aggregateMultipleValues" : true
} ],
"postAggregations" : [ {
"type" : "finalizingFieldAccess",
"name" : "a0",
"fieldName" : "a0:a"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim2\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "dim1", "dim2", "j0.a0" ],
"columnTypes" : [ "STRING", "STRING", "STRING" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -1,113 +0,0 @@
# testInnerJoinQueryOfLookup@all_enabled case-crc:93392df4
# quidem testcase reason: FINALIZING_FIELD_ACCESS
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim1, dim2, t1.v, t1.v
FROM foo
INNER JOIN
(SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1
ON foo.dim2 = t1.k;
+------+------+------+------+
| dim1 | dim2 | v | v |
+------+------+------+------+
| | a | xabc | xabc |
| 1 | a | xabc | xabc |
+------+------+------+------+
(2 rows)
!ok
LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3])
LogicalJoin(condition=[=($1, $2)], joinType=[inner])
LogicalProject(dim1=[$1], dim2=[$2])
LogicalTableScan(table=[[druid, foo]])
LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)])
LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10])
LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical])
DruidJoin(condition=[=($1, $2)], joinType=[inner])
DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical])
DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "extraction",
"dimension" : "k",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",
"index" : 0,
"length" : 1
}
} ],
"aggregations" : [ {
"type" : "stringAny",
"name" : "a0:a",
"fieldName" : "v",
"maxStringBytes" : 10,
"aggregateMultipleValues" : true
} ],
"postAggregations" : [ {
"type" : "finalizingFieldAccess",
"name" : "a0",
"fieldName" : "a0:a"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim2\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "dim1", "dim2", "j0.a0" ],
"columnTypes" : [ "STRING", "STRING", "STRING" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -1,110 +0,0 @@
# testInnerJoinQueryOfLookup@default case-crc:ee151062
# quidem testcase reason: FINALIZING_FIELD_ACCESS
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim1, dim2, t1.v, t1.v
FROM foo
INNER JOIN
(SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1
ON foo.dim2 = t1.k;
+------+------+------+------+
| dim1 | dim2 | v | v |
+------+------+------+------+
| | a | xabc | xabc |
| 1 | a | xabc | xabc |
+------+------+------+------+
(2 rows)
!ok
LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3])
LogicalJoin(condition=[=($1, $2)], joinType=[inner])
LogicalProject(dim1=[$1], dim2=[$2])
LogicalTableScan(table=[[druid, foo]])
LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)])
LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10])
LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical])
DruidJoin(condition=[=($1, $2)], joinType=[inner])
DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical])
DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "extraction",
"dimension" : "k",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",
"index" : 0,
"length" : 1
}
} ],
"aggregations" : [ {
"type" : "stringAny",
"name" : "a0:a",
"fieldName" : "v",
"maxStringBytes" : 10,
"aggregateMultipleValues" : true
} ],
"postAggregations" : [ {
"type" : "finalizingFieldAccess",
"name" : "a0",
"fieldName" : "a0:a"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim2\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "dim1", "dim2", "j0.a0" ],
"columnTypes" : [ "STRING", "STRING", "STRING" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -1,113 +0,0 @@
# testInnerJoinQueryOfLookup@filter-on-value-column_disabled case-crc:dbd4147e
# quidem testcase reason: FINALIZING_FIELD_ACCESS
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim1, dim2, t1.v, t1.v
FROM foo
INNER JOIN
(SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1
ON foo.dim2 = t1.k;
+------+------+------+------+
| dim1 | dim2 | v | v |
+------+------+------+------+
| | a | xabc | xabc |
| 1 | a | xabc | xabc |
+------+------+------+------+
(2 rows)
!ok
LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3])
LogicalJoin(condition=[=($1, $2)], joinType=[inner])
LogicalProject(dim1=[$1], dim2=[$2])
LogicalTableScan(table=[[druid, foo]])
LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)])
LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10])
LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical])
DruidJoin(condition=[=($1, $2)], joinType=[inner])
DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical])
DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "extraction",
"dimension" : "k",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",
"index" : 0,
"length" : 1
}
} ],
"aggregations" : [ {
"type" : "stringAny",
"name" : "a0:a",
"fieldName" : "v",
"maxStringBytes" : 10,
"aggregateMultipleValues" : true
} ],
"postAggregations" : [ {
"type" : "finalizingFieldAccess",
"name" : "a0",
"fieldName" : "a0:a"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim2\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "dim1", "dim2", "j0.a0" ],
"columnTypes" : [ "STRING", "STRING", "STRING" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -1,113 +0,0 @@
# testInnerJoinQueryOfLookup@filter-rewrites-disabled case-crc:57dd8dfa
# quidem testcase reason: FINALIZING_FIELD_ACCESS
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim1, dim2, t1.v, t1.v
FROM foo
INNER JOIN
(SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1
ON foo.dim2 = t1.k;
+------+------+------+------+
| dim1 | dim2 | v | v |
+------+------+------+------+
| | a | xabc | xabc |
| 1 | a | xabc | xabc |
+------+------+------+------+
(2 rows)
!ok
LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3])
LogicalJoin(condition=[=($1, $2)], joinType=[inner])
LogicalProject(dim1=[$1], dim2=[$2])
LogicalTableScan(table=[[druid, foo]])
LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)])
LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10])
LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical])
DruidJoin(condition=[=($1, $2)], joinType=[inner])
DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical])
DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "extraction",
"dimension" : "k",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",
"index" : 0,
"length" : 1
}
} ],
"aggregations" : [ {
"type" : "stringAny",
"name" : "a0:a",
"fieldName" : "v",
"maxStringBytes" : 10,
"aggregateMultipleValues" : true
} ],
"postAggregations" : [ {
"type" : "finalizingFieldAccess",
"name" : "a0",
"fieldName" : "a0:a"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim2\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "dim1", "dim2", "j0.a0" ],
"columnTypes" : [ "STRING", "STRING", "STRING" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -1,113 +0,0 @@
# testInnerJoinQueryOfLookup@filter-rewrites case-crc:10d0367d
# quidem testcase reason: FINALIZING_FIELD_ACCESS
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter false
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim1, dim2, t1.v, t1.v
FROM foo
INNER JOIN
(SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1
ON foo.dim2 = t1.k;
+------+------+------+------+
| dim1 | dim2 | v | v |
+------+------+------+------+
| | a | xabc | xabc |
| 1 | a | xabc | xabc |
+------+------+------+------+
(2 rows)
!ok
LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3])
LogicalJoin(condition=[=($1, $2)], joinType=[inner])
LogicalProject(dim1=[$1], dim2=[$2])
LogicalTableScan(table=[[druid, foo]])
LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)])
LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10])
LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical])
DruidJoin(condition=[=($1, $2)], joinType=[inner])
DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical])
DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "extraction",
"dimension" : "k",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",
"index" : 0,
"length" : 1
}
} ],
"aggregations" : [ {
"type" : "stringAny",
"name" : "a0:a",
"fieldName" : "v",
"maxStringBytes" : 10,
"aggregateMultipleValues" : true
} ],
"postAggregations" : [ {
"type" : "finalizingFieldAccess",
"name" : "a0",
"fieldName" : "a0:a"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim2\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "dim1", "dim2", "j0.a0" ],
"columnTypes" : [ "STRING", "STRING", "STRING" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -1,113 +0,0 @@
# testInnerJoinQueryOfLookup@join-to-filter case-crc:967213e2
# quidem testcase reason: FINALIZING_FIELD_ACCESS
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim1, dim2, t1.v, t1.v
FROM foo
INNER JOIN
(SELECT SUBSTRING(k, 1, 1) k, ANY_VALUE(v, 10) v FROM lookup.lookyloo GROUP BY 1) t1
ON foo.dim2 = t1.k;
+------+------+------+------+
| dim1 | dim2 | v | v |
+------+------+------+------+
| | a | xabc | xabc |
| 1 | a | xabc | xabc |
+------+------+------+------+
(2 rows)
!ok
LogicalProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3])
LogicalJoin(condition=[=($1, $2)], joinType=[inner])
LogicalProject(dim1=[$1], dim2=[$2])
LogicalTableScan(table=[[druid, foo]])
LogicalAggregate(group=[{0}], v=[ANY_VALUE($1, $2)])
LogicalProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10])
LogicalTableScan(table=[[lookup, lookyloo]])
!logicalPlan
DruidProject(dim1=[$0], dim2=[$1], v=[$3], v0=[$3], druid=[logical])
DruidJoin(condition=[=($1, $2)], joinType=[inner])
DruidProject(dim1=[$1], dim2=[$2], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidAggregate(group=[{0}], v=[ANY_VALUE($1, $2)], druid=[logical])
DruidProject(k=[SUBSTRING($0, 1, 1)], v=[$1], $f2=[10], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "extraction",
"dimension" : "k",
"outputName" : "d0",
"outputType" : "STRING",
"extractionFn" : {
"type" : "substring",
"index" : 0,
"length" : 1
}
} ],
"aggregations" : [ {
"type" : "stringAny",
"name" : "a0:a",
"fieldName" : "v",
"maxStringBytes" : 10,
"aggregateMultipleValues" : true
} ],
"postAggregations" : [ {
"type" : "finalizingFieldAccess",
"name" : "a0",
"fieldName" : "a0:a"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim2\" == \"j0.d0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "dim1", "dim2", "j0.a0" ],
"columnTypes" : [ "STRING", "STRING", "STRING" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -0,0 +1,128 @@
# testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse@all_disabled case-crc:544a51fb
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter false
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM lookup.lookyloo l1
INNER JOIN lookup.lookyloo l2 ON l1.k = l2.k
INNER JOIN foo on l2.k = foo.m1;
+--------+
| EXPR$0 |
+--------+
| 1 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k00=[CAST($1):FLOAT])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k00=[CAST($1):FLOAT], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"right" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"rightPrefix" : "j0.",
"condition" : "(\"k\" == \"j0.k\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'DOUBLE')",
"outputType" : "FLOAT"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,128 @@
# testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse@all_enabled case-crc:21d41c09
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM lookup.lookyloo l1
INNER JOIN lookup.lookyloo l2 ON l1.k = l2.k
INNER JOIN foo on l2.k = foo.m1;
+--------+
| EXPR$0 |
+--------+
| 1 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k00=[CAST($1):FLOAT])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k00=[CAST($1):FLOAT], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"right" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"rightPrefix" : "j0.",
"condition" : "(\"k\" == \"j0.k\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'DOUBLE')",
"outputType" : "FLOAT"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,125 @@
# testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse@default case-crc:fe49c163
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM lookup.lookyloo l1
INNER JOIN lookup.lookyloo l2 ON l1.k = l2.k
INNER JOIN foo on l2.k = foo.m1;
+--------+
| EXPR$0 |
+--------+
| 1 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k00=[CAST($1):FLOAT])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k00=[CAST($1):FLOAT], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"right" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"rightPrefix" : "j0.",
"condition" : "(\"k\" == \"j0.k\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'DOUBLE')",
"outputType" : "FLOAT"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,128 @@
# testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse@filter-on-value-column_disabled case-crc:8bfc8f64
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM lookup.lookyloo l1
INNER JOIN lookup.lookyloo l2 ON l1.k = l2.k
INNER JOIN foo on l2.k = foo.m1;
+--------+
| EXPR$0 |
+--------+
| 1 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k00=[CAST($1):FLOAT])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k00=[CAST($1):FLOAT], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"right" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"rightPrefix" : "j0.",
"condition" : "(\"k\" == \"j0.k\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'DOUBLE')",
"outputType" : "FLOAT"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,128 @@
# testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse@filter-rewrites-disabled case-crc:58dcfbc6
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM lookup.lookyloo l1
INNER JOIN lookup.lookyloo l2 ON l1.k = l2.k
INNER JOIN foo on l2.k = foo.m1;
+--------+
| EXPR$0 |
+--------+
| 1 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k00=[CAST($1):FLOAT])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k00=[CAST($1):FLOAT], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"right" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"rightPrefix" : "j0.",
"condition" : "(\"k\" == \"j0.k\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'DOUBLE')",
"outputType" : "FLOAT"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,128 @@
# testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse@filter-rewrites case-crc:e016193d
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter false
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM lookup.lookyloo l1
INNER JOIN lookup.lookyloo l2 ON l1.k = l2.k
INNER JOIN foo on l2.k = foo.m1;
+--------+
| EXPR$0 |
+--------+
| 1 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k00=[CAST($1):FLOAT])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k00=[CAST($1):FLOAT], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"right" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"rightPrefix" : "j0.",
"condition" : "(\"k\" == \"j0.k\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'DOUBLE')",
"outputType" : "FLOAT"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,128 @@
# testInnerJoinTwoLookupsToTableUsingNumericColumnInReverse@join-to-filter case-crc:1bd2994d
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM lookup.lookyloo l1
INNER JOIN lookup.lookyloo l2 ON l1.k = l2.k
INNER JOIN foo on l2.k = foo.m1;
+--------+
| EXPR$0 |
+--------+
| 1 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k00=[CAST($1):FLOAT])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(k=[$0])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k00=[CAST($1):FLOAT], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(k=[$0], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"right" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"rightPrefix" : "j0.",
"condition" : "(\"k\" == \"j0.k\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'DOUBLE')",
"outputType" : "FLOAT"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,128 @@
# testJoinOuterGroupByAndSubqueryHasLimit@NullHandling=default case-crc:2e733a5b
# quidem testcase reason: EQUIV_PLAN_EXTRA_COLUMNS
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim2, AVG(m2) FROM (SELECT * FROM foo AS t1 INNER JOIN foo AS t2 ON t1.m1 = t2.m1 LIMIT 10) AS t3 GROUP BY dim2;
+------+--------------------+
| dim2 | EXPR$1 |
+------+--------------------+
| | 3.6666666666666665 |
| a | 2.5 |
| abc | 5.0 |
+------+--------------------+
(3 rows)
!ok
LogicalAggregate(group=[{0}], EXPR$1=[AVG($2)])
LogicalSort(fetch=[10])
LogicalJoin(condition=[=($1, $3)], joinType=[inner])
LogicalProject(dim2=[$2], m1=[$5], m2=[$6])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{0}], EXPR$1=[AVG($2)], druid=[logical])
DruidSort(fetch=[10], druid=[logical])
DruidJoin(condition=[=($1, $3)], joinType=[inner])
DruidProject(dim2=[$2], m1=[$5], m2=[$6], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "groupBy",
"dataSource" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"m1\" == \"j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"limit" : 10,
"columns" : [ "dim2", "j0.m1", "m1", "m2" ],
"columnTypes" : [ "STRING", "FLOAT", "FLOAT", "DOUBLE" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"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"
} ],
"aggregations" : [ {
"type" : "doubleSum",
"name" : "a0:sum",
"fieldName" : "m2"
}, {
"type" : "count",
"name" : "a0:count"
} ],
"postAggregations" : [ {
"type" : "arithmetic",
"name" : "a0",
"fn" : "quotient",
"fields" : [ {
"type" : "fieldAccess",
"fieldName" : "a0:sum"
}, {
"type" : "fieldAccess",
"fieldName" : "a0:count"
} ]
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
!nativePlan

View File

@ -0,0 +1,140 @@
# testJoinOuterGroupByAndSubqueryHasLimit@NullHandling=sql case-crc:2e733a5b
# quidem testcase reason: EQUIV_PLAN_EXTRA_COLUMNS
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT dim2, AVG(m2) FROM (SELECT * FROM foo AS t1 INNER JOIN foo AS t2 ON t1.m1 = t2.m1 LIMIT 10) AS t3 GROUP BY dim2;
+------+--------+
| dim2 | EXPR$1 |
+------+--------+
| | 3.0 |
| a | 2.5 |
| abc | 5.0 |
| | 4.0 |
+------+--------+
(4 rows)
!ok
LogicalAggregate(group=[{0}], EXPR$1=[AVG($2)])
LogicalSort(fetch=[10])
LogicalJoin(condition=[=($1, $3)], joinType=[inner])
LogicalProject(dim2=[$2], m1=[$5], m2=[$6])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(m1=[$5])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidAggregate(group=[{0}], EXPR$1=[AVG($2)], druid=[logical])
DruidSort(fetch=[10], druid=[logical])
DruidJoin(condition=[=($1, $3)], joinType=[inner])
DruidProject(dim2=[$2], m1=[$5], m2=[$6], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(m1=[$5], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "groupBy",
"dataSource" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"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" : [ "m1" ],
"columnTypes" : [ "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"m1\" == \"j0.m1\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"limit" : 10,
"columns" : [ "dim2", "j0.m1", "m1", "m2" ],
"columnTypes" : [ "STRING", "FLOAT", "FLOAT", "DOUBLE" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"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"
} ],
"aggregations" : [ {
"type" : "doubleSum",
"name" : "a0:sum",
"fieldName" : "m2"
}, {
"type" : "filtered",
"aggregator" : {
"type" : "count",
"name" : "a0:count"
},
"filter" : {
"type" : "not",
"field" : {
"type" : "null",
"column" : "m2"
}
},
"name" : "a0:count"
} ],
"postAggregations" : [ {
"type" : "arithmetic",
"name" : "a0",
"fn" : "quotient",
"fields" : [ {
"type" : "fieldAccess",
"fieldName" : "a0:sum"
}, {
"type" : "fieldAccess",
"fieldName" : "a0:count"
} ]
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
!nativePlan

View File

@ -0,0 +1,152 @@
# testJoinTableLookupTableMismatchedTypesWithoutComma@all_disabled case-crc:63a29f32
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter false
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM foo
INNER JOIN lookup.lookyloo l ON foo.cnt = l.k
INNER JOIN numfoo ON l.k = numfoo.cnt
;
+--------+
| EXPR$0 |
+--------+
| 0 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k0=[CAST($1):BIGINT])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(cnt=[$4])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(k=[$0], k0=[CAST($0):BIGINT])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(cnt=[$13])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k0=[CAST($1):BIGINT], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(cnt=[$4], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(k=[$0], k0=[CAST($0):BIGINT], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(cnt=[$13], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "k", "v0" ],
"columnTypes" : [ "STRING", "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"cnt\" == \"j0.v0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "cnt" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.cnt\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,152 @@
# testJoinTableLookupTableMismatchedTypesWithoutComma@all_enabled case-crc:906d660f
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM foo
INNER JOIN lookup.lookyloo l ON foo.cnt = l.k
INNER JOIN numfoo ON l.k = numfoo.cnt
;
+--------+
| EXPR$0 |
+--------+
| 0 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k0=[CAST($1):BIGINT])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(cnt=[$4])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(k=[$0], k0=[CAST($0):BIGINT])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(cnt=[$13])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k0=[CAST($1):BIGINT], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(cnt=[$4], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(k=[$0], k0=[CAST($0):BIGINT], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(cnt=[$13], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "k", "v0" ],
"columnTypes" : [ "STRING", "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"cnt\" == \"j0.v0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "cnt" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.cnt\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,149 @@
# testJoinTableLookupTableMismatchedTypesWithoutComma@default case-crc:7765d2be
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM foo
INNER JOIN lookup.lookyloo l ON foo.cnt = l.k
INNER JOIN numfoo ON l.k = numfoo.cnt
;
+--------+
| EXPR$0 |
+--------+
| 0 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k0=[CAST($1):BIGINT])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(cnt=[$4])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(k=[$0], k0=[CAST($0):BIGINT])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(cnt=[$13])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k0=[CAST($1):BIGINT], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(cnt=[$4], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(k=[$0], k0=[CAST($0):BIGINT], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(cnt=[$13], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "k", "v0" ],
"columnTypes" : [ "STRING", "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"cnt\" == \"j0.v0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "cnt" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.cnt\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,152 @@
# testJoinTableLookupTableMismatchedTypesWithoutComma@filter-on-value-column_disabled case-crc:af07ed7a
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM foo
INNER JOIN lookup.lookyloo l ON foo.cnt = l.k
INNER JOIN numfoo ON l.k = numfoo.cnt
;
+--------+
| EXPR$0 |
+--------+
| 0 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k0=[CAST($1):BIGINT])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(cnt=[$4])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(k=[$0], k0=[CAST($0):BIGINT])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(cnt=[$13])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k0=[CAST($1):BIGINT], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(cnt=[$4], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(k=[$0], k0=[CAST($0):BIGINT], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(cnt=[$13], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "k", "v0" ],
"columnTypes" : [ "STRING", "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"cnt\" == \"j0.v0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "cnt" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.cnt\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,152 @@
# testJoinTableLookupTableMismatchedTypesWithoutComma@filter-rewrites-disabled case-crc:0637e32a
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM foo
INNER JOIN lookup.lookyloo l ON foo.cnt = l.k
INNER JOIN numfoo ON l.k = numfoo.cnt
;
+--------+
| EXPR$0 |
+--------+
| 0 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k0=[CAST($1):BIGINT])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(cnt=[$4])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(k=[$0], k0=[CAST($0):BIGINT])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(cnt=[$13])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k0=[CAST($1):BIGINT], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(cnt=[$4], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(k=[$0], k0=[CAST($0):BIGINT], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(cnt=[$13], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "k", "v0" ],
"columnTypes" : [ "STRING", "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"cnt\" == \"j0.v0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "cnt" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.cnt\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,152 @@
# testJoinTableLookupTableMismatchedTypesWithoutComma@filter-rewrites case-crc:c7b42928
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite true
!set enableJoinFilterRewriteValueColumnFilters true
!set enableRewriteJoinToFilter false
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM foo
INNER JOIN lookup.lookyloo l ON foo.cnt = l.k
INNER JOIN numfoo ON l.k = numfoo.cnt
;
+--------+
| EXPR$0 |
+--------+
| 0 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k0=[CAST($1):BIGINT])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(cnt=[$4])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(k=[$0], k0=[CAST($0):BIGINT])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(cnt=[$13])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k0=[CAST($1):BIGINT], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(cnt=[$4], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(k=[$0], k0=[CAST($0):BIGINT], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(cnt=[$13], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "k", "v0" ],
"columnTypes" : [ "STRING", "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"cnt\" == \"j0.v0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "cnt" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.cnt\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,152 @@
# testJoinTableLookupTableMismatchedTypesWithoutComma@join-to-filter case-crc:84b4a463
# quidem testcase reason: EQUIV_PLAN_CAST_MATERIALIZED_EARLIER
!set debug true
!set defaultTimeout 300000
!set enableJoinFilterRewrite false
!set enableJoinFilterRewriteValueColumnFilters false
!set enableRewriteJoinToFilter true
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT COUNT(*)
FROM foo
INNER JOIN lookup.lookyloo l ON foo.cnt = l.k
INNER JOIN numfoo ON l.k = numfoo.cnt
;
+--------+
| EXPR$0 |
+--------+
| 0 |
+--------+
(1 row)
!ok
LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
LogicalProject(k0=[CAST($1):BIGINT])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(cnt=[$4])
LogicalTableScan(table=[[druid, foo]])
LogicalProject(k=[$0], k0=[CAST($0):BIGINT])
LogicalTableScan(table=[[lookup, lookyloo]])
LogicalProject(cnt=[$13])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidAggregate(group=[{}], EXPR$0=[COUNT()], druid=[logical])
DruidJoin(condition=[=($0, $1)], joinType=[inner])
DruidProject(k0=[CAST($1):BIGINT], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(cnt=[$4], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
DruidProject(k=[$0], k0=[CAST($0):BIGINT], druid=[logical])
DruidTableScan(table=[[lookup, lookyloo]], druid=[logical])
DruidProject(cnt=[$13], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "timeseries",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "foo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "lookup",
"lookup" : "lookyloo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "k", "v0" ],
"columnTypes" : [ "STRING", "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "j0.",
"condition" : "(\"cnt\" == \"j0.v0\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "CAST(\"j0.k\", 'LONG')",
"outputType" : "LONG"
} ],
"resultFormat" : "compactedList",
"columns" : [ "v0" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "scan",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"columns" : [ "cnt" ],
"columnTypes" : [ "LONG" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"rightPrefix" : "_j0.",
"condition" : "(\"v0\" == \"_j0.cnt\")",
"joinType" : "INNER"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "count",
"name" : "a0"
} ]
}
!nativePlan

View File

@ -0,0 +1,92 @@
# testTimeFilterOnSubquery@NullHandling=default case-crc:73448efc
# quidem testcase reason: EQUIV_PLAN_EXTRA_COLUMNS
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT __time, m1 FROM (SELECT * FROM "foo" LIMIT 100)
WHERE TIME_IN_INTERVAL(__time, '2000/P1D') OR TIME_IN_INTERVAL(__time, '2001/P1D');
+-------------------------+-----+
| __time | m1 |
+-------------------------+-----+
| 2000-01-01 00:00:00.000 | 1.0 |
| 2001-01-01 00:00:00.000 | 4.0 |
+-------------------------+-----+
(2 rows)
!ok
LogicalProject(__time=[$0], m1=[$5])
LogicalFilter(condition=[SEARCH($0, Sarg[[2000-01-01 00:00:00:TIMESTAMP(3)..2000-01-02 00:00:00:TIMESTAMP(3)), [2001-01-01 00:00:00:TIMESTAMP(3)..2001-01-02 00:00:00:TIMESTAMP(3))]:TIMESTAMP(3))])
LogicalSort(fetch=[100])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidProject(__time=[$0], m1=[$5], druid=[logical])
DruidFilter(condition=[SEARCH($0, Sarg[[2000-01-01 00:00:00:TIMESTAMP(3)..2000-01-02 00:00:00:TIMESTAMP(3)), [2001-01-01 00:00:00:TIMESTAMP(3)..2001-01-02 00:00:00:TIMESTAMP(3))]:TIMESTAMP(3))])
DruidSort(fetch=[100], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "query",
"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",
"limit" : 100,
"columns" : [ "__time", "cnt", "dim1", "dim2", "dim3", "m1", "m2", "unique_dim1" ],
"columnTypes" : [ "LONG", "LONG", "STRING", "STRING", "STRING", "FLOAT", "DOUBLE", "COMPLEX<hyperUnique>" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"filter" : {
"type" : "or",
"fields" : [ {
"type" : "bound",
"dimension" : "__time",
"lower" : "946684800000",
"upper" : "946771200000",
"upperStrict" : true,
"ordering" : {
"type" : "numeric"
}
}, {
"type" : "bound",
"dimension" : "__time",
"lower" : "978307200000",
"upper" : "978393600000",
"upperStrict" : true,
"ordering" : {
"type" : "numeric"
}
} ]
},
"columns" : [ "__time", "m1" ],
"columnTypes" : [ "LONG", "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan

View File

@ -0,0 +1,88 @@
# testTimeFilterOnSubquery@NullHandling=sql case-crc:73448efc
# quidem testcase reason: EQUIV_PLAN_EXTRA_COLUMNS
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set outputformat mysql
!use druidtest:///
SELECT __time, m1 FROM (SELECT * FROM "foo" LIMIT 100)
WHERE TIME_IN_INTERVAL(__time, '2000/P1D') OR TIME_IN_INTERVAL(__time, '2001/P1D');
+-------------------------+-----+
| __time | m1 |
+-------------------------+-----+
| 2000-01-01 00:00:00.000 | 1.0 |
| 2001-01-01 00:00:00.000 | 4.0 |
+-------------------------+-----+
(2 rows)
!ok
LogicalProject(__time=[$0], m1=[$5])
LogicalFilter(condition=[SEARCH($0, Sarg[[2000-01-01 00:00:00:TIMESTAMP(3)..2000-01-02 00:00:00:TIMESTAMP(3)), [2001-01-01 00:00:00:TIMESTAMP(3)..2001-01-02 00:00:00:TIMESTAMP(3))]:TIMESTAMP(3))])
LogicalSort(fetch=[100])
LogicalTableScan(table=[[druid, foo]])
!logicalPlan
DruidProject(__time=[$0], m1=[$5], druid=[logical])
DruidFilter(condition=[SEARCH($0, Sarg[[2000-01-01 00:00:00:TIMESTAMP(3)..2000-01-02 00:00:00:TIMESTAMP(3)), [2001-01-01 00:00:00:TIMESTAMP(3)..2001-01-02 00:00:00:TIMESTAMP(3))]:TIMESTAMP(3))])
DruidSort(fetch=[100], druid=[logical])
DruidTableScan(table=[[druid, foo]], druid=[logical])
!druidPlan
{
"queryType" : "scan",
"dataSource" : {
"type" : "query",
"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",
"limit" : 100,
"columns" : [ "__time", "cnt", "dim1", "dim2", "dim3", "m1", "m2", "unique_dim1" ],
"columnTypes" : [ "LONG", "LONG", "STRING", "STRING", "STRING", "FLOAT", "DOUBLE", "COMPLEX<hyperUnique>" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"resultFormat" : "compactedList",
"filter" : {
"type" : "or",
"fields" : [ {
"type" : "range",
"column" : "__time",
"matchValueType" : "LONG",
"lower" : 946684800000,
"upper" : 946771200000,
"upperOpen" : true
}, {
"type" : "range",
"column" : "__time",
"matchValueType" : "LONG",
"lower" : 978307200000,
"upper" : 978393600000,
"upperOpen" : true
} ]
},
"columns" : [ "__time", "m1" ],
"columnTypes" : [ "LONG", "FLOAT" ],
"granularity" : {
"type" : "all"
},
"legacy" : false
}
!nativePlan