superset icon indicating copy to clipboard operation
superset copied to clipboard

Cannot use metric of type REAL

Open petroswork opened this issue 9 years ago • 10 comments

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

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

Superset version

14.1

Expected results

Metric of type REAL should be available for selection.

Actual results

No metric of type REAL is available to select for a slice.

Steps to reproduce

  1. Use a table with columns of type REAL or DATE.
  2. Attempt to create a slice with metric of type REAL.

petroswork avatar Jan 20 '17 16:01 petroswork

Is this druid or sql alchemy?

xrmx avatar Jan 20 '17 18:01 xrmx

SQLAlchemy using PostgreSQL.

petroswork avatar Jan 21 '17 06:01 petroswork

What do you have in the "list table columns" tab of your table for your column? What metric do you want to use on your column?

xrmx avatar Jan 22 '17 10:01 xrmx

Well, the metric was missing. I assumed that the metrics would appear automatically, as in the case of columns of type INTEGER. Now that I created the metric, it works. Should I change the title?

petroswork avatar Jan 22 '17 11:01 petroswork

What metric do you expect to be created automatically for a REAL field?

xrmx avatar Jan 22 '17 13:01 xrmx

I used SUM(column), as the metric is a ratio of COUNTs aggregated in a day.

Why should an INTEGER column be different?

petroswork avatar Jan 22 '17 14:01 petroswork

But is the sum checkbox checked? in the "list table columns"? I am pretty sure we are enabling some attributes on the columns depending on the type of fields, e.g. is_temporal.

xrmx avatar Jan 23 '17 08:01 xrmx

"Sum", "Min" and "Max" are enabled, yet the only Sql Metric appearing by default is "count".

petroswork avatar Jan 23 '17 09:01 petroswork

I'm also seeing the same behavior when using Redshift.

However, if I update the table in Redshift changing the columns from REAL to FLOAT then Superset will automatically check off the Sum, Min, and Max options as well as create the avg__ and sum__ metrics.

madmanbeck avatar Jan 25 '17 15:01 madmanbeck

@petroswork @madmanbeck the PR above should do the trick

xrmx avatar Jan 25 '17 15:01 xrmx