Ivan Burmistrov
04/04/2023, 3:14 PMSELECT * FROM myKafkaStream WHERE col1 = "a"
UNION ALL
SELECT * FROM myKafkaStream WHERE col1 = "b"
Is it a valid usage? I was under impression that it's not valid because it would effectively move the Kafka pointer twice. However tried it recently and it seems working, so I'm confused a bitMartijn Visser
04/04/2023, 3:17 PMIvan Burmistrov
04/04/2023, 3:18 PMIvan Burmistrov
04/04/2023, 3:19 PMMartijn Visser
04/04/2023, 3:21 PMEXPLAIN PLAN
you will see the generated query plan. My expectation is that it will include both filters and then union these resultsIvan Burmistrov
04/04/2023, 4:09 PMSELECT
from the same Kafka: the first one is TableSourceScan
, but the second one is Reused(reference_id=[1])
.
So looks like it scans the stream once, but passes the events to both subqueries independently.
Which means referencing the same table in the subqueries is correct - is it the right understanding @Martijn Visser?
I don't remember why, but I have a strong memory it didn't work before and that's why we ended up creating multiple table definitions on top of the same source (and using multiple independent consumer groups, correspondingly) - can it be that this behavior was fixed / changed in the recent Flink versions?