Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
1198664c
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,发现更多精彩内容 >>
提交
1198664c
编写于
2月 03, 2016
作者:
S
Stephan Ewen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FLINK-3201] Adjust CEP code for changes state interfaces
上级
180cd3f6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
18 deletion
+21
-18
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CEPPatternOperator.java
...ava/org/apache/flink/cep/operator/CEPPatternOperator.java
+3
-3
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/KeyedCEPPatternOperator.java
...rg/apache/flink/cep/operator/KeyedCEPPatternOperator.java
+18
-15
未找到文件。
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CEPPatternOperator.java
浏览文件 @
1198664c
...
...
@@ -22,7 +22,7 @@ import org.apache.flink.api.common.typeutils.TypeSerializer;
import
org.apache.flink.cep.nfa.NFA
;
import
org.apache.flink.cep.nfa.compiler.NFACompiler
;
import
org.apache.flink.core.memory.DataInputViewStreamWrapper
;
import
org.apache.flink.runtime.state.StateBackend
;
import
org.apache.flink.runtime.state.
Abstract
StateBackend
;
import
org.apache.flink.runtime.state.StreamStateHandle
;
import
org.apache.flink.streaming.api.watermark.Watermark
;
import
org.apache.flink.streaming.runtime.streamrecord.StreamRecord
;
...
...
@@ -93,12 +93,12 @@ public class CEPPatternOperator<IN> extends AbstractCEPPatternOperator<IN> {
public
StreamTaskState
snapshotOperatorState
(
long
checkpointId
,
long
timestamp
)
throws
Exception
{
StreamTaskState
taskState
=
super
.
snapshotOperatorState
(
checkpointId
,
timestamp
);
final
StateBackend
.
CheckpointStateOutputStream
os
=
this
.
getStateBackend
().
createCheckpointStateOutputStream
(
final
Abstract
StateBackend
.
CheckpointStateOutputStream
os
=
this
.
getStateBackend
().
createCheckpointStateOutputStream
(
checkpointId
,
timestamp
);
final
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
os
);
final
StateBackend
.
CheckpointStateOutputView
ov
=
new
StateBackend
.
CheckpointStateOutputView
(
os
);
final
AbstractStateBackend
.
CheckpointStateOutputView
ov
=
new
Abstract
StateBackend
.
CheckpointStateOutputView
(
os
);
oos
.
writeObject
(
nfa
);
...
...
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/KeyedCEPPatternOperator.java
浏览文件 @
1198664c
...
...
@@ -18,7 +18,8 @@
package
org.apache.flink.cep.operator
;
import
org.apache.flink.api.common.state.OperatorState
;
import
org.apache.flink.api.common.state.ValueState
;
import
org.apache.flink.api.common.state.ValueStateDescriptor
;
import
org.apache.flink.api.common.typeutils.TypeSerializer
;
import
org.apache.flink.api.java.functions.KeySelector
;
import
org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer
;
...
...
@@ -26,7 +27,7 @@ import org.apache.flink.cep.nfa.NFA;
import
org.apache.flink.cep.nfa.compiler.NFACompiler
;
import
org.apache.flink.core.memory.DataInputView
;
import
org.apache.flink.core.memory.DataOutputView
;
import
org.apache.flink.runtime.state.StateBackend
;
import
org.apache.flink.runtime.state.
Abstract
StateBackend
;
import
org.apache.flink.runtime.state.StateHandle
;
import
org.apache.flink.streaming.api.watermark.Watermark
;
import
org.apache.flink.streaming.runtime.streamrecord.StreamRecord
;
...
...
@@ -70,8 +71,8 @@ public class KeyedCEPPatternOperator<IN, KEY> extends AbstractCEPPatternOperator
// TODO: fix once the state refactoring is completed
private
transient
Set
<
KEY
>
keys
;
private
transient
Operator
State
<
NFA
<
IN
>>
nfaOperatorState
;
private
transient
Operator
State
<
PriorityQueue
<
StreamRecord
<
IN
>>>
priorityQueueOperatorState
;
private
transient
Value
State
<
NFA
<
IN
>>
nfaOperatorState
;
private
transient
Value
State
<
PriorityQueue
<
StreamRecord
<
IN
>>>
priorityQueueOperatorState
;
public
KeyedCEPPatternOperator
(
TypeSerializer
<
IN
>
inputSerializer
,
...
...
@@ -95,19 +96,21 @@ public class KeyedCEPPatternOperator<IN, KEY> extends AbstractCEPPatternOperator
}
if
(
nfaOperatorState
==
null
)
{
nfaOperatorState
=
this
.
createKeyValueState
(
NFA_OPERATOR_STATE_NAME
,
new
KryoSerializer
<
NFA
<
IN
>>((
Class
<
NFA
<
IN
>>)
(
Class
<?>)
NFA
.
class
,
getExecutionConfig
()),
null
);
nfaOperatorState
=
getPartitionedState
(
new
ValueStateDescriptor
<
NFA
<
IN
>>(
NFA_OPERATOR_STATE_NAME
,
new
KryoSerializer
<
NFA
<
IN
>>((
Class
<
NFA
<
IN
>>)
(
Class
<?>)
NFA
.
class
,
getExecutionConfig
()),
null
));
}
if
(
priorityQueueOperatorState
==
null
)
{
priorityQueueOperatorState
=
this
.
createKeyValueState
(
PRIORIRY_QUEUE_STATE_NAME
,
new
PriorityQueueSerializer
<
StreamRecord
<
IN
>>(
new
StreamRecordSerializer
<
IN
>(
getInputSerializer
()),
new
PriorityQueueStreamRecordFactory
<
IN
>()),
null
);
priorityQueueOperatorState
=
getPartitionedState
(
new
ValueStateDescriptor
<
PriorityQueue
<
StreamRecord
<
IN
>>>(
PRIORIRY_QUEUE_STATE_NAME
,
new
PriorityQueueSerializer
<
StreamRecord
<
IN
>>(
new
StreamRecordSerializer
<
IN
>(
getInputSerializer
()),
new
PriorityQueueStreamRecordFactory
<
IN
>()),
null
));
}
}
...
...
@@ -166,7 +169,7 @@ public class KeyedCEPPatternOperator<IN, KEY> extends AbstractCEPPatternOperator
public
StreamTaskState
snapshotOperatorState
(
long
checkpointId
,
long
timestamp
)
throws
Exception
{
StreamTaskState
taskState
=
super
.
snapshotOperatorState
(
checkpointId
,
timestamp
);
StateBackend
.
CheckpointStateOutputView
ov
=
getStateBackend
().
createCheckpointStateOutputView
(
checkpointId
,
timestamp
);
Abstract
StateBackend
.
CheckpointStateOutputView
ov
=
getStateBackend
().
createCheckpointStateOutputView
(
checkpointId
,
timestamp
);
ov
.
writeInt
(
keys
.
size
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录