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

[PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

Vitor-Avila opened a new pull request, #26199:
URL: https://github.com/apache/superset/pull/26199

   ### SUMMARY
   Avoid de-normalizing column names in case the engine supports it **but column normalization is enabled in the dataset level**. This is enabled by default to datasets created prior to this feature, to make sure that syncing columns wouldn't break existing charts/etc.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   **Before**
   
   https://github.com/apache/superset/assets/96086495/f30e8688-81c8-4019-b10d-4e4aaef932f6
   
   **After**
   
   https://github.com/apache/superset/assets/96086495/31909ae1-91b7-4710-9c9e-3f531a344821
   
   ### TESTING INSTRUCTIONS
   1. Create a dataset powered by an engine that supports column de-normalization (such as Snowflake). Note that:
    a. All columns are **uppercase**.
    b. Column normalization is disabled (under the **SETTINGS** tab).
   2. Modify the dataset, and enable column normalization.
   3. Save changes.
   4. Modify the dataset again, and sync columns. Note that all columns are now **lowercase**.
   5. Save changes.
   6. Create a new chart using this dataset, and drop any column in the FILTERS section.
   7. Validate the filter is showing available options in the dropdown.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes https://github.com/apache/superset/issues/26198
   - [ ] 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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

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

   thanks @betodealmeida. @hughhhh @villebro I know you've worked similarly with this feature. Do you have any concerns with this PR? thank you!


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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

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

   @michael-s-molina thanks for the tip! I remember a previous PR I created did automatically closed the bug, but I never understood why. I'll make sure to include that out of the checkbox next 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.

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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

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

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: `3 lines` in your changes are missing coverage. Please review.
   > Comparison is base [(`4d4b19e`)](https://app.codecov.io/gh/apache/superset/commit/4d4b19e8bacc59a7257c46589d7151b3a4e6ee49?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 69.18% compared to head [(`510af9d`)](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 58.93%.
   
   | [Files](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/models/helpers.py](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | 33.33% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/datasource/api.py](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGF0YXNvdXJjZS9hcGkucHk=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #26199       +/-   ##
   ===========================================
   - Coverage   69.18%   58.93%   -10.26%     
   ===========================================
     Files        1944     1944               
     Lines       75925    75926        +1     
     Branches     8451     8451               
   ===========================================
   - Hits        52531    44746     -7785     
   - Misses      21209    28995     +7786     
     Partials     2185     2185               
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.64% <25.00%> (-0.01%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.55% <25.00%> (-21.33%)` | :arrow_down: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/26199/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.81% <25.00%> (-0.01%)` | :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=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/26199?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

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


##########
superset/models/helpers.py:
##########
@@ -1340,14 +1340,19 @@ def get_time_filter(  # pylint: disable=too-many-arguments
             )
         return and_(*l)
 
-    def values_for_column(self, column_name: str, limit: int = 10000) -> list[Any]:
-        # always denormalize column name before querying for values
+    def values_for_column(

Review Comment:
   Do our unit tests already have cases where it covers if `denormalize_column` returns the correct values for both true and false already? If not, I would add tests to confirm that the correct things are returned for when the flag is true since we're defaulting to false.



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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on code in PR #26199:
URL: https://github.com/apache/superset/pull/26199#discussion_r1419930472


##########
superset/models/helpers.py:
##########
@@ -1340,14 +1340,19 @@ def get_time_filter(  # pylint: disable=too-many-arguments
             )
         return and_(*l)
 
-    def values_for_column(self, column_name: str, limit: int = 10000) -> list[Any]:
-        # always denormalize column name before querying for values
+    def values_for_column(

Review Comment:
   @sadpandajoe @villebro I just added some basic tests to https://github.com/apache/superset/pull/26220 (since this one got merged). It doesn't test the logic implemented in the DB engine level to denormalize a column (I believe this is DB-specific and would require a more complex setup), but should be at least testing the business logic. 



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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on PR #26199:
URL: https://github.com/apache/superset/pull/26199#issuecomment-1846182294

   I don't know why but when it's part of a checkbox (`Has associated issue` in the template) it does not work. To see if the link worked, you can check the original issue for a message saying that the issue will be closed by the PR.


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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on PR #26199:
URL: https://github.com/apache/superset/pull/26199#issuecomment-1846179514

   @Vitor-Avila Tip: If you include the text "Fixes: https://github.com/apache/superset/issues/26198" in the PR description, when the PR is merged, the issue is automatically closed. This only works for the description, not comments.


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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

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


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


Re: [PR] fix(chart-filter): Avoid column denormalization if not enabled [superset]

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


##########
superset/models/helpers.py:
##########
@@ -1340,14 +1340,19 @@ def get_time_filter(  # pylint: disable=too-many-arguments
             )
         return and_(*l)
 
-    def values_for_column(self, column_name: str, limit: int = 10000) -> list[Any]:
-        # always denormalize column name before querying for values
+    def values_for_column(

Review Comment:
   This is a good idea. However, this part of the codebase is very tricky to add tests for, so it may be difficult. If it's easy to add the test I suggest doing it, otherwise LGTM



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