You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/06/05 16:30:56 UTC

[GitHub] [incubator-superset] kwims opened a new issue #9999: Filter before grouping

kwims opened a new issue #9999:
URL: https://github.com/apache/incubator-superset/issues/9999


   Hi I am trying to draw an timeline histogram that support filter as parameter ( from a filter box) before grouping by time range bug it does not work. 
   Suppose I have a table USER_PRESENTATION and a table TAG and a view USER_PRESENTATION_TAG_VIEW that is the result of both join
   
   USER_PRESENTATION
   |id|username|time|
   |1|Johndoe|2020-01-01|
   |2|Johndoe|2020-02-01|
   
   TAG 
   |user_presentation_id|tag|
   |1|java|
   |1|cobol|
   |2|java|
   
   USER_PRESENTATION_TAG_VIEW 
   |id|username|time|tag|
   |1|Johndoe|2020-01-01|java|
   |1|Johndoe|2020-01-01|cobol|
   |2|Johndoe|2020-02-01|java|
   
   
   I want a timeline histogram that would show when I filter on"java" ( using filterBox) 
   1 hit on 2020-01-01 and 1 hit on 2020-01-01
   
   But it is showing me instead **2 hits** on 2020-01-01 and 1 hit on 2020-01-01 **because The filter is not injected before grouping by time**
   
   Could you please help? Is Superset not supporting this?
   


----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] kwims commented on issue #9999: Filter before grouping

Posted by GitBox <gi...@apache.org>.
kwims commented on issue #9999:
URL: https://github.com/apache/incubator-superset/issues/9999#issuecomment-640400732


   Hi @rumbin , I was able to fix the code by using jinja template and Calculated Columns. I have been inspired by this ticket https://github.com/apache/incubator-superset/issues/4181.
   
   _Note I updated the example to add another column._
    
   SQL was like : 
   `Select count(*), time  USER_PRESENTATION_TAG_VIEW where tag = 'java' group by time`
   
   What I manage to do with jinja was to do update Datasource of USER_REPRESENTATION as follows:
   ```
   Select * USER_PRESENTATION where id in (select id from USER_PRESENTATION_TAG_VIEW where 
    {% set f_tag = filter_values('tag') %}
       {% if f_tag %}
   		AND tag in ( {{ "'" + "','".join(f_tag) + "'" }} )
      {% endif %}
   )  group by time
   ```
    
   Finally my SQL looks like:
   `Select count(*), time USER_PRESENTATION where id in (select id from USER_PRESENTATION_TAG_VIEW where tag = 'java')  group by time`


----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] issue-label-bot[bot] commented on issue #9999: Filter before grouping

Posted by GitBox <gi...@apache.org>.
issue-label-bot[bot] commented on issue #9999:
URL: https://github.com/apache/incubator-superset/issues/9999#issuecomment-639613337


   Issue Label Bot is not confident enough to auto-label this issue. See [dashboard](https://mlbot.net/data/apache/incubator-superset) for more details.


----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] kwims closed issue #9999: Filter before grouping

Posted by GitBox <gi...@apache.org>.
kwims closed issue #9999:
URL: https://github.com/apache/incubator-superset/issues/9999


   


----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] rumbin commented on issue #9999: Filter before grouping

Posted by GitBox <gi...@apache.org>.
rumbin commented on issue #9999:
URL: https://github.com/apache/incubator-superset/issues/9999#issuecomment-640176294


   Could you please paste the SQL query that is generated by Superset?
   In my understanding Superset _does_ the filtering before grouping. But having the query would help us understand what is actually happening.


----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org