malloydata / malloy

Malloy is an experimental language for describing data relationships and transformations.
http://www.malloydata.dev
MIT License
1.95k stars 75 forks source link

Blocked from using database function that should work #1774

Open bporterfield opened 2 months ago

bporterfield commented 2 months ago

What happens?

Trying to use array_agg! on a dimension from a join_many but being told "Cannot use a scalar field in a measure declaration, did you mean to use a dimension declaration instead?". Using the internal string_agg does work on the same dimension though...

To Reproduce

Join many something and try to do aggregating database function on a joined dimension

OS:

macOS

Malloy Client:

local VSCode

Malloy Client Version:

latest

Database Connection:

Postgres

carlineng commented 2 months ago

Current workaround is to do something like func!(args) + sum(0). the sum(0) "tricks" the compiler into realizing this is an aggregate function, so it works. Probably a way to do it for cases where func!(args) returns a string, but regardless, this workaround is a gross hack and we should do something to fix it.