malloy icon indicating copy to clipboard operation
malloy copied to clipboard

INTERNAL ERROR when trying to count joined rows

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
        measure: lifetime_chats is count(chat.id)
    }
    group_by: id
}

was talking to @lloydtabb about #1762 and he said "You can fix this by counting chats.id" - but when I do that (see lifetime_chats above) i get an INTERNAL ERROR: INTERNAL ERROR model/Segment.nextStructDef: unknown field definition {"name":"lifetime_chats","type":"error"}

To Reproduce

See above

OS:

mac

Malloy Client:

local VSCode

Malloy Client Version:

latest

Database Connection:

Postgres

bporterfield avatar Jul 11 '24 16:07 bporterfield