flink-user-zh mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benchao Li <libenc...@gmail.com>
Subject Re: flink sql 实现双流join 的滑动窗口
Date Thu, 02 Apr 2020 09:18:13 GMT
hi kevin,

双流join有两种形式,一种是Time-windowed Join,一种是regular join,见[1]。

tumble window是一个单独的算子,是对一个输入流做窗口聚合。它本身不会跟join有什么关系。
所以你的SQL其实是先做了两个regular join,在join的结果上又做了一个window聚合。

[1]
https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/queries.html#joins

Kevin <kevinjian@dingtalk.com.invalid> 于2020年4月2日周四 下午4:45写道:

> 补一个报错信息:
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.flink.table.api.TableException: Rowtime attributes must not be
> in the input rows of a regular join. As a workaround you can cast the time
> attributes of input tables to TIMESTAMP before.
>
> ------------------------------------------------------------------
> 发件人:Kevin <kevinjian@dingtalk.com.INVALID>
> 发送时间:2020年4月2日(星期四) 16:37
> 收件人:flink-zh <user-zh@flink.apache.org>
> 主 题:flink sql 实现双流join 的滑动窗口
>
> HI ALL:
>     打扰大家了。请教下如何实现双流join的滑动窗口。我的代码运行后就报错了。有经验的同学帮忙解答下。谢谢。
>
> 代码:
> SELECT
> TUMBLE_START(a.ts, INTERVAL '10' MINUTE),
> TUMBLE_END(a.ts, INTERVAL '10' MINUTE),
> sum( CASE WHEN f.business_id <> NULL THEN 1 ELSE 0 END ) AS
> company_pass_first_num,
> sum( CASE WHEN g.business_id <> NULL THEN 1 ELSE 0 END ) AS
> company_pass_num,
> COUNT(a.create_time)
> FROM t1_oa_loan_requests_detail_view a
>   LEFT JOIN t1_oa_flow_inst_task_view_segment_no_5 f ON a.id =
> f.business_id
>   LEFT JOIN t1_oa_flow_inst_task_view_segment_no_61 g ON a.id =
> g.business_id
> GROUP BY TUMBLE(a.ts, INTERVAL '10' MINUTE);
>
> 报错:
>


-- 

Benchao Li
School of Electronics Engineering and Computer Science, Peking University
Tel:+86-15650713730
Email: libenchao@gmail.com; libenchao@pku.edu.cn
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message