malloy icon indicating copy to clipboard operation
malloy copied to clipboard

Refinement with a "where" seems to obscure output space?

Open bporterfield opened this issue 7 months ago • 1 comments

What happens?

source: user is db.table('public.user') extend {
  primary_key: id
  measure: user_count is count()
}

source: chat is db.table('public.chat_message') extend {
    primary_key: id
    join_one: user on sender_id = user.id
    measure: chat_count is count()
}

query: user_chat_facts is user -> { 
    extend: {
        join_many: chat on chat.sender_id = id
    }
    group_by: id
    aggregate: lifetime_chats is count(chat.id::string)
}

run: user_chat_facts + { group_by: name, order_by: lifetime_chats } + { where: id::string = "test" }

The run query has an error "Unknown field lifetime_chats in output space". If I remove + { where: id::string = "test" }, this error goes away and the query runs correctly.

To Reproduce

see above

OS:

macOS

Malloy Client:

local VSCode

Malloy Client Version:

latest

Database Connection:

Postgres

bporterfield avatar Jul 12 '24 17:07 bporterfield