Decoupled planning: improve join support (#17039)

There were some problematic cases

join branches are run with finalize=false instead of finalize=true like normal subqueries
this inconsistency is not good - but fixing it is a bigger thing
ensure that right hand sides of joins are always subqueries - or accessible globally
To achieve the above:

operand indexes were needed for the upstream reltree nodes in the generator
source unwrapping now takes the join situation into account as well
This commit is contained in:
Zoltan Haindrich 2024-09-18 05:26:36 +02:00 committed by GitHub
parent dd8c7de144
commit d84d53c017
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 2363 additions and 826 deletions

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

@ -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

@ -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;
@ -94,10 +93,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