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

No numeric types to aggregate exception when using timeshift on line chart #8954

lkuchars opened this issue Jan 13, 2020 · 1 comment


Copy link

@lkuchars lkuchars commented Jan 13, 2020

This bug is easy to reproduce on vanilla superset with demo datasource and tables.
What you do is you configure simplest line chart possible. The clue here is to turn on timeshift option for line chart. Time shift option should overlay another line (with historic data) on your current chart. Exception is always thrown when you setup filter for such chart so that query for historical results return no data at all.

To reproduce it make simple line chart on random_time_series table with count() metric and month time grain. Then setup time shift for 1 year actual values.
When you setup filter so that only recent data is being presented all looks ok. But now try this.
Earliest entry for random_time_series table is 2011-03-15. Setup your filter to custom timerange to show you data from 2011-01-01 to 2011-01-01. When you do that chart crashes. When you turn off timeshift option everything works as it should.

The problem for us is that we're trying to setup superset for customer who has no historic data yet. But we want to preinstall dashboards that would use timeshift right away without waiting for current data to get old enough so that we can enable this on all line charts

Is there any other way to configure (month back) timeshift on LineChart for dataset that has, let's say' only week worth of data and not crash superset?

In case anyone having troubles reproducing this error I recorded screen capture:

Expected results

I'd expect LineChart to just ignore state were there is no data for timeshift. Only single plot would be displayed then

Actual results

This is stacktrace:

superset2_1          | Traceback (most recent call last):
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/superset/views/", line 120, in wraps
superset2_1          |     return f(self, *args, **kwargs)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/superset/utils/", line 69, in wrapper
superset2_1          |     return f(*args, **kwargs)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/superset/views/", line 1092, in explore_json
superset2_1          |     viz_obj, csv=csv, query=query, results=results, samples=samples
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/superset/views/", line 1013, in generate_json
superset2_1          |     payload = viz_obj.get_payload()
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/superset/", line 373, in get_payload
superset2_1          |     self.run_extra_queries()
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/superset/", line 1225, in run_extra_queries
superset2_1          |     df2 = self.process_data(df2)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/superset/", line 1160, in process_data
superset2_1          |     index=DTTM_ALIAS, columns=fd.get("groupby"), values=self.metric_labels
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/", line 5759, in pivot_table
superset2_1          |     margins_name=margins_name)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/reshape/", line 82, in pivot_table
superset2_1          |     agged = grouped.agg(aggfunc)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/groupby/", line 1315, in aggregate
superset2_1          |     return super(DataFrameGroupBy, self).aggregate(arg, *args, **kwargs)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/groupby/", line 186, in aggregate
superset2_1          |     result, how = self._aggregate(arg, _level=_level, *args, **kwargs)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/", line 356, in _aggregate
superset2_1          |     **kwargs), None
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/", line 312, in _try_aggregate_string_function
superset2_1          |     return f(*args, **kwargs)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/groupby/", line 1132, in mean
superset2_1          |     return self._cython_agg_general('mean', **kwargs)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/groupby/", line 70, in _cython_agg_general
superset2_1          |     how, alt=alt, numeric_only=numeric_only, min_count=min_count)
superset2_1          |   File "/usr/local/lib/python3.6/site-packages/pandas/core/groupby/", line 143, in _cython_agg_blocks
superset2_1          |     raise DataError('No numeric types to aggregate')
superset2_1          | pandas.core.base.DataError: No numeric types to aggregate


How to reproduce the bug

Described in main section.


Version: 0.35.1

superset@074734e962da:~$ python --version
Python 3.6.9

Tested on superset running in docker:

This is docker-compose.yml entry for it

    image: amancevice/superset:0.35.1
      - "8888:8088"

This comment has been minimized.

Copy link

@issue-label-bot issue-label-bot bot commented Jan 13, 2020

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.91. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the #bug label Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.