Skip to content

Conversation

@villebro
Copy link
Member

@villebro villebro commented Apr 13, 2021

SUMMARY

The recent PR #13739 caused a regression causing mutated column aliases to be returned from the SQLAlchemy model in the resulting DataFrame. The bug affects datasets on BigQuery, Athena, Redshift and Elasticsearch/Open Distro. By setting the optional key parameter on the Column object (docs) to the expected column name, and later referencing that when renaming columns in the DataFrame, we can ensure that column names are mutated back prior to returning.

BEFORE

Currently column names containing restricted characters are returned. See the failed query and the column COUNT_DISTINCT(str) called COUNT_DISTINCT__93439 in the Results tab):
image

AFTER

After the change, the chart renders and the column names in the Results tab show the expected labels:
image

TEST PLAN

CI + new test

ADDITIONAL INFORMATION

  • Has associated issue: Closes Charts with spaces in metric names generate Unexpected Errors #13812
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice catch, just a comment on the test

@codecov
Copy link

codecov bot commented Apr 13, 2021

Codecov Report

Merging #14095 (455fed0) into master (287bc12) will increase coverage by 0.18%.
The diff coverage is 78.57%.

❗ Current head 455fed0 differs from pull request most recent head eb353f0. Consider uploading reports for the commit eb353f0 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14095      +/-   ##
==========================================
+ Coverage   79.52%   79.71%   +0.18%     
==========================================
  Files         939      942       +3     
  Lines       47541    47676     +135     
  Branches     5938     5984      +46     
==========================================
+ Hits        37808    38004     +196     
+ Misses       9612     9551      -61     
  Partials      121      121              
Flag Coverage Δ
cypress 56.34% <79.86%> (+0.29%) ⬆️
hive 80.45% <83.01%> (+0.01%) ⬆️
mysql 80.72% <83.01%> (+0.01%) ⬆️
postgres 80.75% <83.01%> (?)
presto ?
python 81.16% <83.01%> (-0.11%) ⬇️
sqlite 80.35% <83.01%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rset-frontend/src/components/ErrorMessage/types.ts 100.00% <ø> (ø)
...et-frontend/src/dashboard/actions/nativeFilters.ts 60.00% <ø> (ø)
...rontend/src/dashboard/components/DashboardGrid.jsx 89.47% <ø> (ø)
...nativeFilters/FilterBar/FilterSets/EditSection.tsx 80.00% <ø> (+46.00%) ⬆️
...tiveFilters/FilterBar/FilterSets/FilterSetUnit.tsx 95.65% <ø> (+52.17%) ⬆️
...tiveFilters/FilterBar/FilterSets/FiltersHeader.tsx 91.42% <ø> (+59.99%) ⬆️
...ents/nativeFilters/FilterBar/FilterSets/Footer.tsx 95.23% <ø> (+47.61%) ⬆️
...nents/nativeFilters/FilterBar/FilterSets/index.tsx 46.46% <ø> (ø)
...ntend/src/dashboard/containers/DashboardHeader.jsx 100.00% <ø> (ø)
...nd/src/dashboard/util/activeAllDashboardFilters.ts 100.00% <ø> (ø)
... and 76 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 287bc12...eb353f0. Read the comment docs.

@villebro villebro merged commit 15ac075 into apache:master Apr 13, 2021
@villebro villebro deleted the villebro/fix-labels-expected branch April 13, 2021 13:19
villebro added a commit to preset-io/superset that referenced this pull request Apr 13, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 First shipped in 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/M 🚢 1.2.0 First shipped in 1.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charts with spaces in metric names generate Unexpected Errors

3 participants