Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pivot columns with ints for name #16259

Merged
merged 1 commit into from
Aug 14, 2021

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Aug 14, 2021

SUMMARY

The pivot column post-processing is failing because some columns have ints for their names instead of strings.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/security/decorators.py", line 67, in wraps
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/superset/views/base_api.py", line 85, in wraps
    raise ex
  File "/usr/local/lib/python3.7/site-packages/superset/views/base_api.py", line 82, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/superset/utils/core.py", line 1428, in time_function
    response = func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/superset/utils/log.py", line 241, in wrapper
    value = f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/superset/charts/api.py", line 647, in get_data
    return self.get_data_response(command, form_data=form_data)
  File "/usr/local/lib/python3.7/site-packages/superset/charts/api.py", line 545, in get_data_response
    return self.send_chart_response(result, form_data)
  File "/usr/local/lib/python3.7/site-packages/superset/charts/api.py", line 509, in send_chart_response
    result = apply_post_process(result, form_data)
  File "/usr/local/lib/python3.7/site-packages/superset/charts/post_processing.py", line 204, in apply_post_process
    processed_df = post_processor(df, form_data)
  File "/usr/local/lib/python3.7/site-packages/superset/charts/post_processing.py", line 180, in pivot_table_v2
    df.columns = [" ".join(column) for column in df.columns]
  File "/usr/local/lib/python3.7/site-packages/superset/charts/post_processing.py", line 180, in <listcomp>
    df.columns = [" ".join(column) for column in df.columns]
TypeError: sequence item 1: expected str instance, int found

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • 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

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

That was an interesting case..

@codecov
Copy link

codecov bot commented Aug 14, 2021

Codecov Report

Merging #16259 (128383d) into master (24b43be) will decrease coverage by 0.21%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16259      +/-   ##
==========================================
- Coverage   76.72%   76.50%   -0.22%     
==========================================
  Files         997      997              
  Lines       53238    53241       +3     
  Branches     6772     6772              
==========================================
- Hits        40847    40734     -113     
- Misses      12161    12277     +116     
  Partials      230      230              
Flag Coverage Δ
hive ?
mysql 81.52% <100.00%> (-0.04%) ⬇️
postgres 81.59% <100.00%> (+<0.01%) ⬆️
presto ?
python 81.68% <100.00%> (-0.43%) ⬇️
sqlite 81.19% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/charts/post_processing.py 77.01% <100.00%> (ø)
superset/reports/commands/execute.py 92.59% <100.00%> (+0.09%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 69.80% <0.00%> (-16.87%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-6.49%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/connectors/sqla/models.py 88.04% <0.00%> (-1.66%) ⬇️
superset/db_engine_specs/base.py 88.00% <0.00%> (-0.39%) ⬇️
superset/models/core.py 89.14% <0.00%> (-0.26%) ⬇️
superset/utils/core.py 88.97% <0.00%> (-0.13%) ⬇️

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 24b43be...128383d. Read the comment docs.

@betodealmeida betodealmeida merged commit 9b2dffe into apache:master Aug 14, 2021
stevenuray pushed a commit to preset-io/superset that referenced this pull request Aug 14, 2021
@villebro villebro added the v1.3 label Aug 16, 2021
villebro pushed a commit that referenced this pull request Aug 16, 2021
amitmiran137 pushed a commit that referenced this pull request Aug 16, 2021
…gies

* upstream/master: (64 commits)
  check roles before fetching reports (#16260)
  chore: upgrade mypy and add type guards (#16227)
  fix: pivot columns with ints for name (#16259)
  chore(pylint): Bump Pylint to 2.9.6 (#16146)
  fix examples tab for dashboard (#16253)
  chore: bump superset-ui packages to 0.17.84 (#16251)
  chore: Shows the dataset description in the gallery dropdown (#16200)
  fix(Dashboard): Omnibar dropdown visibility and keyboard commands (#16168)
  chore: bump py version for integration test (#16213)
  fix: skip perms on query context update (#16250)
  refactor: external metadata fetch API (#16193)
  feat(dao): admin can remove self from object owners (#15149)
  fix(dashboard): cross filter chart highlight when filters badge icon clicked (#16233)
  fix: validate_parameters and query (#16241)
  fix: Remove Advanced Analytics tag for 2 charts (#16240)
  Revert "feat: Changing Dataset names (#16199)" (#16235)
  feat: Allow users to connect via legacy SQLA form (#16201)
  fix: remove encryption from db params (#16214)
  fix(Explore): Show the tooltip only when label does not fit the container in METRICS/FILTERS/GROUP BY/SORT BY of the DATA panel (#16060)
  Show/hide tooltips (#16192)
  ...

# Conflicts:
#	superset/tasks/caching/cache_strategy.py
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🍒 1.3.0 🍒 1.3.1 🍒 1.3.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 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:2021.31 size/XS v1.3 🍒 1.3.0 🍒 1.3.1 🍒 1.3.2 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants