简体   繁体   English

是否可以在 Confluent KSQL 查询中使用多个左连接? 试图加入超过 1 个表的流,如果没有,那么解决方案是什么?

[英]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?

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>;对于运行时统计信息和查询详细信息,请运行: DESCRIBE EXTENDED <Stream,Table>;

Table-01 :表-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.尝试加入流与 table-01 正按预期工作。 Create stream finalstream as select a.id from ammas a left join appat b on a.id = b.id where b.id is null .创建流 finalstream 作为 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.谢谢。

KSQL currently (v5.3) only supports a single join operation per statement. KSQL 当前 (v5.3) 仅支持每个语句的单个连接操作。 If you want to perform multiple joins you have to "daisy-chain" them in multiple statements, eg如果你想执行多个连接,你必须在多个语句中“菊花链”它们,例如

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;

Update November 2020: ksqlDB supports multi-way joins were added in ksqlDB v0.9. 2020 年 11 月更新:ksqlDB v0.9 中添加了 ksqlDB 支持多路连接。 Confluent Platform 6.0 includes ksqlDB 0.10.2 and therefore also includes this functionality. Confluent Platform 6.0 包含 ksqlDB 0.10.2,因此也包含此功能。 See the release blog and documentation for details.有关详细信息,请参阅发布博客文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM