superset icon indicating copy to clipboard operation
superset copied to clipboard

Issue with postagg druid metric used in a pivot viz

Open gurdeep18 opened this issue 10 years ago • 1 comments

I have a postagg druid metric OOS% which is calculated using a javascript abs percent function on 2 sum metrics from druid.

When using this OOS% in a pivot table using the Aggregate function "Sum" gives the following error. When using the "min" or "max" aggregate function this metric works on the pivot.

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/site-packages/Flask_AppBuilder-1.8.1-py2.7.egg/flask_appbuilder/security/decorators.py", line 26, in wraps
    return f(self, *args, **kwargs)
  File "/Users/z084258/dev/new/caravel/caravel/models.py", line 1760, in wrapper
    return f(*args, **kwargs)
  File "/Users/z084258/dev/new/caravel/caravel/views.py", line 1184, in explore
    viz_obj.get_json(),
  File "/Users/z084258/dev/new/caravel/caravel/viz.py", line 318, in get_json
    'data': self.get_data(),
  File "/Users/z084258/dev/new/caravel/caravel/viz.py", line 513, in get_data
    return self.get_df().to_html(
  File "/Users/z084258/dev/new/caravel/caravel/viz.py", line 508, in get_df
    margins=True,
  File "/usr/local/lib/python2.7/site-packages/pandas-0.18.1-py2.7-macosx-10.11-x86_64.egg/pandas/tools/pivot.py", line 158, in pivot_table
    margins_name=margins_name)
  File "/usr/local/lib/python2.7/site-packages/pandas-0.18.1-py2.7-macosx-10.11-x86_64.egg/pandas/tools/pivot.py", line 222, in _add_margins
    row_margin[k] = grand_margin[k[0]]
KeyError: u'OOS%'

gurdeep18 avatar Sep 30 '16 21:09 gurdeep18

Notice: this issue has been closed because it has been inactive for 569 days. Feel free to comment and request for this issue to be reopened.

mistercrunch avatar Apr 23 '18 17:04 mistercrunch