blob: 32af61ad6c69af1707137f9f41be5d5b434445a1 [file]
# testExactTopNOnInnerJoinWithLimit case-crc:f16f81b5
# quidem testcase reason: EQUIV_PLAN
!set debug true
!set defaultTimeout 300000
!set maxScatterGatherBytes 9223372036854775807
!set minTopNThreshold 1
!set plannerStrategy DECOUPLED
!set sqlCurrentTimestamp 2000-01-01T00:00:00Z
!set sqlQueryId dummy
!set useApproximateTopN false
!set useLexicographicTopN true
!set outputformat mysql
!use druidtest:///
select f1."dim4", sum("m1") from numfoo f1 inner join (
select "dim4" from numfoo where dim4 <> 'a' group by 1
) f2 on f1."dim4" = f2."dim4" group by 1 limit 1;
+------+--------+
| dim4 | EXPR$1 |
+------+--------+
| b | 15.0 |
+------+--------+
(1 row)
!ok
LogicalSort(fetch=[1])
LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalProject(dim4=[$4], m1=[$14])
LogicalTableScan(table=[[druid, numfoo]])
LogicalAggregate(group=[{4}])
LogicalFilter(condition=[<>($4, 'a')])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidSort(fetch=[1], druid=[logical])
DruidAggregate(group=[{0}], EXPR$1=[SUM($1)], druid=[logical])
DruidJoin(condition=[=($0, $2)], joinType=[inner])
DruidProject(dim4=[$4], m1=[$14], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
DruidAggregate(group=[{4}], druid=[logical])
DruidFilter(condition=[<>($4, 'a')])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "topN",
"dataSource" : {
"type" : "join",
"left" : {
"type" : "table",
"name" : "numfoo"
},
"right" : {
"type" : "query",
"query" : {
"queryType" : "groupBy",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"filter" : {
"type" : "not",
"field" : {
"type" : "equals",
"column" : "dim4",
"matchValueType" : "STRING",
"matchValue" : "a"
}
},
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "default",
"dimension" : "dim4",
"outputName" : "d0",
"outputType" : "STRING"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
},
"rightPrefix" : "j0.",
"condition" : "(\"dim4\" == \"j0.d0\")",
"joinType" : "INNER"
},
"dimension" : {
"type" : "default",
"dimension" : "dim4",
"outputName" : "d0",
"outputType" : "STRING"
},
"metric" : {
"type" : "dimension",
"ordering" : {
"type" : "lexicographic"
}
},
"threshold" : 1,
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"granularity" : {
"type" : "all"
},
"aggregations" : [ {
"type" : "doubleSum",
"name" : "a0",
"fieldName" : "m1"
} ]
}
!nativePlan