confluentinc / ksql

The database purpose-built for stream processing applications.
https://ksqldb.io
Other
128 stars 1.04k forks source link

Reconsider how we create KTables in KSQL #1170

Open rodesai opened 6 years ago

rodesai commented 6 years ago

Currently, KSQL creates a KTable for a Table source by:

  1. Build a KStream over the changelog topic
  2. Add some stateless transform processors for adding the rowtime and rowkey fields
  3. Group the KStream and call GroupedKStream.reduce

This has a few problems:

Longer term, it would be nice to add apis to Kafka Streams that KSQL can leverage to solve the above. Some ideas:

guozhangwang commented 6 years ago

Another idea as I was proposing for this issue, is to piggy back on KIP-159 to add an overloaded function of

StreamsBuilder.table(topic, context, mapper)

That it returns a new value from the mapper in which it can access the record context that returns the timestamp. It is similar to the transformValues idea above.