Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
904c9510
F
flink
项目概览
doujutun3207
/
flink
与 Fork 源项目一致
从无法访问的项目Fork
通知
24
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flink
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
904c9510
编写于
10月 08, 2017
作者:
B
Bowen Li
提交者:
Aljoscha Krettek
10月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FLINK-7388] Don't set processing time as timestamp in ProcessFunction.onTimer()
上级
8c89f3c6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
11 deletion
+18
-11
docs/dev/stream/operators/process_function.md
docs/dev/stream/operators/process_function.md
+7
-0
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyedProcessOperator.java
...e/flink/streaming/api/operators/KeyedProcessOperator.java
+1
-1
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperator.java
...nk/streaming/api/operators/co/KeyedCoProcessOperator.java
+1
-1
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java
...ink/streaming/api/operators/KeyedProcessOperatorTest.java
+4
-4
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperatorTest.java
...treaming/api/operators/co/KeyedCoProcessOperatorTest.java
+5
-5
未找到文件。
docs/dev/stream/operators/process_function.md
浏览文件 @
904c9510
...
...
@@ -236,3 +236,10 @@ class CountWithTimeoutFunction extends ProcessFunction[(String, String), (String
</div>
{% top %}
**NOTE:**
Before Flink 1.4.0, when called from a processing-time timer, the
`ProcessFunction.onTimer()`
method sets
the current processing time as event-time timestamp. This behavior is very subtle and might not be noticed by users. Well, it's
harmful because processing-time timestamps are indeterministic and not aligned with watermarks. Besides, user-implemented logic
depends on this wrong timestamp highly likely is unintendedly faulty. So we've decided to fix it. Upon upgrading to 1.4.0, Flink jobs
that are using this incorrect event-time timestamp will fail, and users should adapt their jobs to the correct logic.
\ No newline at end of file
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/KeyedProcessOperator.java
浏览文件 @
904c9510
...
...
@@ -79,7 +79,7 @@ public class KeyedProcessOperator<K, IN, OUT>
@Override
public
void
onProcessingTime
(
InternalTimer
<
K
,
VoidNamespace
>
timer
)
throws
Exception
{
collector
.
setAbsoluteTimestamp
(
timer
.
getTimestamp
()
);
collector
.
eraseTimestamp
(
);
onTimerContext
.
timeDomain
=
TimeDomain
.
PROCESSING_TIME
;
onTimerContext
.
timer
=
timer
;
userFunction
.
onTimer
(
timer
.
getTimestamp
(),
onTimerContext
,
collector
);
...
...
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperator.java
浏览文件 @
904c9510
...
...
@@ -99,7 +99,7 @@ public class KeyedCoProcessOperator<K, IN1, IN2, OUT>
@Override
public
void
onProcessingTime
(
InternalTimer
<
K
,
VoidNamespace
>
timer
)
throws
Exception
{
collector
.
setAbsoluteTimestamp
(
timer
.
getTimestamp
()
);
collector
.
eraseTimestamp
(
);
onTimerContext
.
timeDomain
=
TimeDomain
.
PROCESSING_TIME
;
onTimerContext
.
timer
=
timer
;
userFunction
.
onTimer
(
timer
.
getTimestamp
(),
onTimerContext
,
collector
);
...
...
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/KeyedProcessOperatorTest.java
浏览文件 @
904c9510
...
...
@@ -157,7 +157,7 @@ public class KeyedProcessOperatorTest extends TestLogger {
ConcurrentLinkedQueue
<
Object
>
expectedOutput
=
new
ConcurrentLinkedQueue
<>();
expectedOutput
.
add
(
new
StreamRecord
<>(
17
));
expectedOutput
.
add
(
new
StreamRecord
<>(
1777
,
5L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
1777
));
TestHarnessUtil
.
assertOutputEquals
(
"Output was not correct."
,
expectedOutput
,
testHarness
.
getOutput
());
...
...
@@ -232,8 +232,8 @@ public class KeyedProcessOperatorTest extends TestLogger {
expectedOutput
.
add
(
new
StreamRecord
<>(
"INPUT:17"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"INPUT:42"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:17"
,
6L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:42"
,
7L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:17"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:42"
));
TestHarnessUtil
.
assertOutputEquals
(
"Output was not correct."
,
expectedOutput
,
testHarness
.
getOutput
());
...
...
@@ -272,7 +272,7 @@ public class KeyedProcessOperatorTest extends TestLogger {
ConcurrentLinkedQueue
<
Object
>
expectedOutput
=
new
ConcurrentLinkedQueue
<>();
expectedOutput
.
add
(
new
StreamRecord
<>(
"PROC:1777"
,
5L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"PROC:1777"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"EVENT:1777"
,
6L
));
expectedOutput
.
add
(
new
Watermark
(
6
));
...
...
flink-streaming-java/src/test/java/org/apache/flink/streaming/api/operators/co/KeyedCoProcessOperatorTest.java
浏览文件 @
904c9510
...
...
@@ -177,8 +177,8 @@ public class KeyedCoProcessOperatorTest extends TestLogger {
expectedOutput
.
add
(
new
StreamRecord
<>(
"INPUT1:17"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"INPUT2:18"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"1777"
,
5L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"1777"
,
6L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"1777"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"1777"
));
TestHarnessUtil
.
assertOutputEquals
(
"Output was not correct."
,
expectedOutput
,
testHarness
.
getOutput
());
...
...
@@ -266,8 +266,8 @@ public class KeyedCoProcessOperatorTest extends TestLogger {
expectedOutput
.
add
(
new
StreamRecord
<>(
"INPUT1:17"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"INPUT2:42"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:17"
,
6L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:42"
,
7L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:17"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"STATE:42"
));
TestHarnessUtil
.
assertOutputEquals
(
"Output was not correct."
,
expectedOutput
,
testHarness
.
getOutput
());
...
...
@@ -316,7 +316,7 @@ public class KeyedCoProcessOperatorTest extends TestLogger {
ConcurrentLinkedQueue
<
Object
>
expectedOutput
=
new
ConcurrentLinkedQueue
<>();
expectedOutput
.
add
(
new
StreamRecord
<>(
"PROC:1777"
,
5L
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"PROC:1777"
));
expectedOutput
.
add
(
new
StreamRecord
<>(
"EVENT:1777"
,
6L
));
expectedOutput
.
add
(
new
Watermark
(
6
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录