KSQL左连接不起作用

时间:2018-03-16 10:05:54

标签: apache-kafka confluent ksql

我是stackoverflow的新手,所以让我知道如果我在这里发布这些问题我有什么不对。

我已经尝试找到答案,但无法在网站上找到KSQL JOIN相关问题,所以我发布了这个。我已经尝试了不同的方法来运行此查询,但我一直得到空指针异常,所以在此处发布。

我有2个kafka avro主题交易&费用,但数据有很多空白,以清楚我已创建以下主题和表与修剪数据。 const exampleInfo: GithubInfo = { name: "Hello", login: "Hello1", description: "TypeScript dev", repos: [{ project: "ts", star: 5 }, { project: "js", star: 5 }] }; const repos = from(gitHubInfo["repos"]); const reposeDetial = repos.pipe( map(val => `${val.project},${val.star}`)) .subscribe(val => { console.log(val); // emit `ts,5` ,`js,5` instead in single block `ts,5,js,5` }); DEAL_STREAM

EXPENSE_TABLE

结果:

ksql> describe EXPENSE_TABLE;

Field      | Type
ROWTIME    | BIGINT (system)
ROWKEY     | VARCHAR(STRING) (system)
KSQL_COL_0 | VARCHAR(STRING)
KSQL_COL_1 | VARCHAR(STRING)
KSQL_COL_2 | VARCHAR(STRING)

结果:

ksql> describe deal_stream;

当我执行以下Query时,它给出了空指针异常。 我尝试了以下查询。

1:

Field      | Type
ROWTIME    | BIGINT (system)
ROWKEY     | VARCHAR(STRING) (system)
KSQL_COL_0 | VARCHAR(STRING)
KSQL_COL_1 | VARCHAR(STRING)
KSQL_COL_2 | VARCHAR(STRING)

2:

ksql> CREATE STREAM deal_expense_new AS SELECT td.KSQL_COL_0 , te.KSQL_COL_1 FROM deal_stream td LEFT JOIN expense_table te ON td.KSQL_COL_0 = te.KSQL_COL_0;

3:

ksql> CREATE STREAM deal_expense_new AS SELECT td.KSQL_COL_0 AS KSQL_COL_0 , te.KSQL_COL_1 FROM deal_stream td LEFT JOIN expense_table te ON td.KSQL_COL_0 = te.KSQL_COL_0;

错误:

CREATE STREAM deal_expense_trimmed AS SELECT td.KSQL_COL_0 AS KSQL_COL_0 , te.KSQL_COL_1 FROM deal_stream td LEFT JOIN expense_table te ON td.KSQL_COL_0 = te.KSQL_COL_0 where td.KSQL_COL_0 IS NOT NULL;

1 个答案:

答案 0 :(得分:6)

这个bug应该在最新的master中修复。该修复程序将包含在下一个月度发行版中。这是github问题:https://github.com/confluentinc/ksql/issues/521