confluentinc / ksql

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

(pull)-query a joined table #4493

Closed ShahOdin closed 4 years ago

ShahOdin commented 4 years ago

I have asked the question on stack-overflow: https://stackoverflow.com/questions/60123191/ksql-pull-query-a-joined-table

ShahOdin commented 4 years ago

@vpapavas @agavra could you please let me know if there is a workaround in the mean-time? Are pull queries not supported in the 0.5.x versions? I can see references to it all over the place and I am very confused as to why I can't seem to do it!

is it a problem with my streams/tables? is it a problem with the control center editor?

mjsax commented 4 years ago

Currently, ie, ksqlDB 0.6.0, only stream aggregation queries that return a table allow to query the result table.

For a table-table join, the result is not materialized into a local store, but only a changelog stream is produced and written to the result topic that corresponds to the result table.

ShahOdin commented 4 years ago

@mjsax Thanks.

mjsax commented 4 years ago

Thanks. I just double checked the KLIP. Seems, the backward compatibility was only done for persistent queries, but not for transient queries: https://github.com/confluentinc/ksql/blob/master/design-proposals/klip-8-queryable-state-stores.md#backward-compatibility

ShahOdin commented 4 years ago

@mjsax Thanks. so what are the actions to take from this? and in the mean time, Is there a workaround for this? so I can present a demo to my team?

ShahOdin commented 4 years ago

@mjsax to clarify,

mjsax commented 4 years ago

Well, pull queries still have limitations. It's maybe too subtle in the docs but the example says:

SELECT select_expr [, ...]
  FROM aggregate_table

(1) pull queries over STREAMS (what you mention above as stream created out of kafka topic and stream created out of stream-stream join) do not really make sense to begin with, because a stream is stateless -- there is nothing to be queried.

(2) Atm, pull quries are only supported on TABLES that are the result of an aggregation query (cf. above FROM aggregate_table -- I agree, it's quite subtle). The two types of tables you mentioned above (table created out of kafka topic and table created out of table-table join) are not yet queryable, because neither of both tables is actually materialized in a local state store, but only the result changelog topic is written into the corresponding output topic. It's a known (maybe not well documented) limitation that is still in 0.8.0 release (and it's unclear in which release it will be fixed atm).

big-andy-coates commented 4 years ago

This will be address by https://github.com/confluentinc/ksql/issues/5652. Closing this ticket as a duplicate.