Bug description

I get an error when using the filter by metric in the Histogram chart.

Apache Druid Error
'errorClass'


This may be triggered by:
Issue 1002 - The database returned an unexpected error. 

How to reproduce the bug

  1. build a histogram chart
  2. add a metric filter(having count(*))
  3. update the chart to get a view
  4. You will get an error

Screenshots/recordings

Apache Superset Histogram do not support filter by metric

Superset version

4.0.2

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

I found a similar unsolved discussion regarding an error when filtering a Druid query from the dashboard [1].

The known limitation of the Histogram chart in Superset is that cross filtering is not yet implemented [2].

In Superset version 4.0.2, there were fixes related to metric filtering and general filtering that might be relevant: 1. Fix: Custom SQL filter control (#29260): This fix addresses issues with the custom SQL filter control, which could impact how metrics are filtered. 2. Fix: filters not updating with force update when caching is enabled (#29291): This fix ensures that filters update correctly even when caching is enabled, which could affect metric filtering [3].

The specific SQL syntax or query configurations known to cause issues with Apache Druid in Superset are related to time grain expressions. Deviations from predefined expressions might cause issues [4][5].

For handling metric filters with Apache Druid, ensure that the pydruid package is installed and the connection string is correctly set up:

pip install pydruid

Connection string format:

druid://<User>:<password>@<Host>:<Port-default-9088>/druid/v2/sql

This setup allows Superset to handle Druid metrics and post-aggregations effectively [6].

To continue talking to Dosu, mention @dosu.

Comment From: rusackas

I was able to get this to work fine on other dbs... seems more like a Druid driver issue? Maybe @betodealmeida will have a clue.

Comment From: rusackas

Also, indeed, it seems Dosu is right about the linked discussion looking rather similar.

Comment From: rusackas

Is anyone still facing this in 4.1.2 or newer? It's been silent for >200 days and is at risk of being closed as stale.

Comment From: rusackas

OK, just went and validated this myself. This is indeed busted.

On the latest master we at least see a more helpful error:

Image

Indeed, if I add a "GROUP BY" it works just fine.