Is it possible to use multiple left join in Confluent KSQL query? tried to join stream with more than 1 tables , if not then whats the solution?

一曲冷凌霜 提交于 2019-12-31 03:24:09

问题


Stream :

describe ammas;

 Field   | Type                        
-------------------------------------  
 ROWTIME | BIGINT           (system)  
 ROWKEY  | VARCHAR(STRING)  (system)   
 ID      | INTEGER                      
 -------------------------------------

For runtime statistics and query details run: DESCRIBE EXTENDED <Stream,Table>;

Table-01 :

ksql> show tables;

Table Name | Kafka Topic | Format    | Windowed 
-------------------------------------------------
ANNAT      | anna        | DELIMITED | false    
APPAT      | appa        | DELIMITED | false    
-------------------------------------------------

Trying to Join stream vs. table-01 is working as expected. Create stream finalstream as select a.id from ammas a left join appat b on a.id = b.id where b.id is null.

But when I tried to join more than one table with stream based on the following query:

ksql> SELECT * FROM ammas cd LEFT JOIN appat ab ON ab.id = cd.id LEFT JOIN annat aa ON aa.id =cd.id;
ServerError:io.confluent.ksql.parser.exception.ParseFailedException
Caused by: null

What is going wrong? Thanks.


回答1:


KSQL currently (v5.3) only supports a single join operation per statement. If you want to perform multiple joins you have to "daisy-chain" them in multiple statements, e.g.

CREATE STREAM out1 AS 
  SELECT * FROM ammas cd 
           LEFT JOIN appat ab 
             ON ab.id = cd.id 

CREATE STREAM out_final AS 
  SELECT * FROM out1 o 
           LEFT JOIN annat aa ON o.id =cd.id;


来源:https://stackoverflow.com/questions/51459018/is-it-possible-to-use-multiple-left-join-in-confluent-ksql-query-tried-to-join

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!