You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by kcz <57...@qq.com.INVALID> on 2021/09/22 03:41:20 UTC
flink-1.12.0 流模式 使用 lag问题
如何使用才是正确的,求大佬帮看看
behavior,next_bv 字段内容一直是保持一致的,无法得到自己想要的结果
发送的数据
{
"user_id": 1,
"item_id": 1,
"behavior":"pv1"
}
{
"user_id": 1,
"item_id": 1,
"behavior":"pv2"
}
CREATE TABLE KafkaTable (
`user_id` BIGINT,
`item_id` BIGINT,
`behavior` STRING,
proctime as PROCTIME()
) WITH (
'connector' = 'kafka',
'topic' = 'user_behavior',
'properties.bootstrap.servers' = '',
'properties.group.id' = 'testGroup',
'scan.startup.mode' = 'earliest-offset',
'format' = 'json'
);
SELECT
user_id,
item_id,
behavior,
next_bv
FROM
( SELECT *, lag( behavior, 1 ) over ( PARTITION BY user_id ORDER BY proctime ) AS next_bv FROM KafkaTable ) t;
回复: flink-1.12.0 流模式 使用 lag问题
Posted by kcz <57...@qq.com.INVALID>.
tks,我去换版本使用下
------------------ 原始邮件 ------------------
发件人: "user-zh" <libenchao@apache.org>;
发送时间: 2021年9月22日(星期三) 中午12:04
收件人: "user-zh"<user-zh@flink.apache.org>;
主题: Re: flink-1.12.0 流模式 使用 lag问题
Hi,这个是一个已知的bug[1],已经在1.13.1以及1.4版本修复了。
可以使用一下1.13.1试一下,1.4版本现在也正在投票中了,应该很快就会发布出来了。
[1] https://issues.apache.org/jira/browse/FLINK-19449
kcz <573693104@qq.com.invalid> 于2021年9月22日周三 上午11:41写道:
> 如何使用才是正确的,求大佬帮看看
> behavior,next_bv 字段内容一直是保持一致的,无法得到自己想要的结果
>
>
> 发送的数据
> {
> &nbsp;&nbsp;"user_id":&nbsp;1,
> &nbsp;&nbsp;"item_id":&nbsp;1,
> &nbsp;&nbsp;"behavior":"pv1"
> }
> {
> &nbsp;&nbsp;"user_id":&nbsp;1,
> &nbsp;&nbsp;"item_id":&nbsp;1,
> &nbsp;&nbsp;"behavior":"pv2"
> }
>
>
>
>
>
>
> CREATE TABLE KafkaTable (
> &nbsp; `user_id` BIGINT,
> &nbsp; `item_id` BIGINT,
> &nbsp; `behavior` STRING,
> &nbsp; proctime as PROCTIME()
> ) WITH (
> &nbsp; 'connector' = 'kafka',
> &nbsp; 'topic' = 'user_behavior',
> &nbsp; 'properties.bootstrap.servers' = '',
> &nbsp; 'properties.group.id' = 'testGroup',
> &nbsp; 'scan.startup.mode' = 'earliest-offset',
> &nbsp; 'format' = 'json'
> );
>
>
>
> SELECT
> user_id,
> item_id,
> behavior,
> next_bv&nbsp;
> FROM
> ( SELECT *, lag( behavior, 1 ) over ( PARTITION BY user_id ORDER
> BY proctime ) AS next_bv FROM KafkaTable ) t;
--
Best,
Benchao Li
Re: flink-1.12.0 流模式 使用 lag问题
Posted by Benchao Li <li...@apache.org>.
Hi,这个是一个已知的bug[1],已经在1.13.1以及1.4版本修复了。
可以使用一下1.13.1试一下,1.4版本现在也正在投票中了,应该很快就会发布出来了。
[1] https://issues.apache.org/jira/browse/FLINK-19449
kcz <57...@qq.com.invalid> 于2021年9月22日周三 上午11:41写道:
> 如何使用才是正确的,求大佬帮看看
> behavior,next_bv 字段内容一直是保持一致的,无法得到自己想要的结果
>
>
> 发送的数据
> {
> "user_id": 1,
> "item_id": 1,
> "behavior":"pv1"
> }
> {
> "user_id": 1,
> "item_id": 1,
> "behavior":"pv2"
> }
>
>
>
>
>
>
> CREATE TABLE KafkaTable (
> `user_id` BIGINT,
> `item_id` BIGINT,
> `behavior` STRING,
> proctime as PROCTIME()
> ) WITH (
> 'connector' = 'kafka',
> 'topic' = 'user_behavior',
> 'properties.bootstrap.servers' = '',
> 'properties.group.id' = 'testGroup',
> 'scan.startup.mode' = 'earliest-offset',
> 'format' = 'json'
> );
>
>
>
> SELECT
> user_id,
> item_id,
> behavior,
> next_bv
> FROM
> ( SELECT *, lag( behavior, 1 ) over ( PARTITION BY user_id ORDER
> BY proctime ) AS next_bv FROM KafkaTable ) t;
--
Best,
Benchao Li