kgyrtkirk opened a new issue, #16715: URL: https://github.com/apache/druid/issues/16715
* `useApproximateCountDistinct` supposed to enable a special mode to handle `COUNT(DISTINCT x)` with skethces * the rules are configured to remove the generic distinct handler rules [here](https://github.com/apache/druid/blob/616ae631c62a98d2145af0a87a0e2ab3af199d1f/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java#L496-L503) * so queries like `select sum(distinct added) from wikipedia` will fail to plan if `useApproximateCountDistinct` is enabled quidem test: ``` !set useApproximateCountDistinct false !use druidtest://?numMergeBuffers=3 !set outputformat mysql select sum(distinct added) from wikipedia; +---------+ | EXPR$0 | +---------+ | 6455074 | +---------+ (1 row) !ok !set useApproximateCountDistinct true !use druidtest://?numMergeBuffers=3 select sum(distinct added) from wikipedia; [...] Missing conversion is LogicalAggregate[convention: NONE -> DRUID] There is 1 empty subset: rel#105:RelSubset#2.DRUID.[], the relevant part of the original plan is as follows 103:LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)]) 101:LogicalProject(subset=[rel#102:RelSubset#1.NONE.[]], added=[$18]) 74:LogicalTableScan(subset=[rel#100:RelSubset#0.NONE.[]], table=[[druid, wikipedia]]) [...] QueryInterruptedException{msg=Query could not be planned. A possible reason is [Aggregation [SUM(DISTINCT $18)] is not supported2], code=Unknown exception, class=org.apache.druid.error.DruidException, host=null} at org.apache.druid.query.QueryInterruptedException.wrapIfNeeded(QueryInterruptedException.java:113) [...] ``` -- 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]
