Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't require AS_VALUE to access multi-column group by columns #6371

Closed
agavra opened this issue Oct 7, 2020 · 0 comments · Fixed by #6770
Closed

Don't require AS_VALUE to access multi-column group by columns #6371

agavra opened this issue Oct 7, 2020 · 0 comments · Fixed by #6770

Comments

@agavra
Copy link
Contributor

agavra commented Oct 7, 2020

ksqlDB should allow access to the group-by columns without using AS_VALUE to manually copy them into the value.

Current Behavior:

ksql> CREATE STREAM a (id int key, col1 int) with (kafka_topic='a', value_format='json', partitions=1);
ksql> CREATE TABLE gb AS SELECT id, col1, COUNT(*) FROM a GROUP BY id, col1;

 Message
----------------------------------
 Created query with ID CTAS_GB_15
----------------------------------
ksql> SELECT id FROM gb;
Line: 1, Col: 8: SELECT column 'ID' cannot be resolved.

There are various ways to implement this:

  1. we can actively copy any selected group by component into the value
  2. we can leverage structured keys (Add support for generic message keys (e.g. message keys in Avro or JSON format, STRUCT) #824) and decompose the key from the struct

I think the former is a good enough solution in the short term (which is how we implemented it before), while we should strive to implement the latter. The latter may require a refactor (TODO: link ticket here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant