cyrilou242 commented on PR #12643:
URL: https://github.com/apache/pinot/pull/12643#issuecomment-1997170810
Could confirm that the use cases I mentioned above work thanks
```
@Test
public void testAggregateCaseToFilterDistinctCountAgg_NO_REWRITE() {
String query = "EXPLAIN PLAN FOR SELECT DISTINCTCOUNTHLL(CASE WHEN col1
= 'a' THEN 'lol' ELSE '' END) FROM a";
String explain = _queryEnvironment.explainQuery(query,
RANDOM_REQUEST_ID_GEN.nextLong());
assertEquals(explain,
"Execution Plan\n"
+ "LogicalAggregate(group=[{}], agg#0=[DISTINCTCOUNTHLL($0)])\n"
+ " PinotLogicalExchange(distribution=[hash])\n"
+ " LogicalAggregate(group=[{}],
agg#0=[DISTINCTCOUNTHLL($0)])\n"
+ " LogicalProject($f0=[CASE(=($0, _UTF-8'a'),
_UTF-8'lol':VARCHAR(3) CHARACTER SET \"UTF-8\", _UTF-8'':VARCHAR(3) CHARACTER
SET \"UTF-8\")])\n"
+ " LogicalTableScan(table=[[a]])\n");
}
@Test
public void testAggregateCaseToFilterDistinctCountAgg_DO_REWRITE() {
String query = "EXPLAIN PLAN FOR SELECT DISTINCTCOUNTHLL(CASE WHEN col1
= 'a' THEN 'lol' END) FROM a";
String explain = _queryEnvironment.explainQuery(query,
RANDOM_REQUEST_ID_GEN.nextLong());
assertEquals(explain,
"Execution Plan\n"
+ "LogicalAggregate(group=[{}], agg#0=[DISTINCTCOUNTHLL($0)])\n"
+ " PinotLogicalExchange(distribution=[hash])\n"
+ " LogicalAggregate(group=[{}], agg#0=[DISTINCTCOUNTHLL($0)
FILTER $1])\n"
+ " LogicalProject($f1=[_UTF-8'lol'], $f2=[=($0,
_UTF-8'a')])\n"
+ " LogicalTableScan(table=[[a]])\n");
}
```
passes thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]