Skip to content

Instantly share code, notes, and snippets.

@miguno
Last active November 28, 2019 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguno/c813d85d1e98536f7a15cf41c0ef3df2 to your computer and use it in GitHub Desktop.
Save miguno/c813d85d1e98536f7a15cf41c0ef3df2 to your computer and use it in GitHub Desktop.
ksqlDB example: creates a new stream with changed number of partitions and a new field as event key (so that its data can be correctly co-partitioned for joining)
CREATE STREAM products ...;
CREATE STREAM products_repartitioned
WITH (PARTITIONS=42) AS
SELECT * FROM products
PARTITION BY product_id
EMIT CHANGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment