3

I have 3 topics with KAFKA_INT key

customer,orders,orderdetails

When i do joining 2 tables only


select * from orders o join customer c on o.custid = c.custid emit changes; -- OK 

select od.id, od.orderid from orderdetails od join orders o on od.orderid = o.orderid emit changes; -- OK


-- NOT OK
 
select * from orderdetails od
join order o on od.orderid = o.orderid
join customer c on o.custid = c.custid
emit changes limit 5; 

-- Error
Invalid join condition: foreign-key table-table joins are not supported as part of n-way joins. Got o.custid = c.custid.

However, I couldn't find any documentation how can multiple tables join work and what is the limitation of it.

I am using Confluent KAFKA HELM version 7.0

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
taymedee
  • 484
  • 2
  • 5
  • 11

1 Answers1

0

Table to table multi joins (n-way joins) are not supported in ksqldb as the error message says. In order to make that joins probably you will need to make an intermediate support table. Something like this:

CREATE TABLE orderdetails_join_order AS 
SELECT *
FROM orderdetails od
JOIN order o ON od.orderid = o.orderId;

Now you can use this table to perform your query:

SELECT * FROM orderdetails_join_order odjo
JOIN customer c ON odjo.custid = c.custid
José Vte. Calderón
  • 1,348
  • 12
  • 17