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

Mapbox isn't working on Druid #4371

Closed
2 of 3 tasks
SpyderRivera opened this issue Feb 7, 2018 · 10 comments
Closed
2 of 3 tasks

Mapbox isn't working on Druid #4371

SpyderRivera opened this issue Feb 7, 2018 · 10 comments

Comments

@SpyderRivera
Copy link
Contributor

SpyderRivera commented Feb 7, 2018

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 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.21

Expected results

A map

Actual results

Traceback (most recent call last):
  File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py", line 276, in get_payload
    df = self.get_df()
  File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py", line 98, in get_df
    self.results = self.datasource.query(query_obj)
  File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 1145, in query
    client=client, query_obj=query_obj, phase=2)
  File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 933, in get_query_str
    return self.run_query(client=client, phase=phase, **query_obj)
  File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 995, in run_query
    metrics_dict)
  File "/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py", line 892, in metrics_and_post_aggs
    if metrics_dict[metric_name].metric_type != 'postagg':
KeyError: None

Steps to reproduce

Choose World Map as the viz type. Select the dimension containing the country code (in my case ISO alpha 2).

@xrmx
Copy link
Contributor

xrmx commented Feb 7, 2018

Is this a build from git or a release? In the first case the git hash is more helpful than the version written in the source.

@SpyderRivera
Copy link
Contributor Author

I built from git, but I don't know exactly how to find the hash. I looked at my fork and the last pull from the main repo looks like
commit 5bc734b

@mistercrunch
Copy link
Member

Looks like a problem around handling a Druid postaggregation that references a metric or post agg that doesn't exist. Would be nice to handle that error better.

@SpyderRivera
Copy link
Contributor Author

How could that happen? I am not able to select metrics that doesn't exist. Also I am using the default COUNT(*) metric.

@mistercrunch
Copy link
Member

Mind sharing your JSON? I'm guessing there's a reference that doesn't line up somehow

@SpyderRivera
Copy link
Contributor Author

SpyderRivera commented Feb 8, 2018

{"status": "failed", "stacktrace": "Traceback (most recent call last):\n  File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py\", line 276, in get_payload\n    df = self.get_df()\n  File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/viz.py\", line 98, in get_df\n    self.results = self.datasource.query(query_obj)\n  File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 1145, in query\n    client=client, query_obj=query_obj, phase=2)\n  File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 933, in get_query_str\n    return self.run_query(client=client, phase=phase, **query_obj)\n  File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 995, in run_query\n    metrics_dict)\n  File \"/home/mtraylor/venv/lib/python2.7/site-packages/superset-0.21.0rc1-py2.7.egg/superset/connectors/druid/models.py\", line 892, in metrics_and_post_aggs\n    if metrics_dict[metric_name].metric_type != 'postagg':\nKeyError: None\n", "cached_dttm": "2018-02-08T15:15:05", "is_cached": false, "query": "", "cache_timeout": 86400, "data": null, "error": "None", "form_data": {"show_bubbles": false, "viz_type": "world_map", "having_filters": [], "metric": "count", "since": "7 days ago", "entity": "targets_geo_country_code", "druid_time_origin": null, "country_fieldtype": "cca2", "datasource": "2__druid", "filters": [], "granularity": "one day", "secondary_metric": null, "until": "now", "max_bubble_size": "25"}, "cache_key": "a9c07ee3943383be73254cb35af81543", "annotations": []}

@mistercrunch
Copy link
Member

mistercrunch commented Feb 8, 2018

I meant the JSON expression for your post aggregation definition, also not that you can use triple backticks for better multi line rendering on github ```

@SpyderRivera
Copy link
Contributor Author

I am not using a post agg. I am using COUNT(*)

@emlittleworth
Copy link
Contributor

Hey @SpyderRivera I think the problem you were experiencing was that the "Bubble Size" dropdown in the "Bubbles" section is required. When it isn't selected, None is passed as the secondary metric which results in the KeyError you see in the stack trace. The current version of Superset enforces this with a validation requiring the dropdown to be selected but if you haven't upgraded, you should be able to see the map if you select the dropdown (whether the "Show Bubbles" box is checked or not).

@SpyderRivera
Copy link
Contributor Author

This works in the latest version! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants