You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "kgabryje (via GitHub)" <gi...@apache.org> on 2023/02/28 17:54:54 UTC

[GitHub] [superset] kgabryje opened a new pull request, #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

kgabryje opened a new pull request, #23238:
URL: https://github.com/apache/superset/pull/23238

   
   ### SUMMARY
   When there are charts using different datasets in a dashboard and a cross filter is applied on an adhoc column, the charts that use different dataset than the origin chart are crashing with a db error.
   This PR fixes that by excluding filters based on an incompatible adhoc column from the query.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before:
   
   <img width="1728" alt="image" src="https://user-images.githubusercontent.com/15073128/221936633-0af12308-5dc3-4e8f-ae63-acdb6addcfee.png">
   
   After:
   
   <img width="1728" alt="image" src="https://user-images.githubusercontent.com/15073128/221937754-bfa8a068-1d0c-4bf7-a1d0-fb14dba83c04.png">
   
   ### TESTING INSTRUCTIONS
   1. Create a chart that is grouped by an adhoc column (with sql expression) and add it to a dashboard
   2. Add another chart to a dashboard, which should use a different dataset than the first chart
   3. Apply a cross filter by clicking on a series related to the adhoc column in the first chart
   4. Verify that the second chart doesn't crash and is not filtered by the cross filter
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscribe@superset.apache.org

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] [superset] kgabryje commented on pull request #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on PR #23238:
URL: https://github.com/apache/superset/pull/23238#issuecomment-1453412328

   > Can we write a test to cover this bug, too?
   
   Test added


-- 
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: notifications-unsubscribe@superset.apache.org

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] [superset] kgabryje merged pull request #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje merged PR #23238:
URL: https://github.com/apache/superset/pull/23238


-- 
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: notifications-unsubscribe@superset.apache.org

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] [superset] eschutho commented on pull request #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on PR #23238:
URL: https://github.com/apache/superset/pull/23238#issuecomment-1454122981

   Thanks @kgabryje! Looks great


-- 
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: notifications-unsubscribe@superset.apache.org

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] [superset] codecov[bot] commented on pull request #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #23238:
URL: https://github.com/apache/superset/pull/23238#issuecomment-1453419545

   # [Codecov](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#23238](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (975d137) into [master](https://codecov.io/gh/apache/superset/commit/9d0eea9600fb198865ecdc679e60a8e5d353bd66?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9d0eea9) will **decrease** coverage by `11.28%`.
   > The diff coverage is `83.63%`.
   
   > :exclamation: Current head 975d137 differs from pull request most recent head 558f348. Consider uploading reports for the commit 558f348 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #23238       +/-   ##
   ===========================================
   - Coverage   67.51%   56.23%   -11.28%     
   ===========================================
     Files        1907     1907               
     Lines       73436    73466       +30     
     Branches     7977     7976        -1     
   ===========================================
   - Hits        49581    41316     -8265     
   - Misses      21803    30098     +8295     
     Partials     2052     2052               
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.70% <83.63%> (+0.07%)` | :arrow_up: |
   | python | `58.88% <83.63%> (-23.38%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `52.48% <27.27%> (-0.02%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...rc/dashboard/components/nativeFilters/selectors.ts](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvc2VsZWN0b3JzLnRz) | `60.97% <ø> (-0.63%)` | :arrow_down: |
   | [superset/viz.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdml6LnB5) | `23.43% <0.00%> (-34.75%)` | :arrow_down: |
   | [superset/models/helpers.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `35.02% <66.66%> (-3.01%)` | :arrow_down: |
   | [superset/common/query\_actions.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2FjdGlvbnMucHk=) | `79.34% <100.00%> (-13.05%)` | :arrow_down: |
   | [superset/common/query\_context\_processor.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHRfcHJvY2Vzc29yLnB5) | `62.85% <100.00%> (-25.63%)` | :arrow_down: |
   | [superset/common/utils/query\_cache\_manager.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL3F1ZXJ5X2NhY2hlX21hbmFnZXIucHk=) | `87.87% <100.00%> (-2.34%)` | :arrow_down: |
   | [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `75.70% <100.00%> (-13.67%)` | :arrow_down: |
   | [superset/exceptions.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXhjZXB0aW9ucy5weQ==) | `91.59% <100.00%> (-0.72%)` | :arrow_down: |
   | [superset/utils/core.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvY29yZS5weQ==) | `64.91% <100.00%> (-25.99%)` | :arrow_down: |
   | [superset/utils/dashboard\_import\_export.py](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvZGFzaGJvYXJkX2ltcG9ydF9leHBvcnQucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [300 more](https://codecov.io/gh/apache/superset/pull/23238?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: notifications-unsubscribe@superset.apache.org

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] [superset] eschutho commented on a diff in pull request #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #23238:
URL: https://github.com/apache/superset/pull/23238#discussion_r1120694777


##########
superset/exceptions.py:
##########
@@ -270,3 +270,7 @@ class SupersetCancelQueryException(SupersetException):
 
 class QueryNotFoundException(SupersetException):
     status = 404
+
+
+class ColumnNotFoundException(SupersetException):

Review Comment:
   Should we make this a 404/not found status?



-- 
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: notifications-unsubscribe@superset.apache.org

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] [superset] kgabryje commented on a diff in pull request #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #23238:
URL: https://github.com/apache/superset/pull/23238#discussion_r1124347876


##########
superset/exceptions.py:
##########
@@ -270,3 +270,7 @@ class SupersetCancelQueryException(SupersetException):
 
 class QueryNotFoundException(SupersetException):
     status = 404
+
+
+class ColumnNotFoundException(SupersetException):

Review Comment:
   Done



-- 
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: notifications-unsubscribe@superset.apache.org

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] [superset] villebro commented on a diff in pull request #23238: fix(dashboard): Charts crashing when cross filter on adhoc column is applied

Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro commented on code in PR #23238:
URL: https://github.com/apache/superset/pull/23238#discussion_r1124442698


##########
tests/integration_tests/charts/data/api_tests.py:
##########
@@ -73,6 +74,12 @@
     "when gender = 'girl' then 'female' else 'other' end",
 }
 
+INCOMPATIBLE_ADHOC_COLUMN_FIXTURE: AdhocColumn = {
+    "hasCustomLabel": True,
+    "label": "exciting_or_boring",
+    "sqlExpression": "case when genre = 'Action' then 'Exciting' " "else 'Boring' end",

Review Comment:
   autoformatter nit:
   ```suggestion
       "sqlExpression": "case when genre = 'Action' then 'Exciting' else 'Boring' end",
   ```



-- 
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: notifications-unsubscribe@superset.apache.org

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