I'm learning K-SQL/KSQL-DB and currently exploring joins. Below is the issue where I'm stuck.
I have 1 stream 'DRIVERSTREAMREPARTITIONEDKEYED' and one table 'COUNTRIES', below is their description.
ksql> describe DRIVERSTREAMREPARTITIONEDKEYED;
Name: DRIVERSTREAMREPARTITIONEDKEYED
Field | Type
--------------------------------------
COUNTRYCODE | VARCHAR(STRING) (key)
NAME | VARCHAR(STRING)
RATING | DOUBLE
--------------------------------------
ksql> describe countries;
Name : COUNTRIES
Field | Type
----------------------------------------------
COUNTRYCODE | VARCHAR(STRING) (primary key)
COUNTRYNAME | VARCHAR(STRING)
----------------------------------------------
This is the sample data that they have,
ksql> select * from DRIVERSTREAMREPARTITIONEDKEYED emit changes;
+---------------------------------------------+---------------------------------------------+---------------------------------------------+
|COUNTRYCODE |NAME |RATING |
+---------------------------------------------+---------------------------------------------+---------------------------------------------+
|SGP |Suresh |3.5 |
|IND |Mahesh |2.4 |
ksql> select * from countries emit changes;
+---------------------------------------------------------------------+---------------------------------------------------------------------+
|COUNTRYCODE |COUNTRYNAME |
+---------------------------------------------------------------------+---------------------------------------------------------------------+
|IND |INDIA |
|SGP |SINGAPORE |
I'm trying to do a 'left outer' join on them with the stream being on the left side, but below is the output I get,
select d.name,d.rating,c.COUNTRYNAME from DRIVERSTREAMREPARTITIONEDKEYED d left join countries c on d.COUNTRYCODE=c.COUNTRYCODE emit changes;
+---------------------------------------------+---------------------------------------------+---------------------------------------------+
|NAME |RATING |COUNTRYNAME |
+---------------------------------------------+---------------------------------------------+---------------------------------------------+
|Suresh |3.5 |null |
|Mahesh |2.4 |null |
In ideal scenario I should get the data in 'COUNTRYNAME' column as the 'COUNTRYCODE' column in both stream and data have matching data.
I tried searching a lot but to no avail. I'm using 'Confluent Platform: 6.1.1'