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/01/29 19:07:45 UTC

[GitHub] [incubator-superset] FredericoCoelhoNunes opened a new issue #9048: filter_values(key)[0] returning a dictionary

FredericoCoelhoNunes opened a new issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048
 
 
   I am using filter_values in a custom source, in the following way:
   ```
   ...
   WHERE percentage_of_active_days >= {{ filter_values('activity_option')[0] if filter_values('activity_option')[0] else 0 }}
   AND n_events_per_day >= {{ filter_values('event_option')[0] if filter_values('event_option')[0] else 0 }}
   ```  
   This works just fine until I set the "activity_option" filter to 0. Then everything crashes, and that part of the query becomes ( from the debugger):
   
   ```
   ...
   WHERE percentage_of_active_days >= {'value': 0,
                                                   'label': 0,
                                                            'style': {'backgroundImage': 'linear-gradient(to right, lightgrey, lightgrey NaN%, rgba(0,0,0,0) NaN%',
                                                                                         'padding': '2px 5px'}}
   AND n_events_per_day >= 0
   ```
   
   ### Expected results
   
   I expected filter_values to return 0 for both of those filters.
   
   ### Actual results
   
   All the queries that use the filter crash, and I also stop being able to access the filter until I reload the dashboard, because the filter box is replaced by the following error message:
   
   ```
   An error occurred while rendering the visualization: Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bvalue%2C%20label%2C%20style%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 
   ```
   
   #### Screenshots
   
   If applicable, add screenshots to help explain your problem.
   
   #### How to reproduce the bug
   
   Not sure, but with my current setup/queries I keep getting this error. The filter works for every other value...
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: Superset 0.35.2
   - python version: Python 3.6.9
   - node.js version: v13.0.1
   - npm version: 6.12.0
   
   ### Checklist
   
   Make sure these boxes are checked before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Additional context
   
   Add any other context about the problem here.
   

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-580177912
 
 
   Some more info: this error does not occur if the filter allows multiple selection, and we just select 0. This is the workaround I will use for now, but it can be very misleading to the end user since that filter is supposed to only allow a single value. 

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-579944023
 
 
   I'm betting someone did `==` instead of `===` on the React frontend, and the filter having value 0 is failing some kind of check...

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] FredericoCoelhoNunes edited a comment on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
FredericoCoelhoNunes edited a comment on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-579944023
 
 
   Is there some `==` instead of `===` on the React frontend, and the filter having value 0 is failing some kind of check?

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] FredericoCoelhoNunes edited a comment on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
FredericoCoelhoNunes edited a comment on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-579935068
 
 
   Even stranger things happening... I decided to explore the chart of the filters, which is a simple filter box that is being created based on a table with two numeric columns, as you can see here:
   ![image](https://user-images.githubusercontent.com/51457048/73392574-fd179280-42d1-11ea-8df1-65b9a0adaece.png)
   
   I can change the values, for example:
   ![image](https://user-images.githubusercontent.com/51457048/73392645-20424200-42d2-11ea-928d-2acad0a420e9.png)
   
   But as soon as I reset any of them to 0, and click "Run Query", and then click on any of the filter dropdowns, this happens:
   ![image](https://user-images.githubusercontent.com/51457048/73392773-5ed7fc80-42d2-11ea-86e9-5e6abcc85837.png)
   
   This is also the error that shows up in the dashboard: `An error occurred while rendering the visualization: Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Bvalue%2C%20label%2C%20style%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`
   
   Any ideas? This behavior completely breaks my dashboards, and won't be able to show this to my client.
   

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-579935068
 
 
   Even stranger things happening... I decided to explore the chart of the filters, which is a simple filter box that is being created based on a table with two numeric columns, as you can see here:
   ![image](https://user-images.githubusercontent.com/51457048/73392574-fd179280-42d1-11ea-8df1-65b9a0adaece.png)
   
   I can change the values, for example:
   ![image](https://user-images.githubusercontent.com/51457048/73392645-20424200-42d2-11ea-928d-2acad0a420e9.png)
   
   But as soon as I reset any of them to 0, and click "Run Query", and then click on any of the filter dropdowns, this happens:
   ![image](https://user-images.githubusercontent.com/51457048/73392773-5ed7fc80-42d2-11ea-86e9-5e6abcc85837.png)
   
   Any ideas? This behavior completely breaks my dashboards, and won't be able to show this to my client.
   

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] stale[bot] closed issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
stale[bot] closed issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048
 
 
   

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] FredericoCoelhoNunes edited a comment on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
FredericoCoelhoNunes edited a comment on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-579942931
 
 
   I also went into the filter_values function itself and printed the value of `form_data.get("extra_filters")`
   and obtained
   ```
   [{'col': 'activity_option', 'op': 'in', 'val': {'value': 0, 'label': 0, 'style': {'backgroundImage': 'linear-gradient(to right, lightgrey, lightgrey NaN%, rgba(0,0,0,0) NaN%', 'padding': '2px 5px'}}}, {'col': 'event_name', 'op': 'in', 'val': ['chat_message_sent', 'dashboard_open', 'gallery_asset_screenshot']}, {'col': 'start_date_option', 'op': 'in', 'val': '2019-12-08'}, {'col': 'end_date_option', 'op': 'in', 'val': '2019-12-09'}]
   ```
   
   Does anyone know why `form_data['extra_filters'][0]['val']` is a dictionary *ONLY IN THE CASE WHERE THE FILTER IS 0*?

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
FredericoCoelhoNunes commented on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-579942931
 
 
   I also went into the filter_values function itself and printed the value of `form_data.get("extra_filters")`
   and obtained
   ```
   [{'col': 'activity_option', 'op': 'in', 'val': {'value': 0, 'label': 0, 'style': {'backgroundImage': 'linear-gradient(to right, lightgrey, lightgrey NaN%, rgba(0,0,0,0) NaN%', 'padding': '2px 5px'}}}, {'col': 'event_name', 'op': 'in', 'val': ['chat_message_sent', 'dashboard_open', 'gallery_asset_screenshot']}, {'col': 'start_date_option', 'op': 'in', 'val': '2019-12-08'}, {'col': 'end_date_option', 'op': 'in', 'val': '2019-12-09'}]
   ```
   
   Does anyone know why `form_data['extra_filters'][0]['val'] is a dictionary *ONLY IN THE CASE WHERE THE FILTER IS 0*?

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [incubator-superset] stale[bot] commented on issue #9048: filter_values(key)[0] returning a dictionary

Posted by GitBox <gi...@apache.org>.
stale[bot] commented on issue #9048: filter_values(key)[0] returning a dictionary
URL: https://github.com/apache/incubator-superset/issues/9048#issuecomment-605917501
 
 
   This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue `.pinned` to prevent stale bot from closing the issue.
   

----------------------------------------------------------------
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: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org