blob: e34468f4ec60e1e0f5d343f7c02187c00e6ca1ff [file]
# testGroupByWithLiteralInSubqueryGrouping case-crc:a63c5a2f
# quidem testcase reason: IMPROVED_PLAN
!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
t1, t2
FROM
( SELECT
'dummy' as t1,
CASE
WHEN
dim4 = 'b'
THEN dim4
ELSE NULL
END AS t2
FROM
numfoo
GROUP BY
dim4
)
GROUP BY
t1,t2
;
+-------+----+
| t1 | t2 |
+-------+----+
| dummy | b |
| dummy | |
+-------+----+
(2 rows)
!ok
LogicalProject(t1=['dummy'], t2=[$0])
LogicalAggregate(group=[{0}])
LogicalProject($f0=[CASE(=($4, 'b'), $4, null:VARCHAR)])
LogicalTableScan(table=[[druid, numfoo]])
!logicalPlan
DruidProject(t1=['dummy'], t2=[$0], druid=[logical])
DruidAggregate(group=[{0}], druid=[logical])
DruidProject($f0=[CASE(=($4, 'b'), $4, null:VARCHAR)], druid=[logical])
DruidTableScan(table=[[druid, numfoo]], druid=[logical])
!druidPlan
{
"queryType" : "groupBy",
"dataSource" : {
"type" : "table",
"name" : "numfoo"
},
"intervals" : {
"type" : "intervals",
"intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ]
},
"virtualColumns" : [ {
"type" : "expression",
"name" : "v0",
"expression" : "case_searched((\"dim4\" == 'b'),\"dim4\",null)",
"outputType" : "STRING"
} ],
"granularity" : {
"type" : "all"
},
"dimensions" : [ {
"type" : "default",
"dimension" : "v0",
"outputName" : "d0",
"outputType" : "STRING"
} ],
"postAggregations" : [ {
"type" : "expression",
"name" : "p0",
"expression" : "'dummy'",
"outputType" : "STRING"
} ],
"limitSpec" : {
"type" : "NoopLimitSpec"
}
}
!nativePlan