You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/11/26 23:49:39 UTC

[GitHub] [incubator-druid] vogievetsky opened a new issue #8947: Unnecessary cartesian explosion if multi-value column is reused in expression

vogievetsky opened a new issue #8947: Unnecessary cartesian explosion if multi-value column is reused in expression
URL: https://github.com/apache/incubator-druid/issues/8947
 
 
   ### Affected Version
   
   Druid 0.16, 0.15
   
   ### Description
   
   With this dataset (as `fs`):
   
   ```json
   {"time":"2019-08-14T00:00:00.000Z","srcGroups":["x","y","z"],"dstGroups":["a","b","c","d"]}
   {"time":"2019-08-14T00:00:00.000Z","srcGroups":["x","y","z"],"dstGroups":["a","c","d"]}
   {"time":"2019-08-14T00:00:00.000Z","srcGroups":["x","y","z"],"dstGroups":["a","g"]}
   ```
   
   Doing this query:
   
   ```sql
   SELECT
     CASE "dstGroups"
       WHEN 'b' THEN 'b'
       WHEN 'g' THEN 'g'
       ELSE 'Other'
     END AS "dst",
     COUNT(*) AS "Count"
   FROM "fs"
   GROUP BY 1
   ORDER BY "Count" DESC
   ```
   
   Yields an unexpected cartesian explosion:
   
   ![image](https://user-images.githubusercontent.com/177816/69681810-1eef6180-1064-11ea-8a08-16a1e8599b45.png)
   
   This is due to this expression in the underlying plan:
   
   `"case_searched((\"dstGroups\" == 'b'),'b',(\"dstGroups\" == 'g'),'g','Other')"`
   
   Which triggers a cartesian product on the same column `dstGroups` which it should not do.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org