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

Bubble chart broken in 0.26/0.29/0.31 when the bubble size's metric is already used #7079

Closed
3 tasks done
elukey opened this issue Mar 21, 2019 · 3 comments · Fixed by #7087
Closed
3 tasks done

Bubble chart broken in 0.26/0.29/0.31 when the bubble size's metric is already used #7079

elukey opened this issue Mar 21, 2019 · 3 comments · Fixed by #7087
Labels
!deprecated-label:bug Deprecated label - Use #bug instead

Comments

@elukey
Copy link
Contributor

elukey commented Mar 21, 2019

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Superset version

0.29/0.31

A Bubble chart using in its Query section a function(metric) already used elsewhere (like in either X or Y axe) ends up in the following error(s):

Traceback (most recent call last):
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3078, in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 157, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 183, in pandas._libs.index.IndexEngine._get_loc_duplicates
  File "pandas/_libs/index.pyx", line 200, in pandas._libs.index.IndexEngine._maybe_get_bool_indexer
KeyError: 'x'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/internals.py", line 4243, in set
    loc = self.items.get_loc(item)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3080, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 157, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 183, in pandas._libs.index.IndexEngine._get_loc_duplicates
  File "pandas/_libs/index.pyx", line 200, in pandas._libs.index.IndexEngine._maybe_get_bool_indexer
KeyError: 'x'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/views/base.py", line 114, in wraps
    return f(self, *args, **kwargs)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/views/core.py", line 1229, in explore_json
    samples=samples,
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/views/core.py", line 1160, in generate_json
    payload = viz_obj.get_payload()
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/viz.py", line 375, in get_payload
    payload['data'] = self.get_data(df)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/superset/viz.py", line 967, in get_data
    df['x'] = df[[utils.get_metric_name(self.x_metric)]]
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/frame.py", line 3119, in __setitem__
    self._set_item(key, value)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/frame.py", line 3195, in _set_item
    NDFrame._set_item(self, key, value)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/generic.py", line 2600, in _set_item
    self._data.set(key, value)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/internals.py", line 4246, in set
    self.insert(len(self.items), item, value)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/internals.py", line 4347, in insert
    placement=slice(loc, loc + 1))
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/internals.py", line 3205, in make_block
    return klass(values, ndim=ndim, placement=placement)
  File "/srv/deployment/analytics/superset/venv/lib/python3.7/site-packages/pandas/core/internals.py", line 125, in __init__
    '{mgr}'.format(val=len(self.values), mgr=len(self.mgr_locs)))
ValueError: Wrong number of items passed 2, placement implies 1

I wasn't able to track down the origin of the problem. Looks similar to #7006, but after some tests I can see the same issue on 0.26, so probably unrelated to the pandas bump happened in 0.29+.

To be precise: in the above example, If I don't reuse the metric in the Bubble size (but I choose any other available) everything works fine.

@elukey elukey changed the title Bubble chart broken in 0.29/0.31 when the bubble size's metric is already used Bubble chart broken in 0.26/0.29/0.31 when the bubble size's metric is already used Mar 21, 2019
@mistercrunch mistercrunch added the !deprecated-label:bug Deprecated label - Use #bug instead label Mar 21, 2019
@elukey
Copy link
Contributor Author

elukey commented Mar 22, 2019

I confirm that it fixes the problem, thanks! It would be great if this could be backported to 0.29/0.31, otherwise 0.32 will be fine.

@elukey
Copy link
Contributor Author

elukey commented Apr 1, 2019

@mistercrunch Would it be possible to get this backported to release--0.31?

@elukey
Copy link
Contributor Author

elukey commented Apr 12, 2019

This only needs a backport of the commit to the release--0.31 branch and then we can close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants