GitHub user campfireman added a comment to the discussion: Capture/lump a new 
"Others" group when applying limits

Hey guys, we have been looking for exactly this feature and had a go at it 
based on your notes. Originally, we planned to have a little PR draft as an 
outcome but we have encountered two issues that we would like to discuss.

## 1. Code location
First we looked at potential locations where the ranking based on the CTE could 
be placed:
`EngineSpec`: We tried placing the modification of the query into the execute() 
method of the `DremioEngineSpec` in superset/dremio.py. We got it somewhat to 
work but the modification required very fragile use of regexes to extract 
dimensions etc. from SQL so we decided to ditch this approach.
`models/helpers.py`: The method `get_query_str_extended` has the raw 
`QueryObject` and then converts the data to the actual SQL string. Here would 
be a more suitable spot but there is quite some modification to be done on the 
query.

## 2. Chat type limitation 
For some chart types like a bar chart it is not clear from the `QueryObject` 
along which axis the lumping should be done. It matters which dimension becomes 
the x-axis because we don't want to do the lumping along that axis but from the 
query side it is not clear which dimension is the x-axis.

An example table:
```metric_1 | dim_1 | dim_2```
Lets say our query looks like this `SELECT SUM(metric_1) GROUP BY dim_1, dim_2 
WHERE ...`
When `dim_1` is the x-axis we would like to lump along the `dim_2` axis; when 
dim_2 is the x-axis we would like to lump along the `dim_1` axis. For something 
like a Pie chart this is not an issue.
Our verdict was that even if you overcome the complexity of modifying the 
`QueryObject` you still would have to limit the feature to certain chart types.

We are happy to share more details. What do you think, did we miss some other 
way of solving this?

GitHub link: 
https://github.com/apache/superset/discussions/29350#discussioncomment-16190717

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to