解决cep不能手动指定watermark的bug #282
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
提供sql如下
CREATE TABLE datahub_stream (
card_id VARCHAR,
location VARCHAR,
mytime timestamp,
action VARCHAR,
WATERMARK FOR mytime AS withOffset(mytime,1000)
) WITH (
type='kafka11',
bootstrapServers='hadoop102:9092,hadoop103:9092,hadoop104:9092',
zookeeperQuorum='hadoop102:2181,hadoop103:2181,hadoop104:2181',
offsetReset='latest',
groupId='csin_stream',
topic='csin_source',
parallelism='1',
timezone='Asia/Shanghai'
);
CREATE TABLE rds_out (
start_timestamp timestamp,
end_timestamp timestamp,
card_id VARCHAR,
event VARCHAR
) WITH (
type='kafka11',
bootstrapServers='hadoop102:9092,hadoop103:9092,hadoop104:9092',
topic='csin_source2',
parallelism='1',
timezone='Asia/Shanghai'
);
insert into rds_out
select
start_timestamp,
end_timestamp,
card_id,event
from datahub_stream
MATCH_RECOGNIZE (
PARTITION BY card_id
ORDER BY mytime
MEASURES
e2.action as event,
e1.mytime as start_timestamp,
LAST(e2.mytime) as end_timestamp
ONE ROW PER MATCH
AFTER MATCH SKIP TO NEXT ROW
PATTERN (e1 e2) WITHIN INTERVAL '10' MINUTE
DEFINE
e1 as e1.action = 'Tom',
e2 as e2.action = 'Tom' and e2.location <> e1.location
);