Using COLLECT_LIST Function in KSQLDB

Dear Community,

Facing the following error (as seen in the below screenshot), while executing the COLLECT_LIST function in the CREATE TABLE query. Could anyone please advise on , how to run the query successfully?

Thanks and Regards,
Keshav Sunder

As the error says: “Key missing from projection”. The (primary) key of the output table is the grouping attribute, i.e YZA in your case.

All TABLEs in ksqlDB, need a primary key, and thus you need to include YZA in the projection of your query (ie, you need to include it in the SELECT).

However, the query seems to have another issue: if you use COLLECT_LIST without a WINDOW clause, the result table will grow unbounded, and I actually believe that ksqlDB would reject your query for this reason.

Thank you @mjsax . I shall try as per the suggestions given by you and get back to you.

Hi @mjsax , This is now working . Thank you.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.