metabase / metabase

The simplest, fastest way to get business intelligence and analytics to everyone in your company :yum:
https://metabase.com
Other
38.9k stars 5.17k forks source link

Sorting by Unbinned Date After Summarize Fails (if date is custom column) #49809

Open ixipixi opened 2 weeks ago

ixipixi commented 2 weeks ago

Describe the bug

You cannot sort by a custom expression date column after the aggregate stage if it's unbinned.

To Reproduce

  1. Create a question with the Reviews table from the Sample DB
  2. Use a custom expression to assign a new column name to "created at" - like "date_expr"
  3. Do a count of records grouped by "date_expr" (unbinned)
  4. After the aggregate stage, apply a sort to the unbinned date
  5. See error - looks like we generate invalid group clause

Expected behavior

Sort should work

Logs

No response

Information about your Metabase installation

Reproduced on 50.32 and Stats

Severity

annoying

Additional context

I was able to repro on H2 and Postgres

npfitz commented 2 weeks ago

Repro in our stats instance