以下のパターンを使用して、Flink で 10 を超えるすべての一時イベントをフィルタリングしようとしています。
Pattern<MonitoringEvent, ?> warningPattern = Pattern.<MonitoringEvent>begin("first")
.subtype(TemperatureEvent.class)
.where(new FilterFunction<TemperatureEvent>() {
@Override
public boolean filter(TemperatureEvent temperatureEvent) throws Exception {
return temperatureEvent.getTemperature() > 50;
}
});
入力は、入力関数によってストリームに解析されるテキスト ファイルです。入力ファイルの内容は次のとおりです。
1,98
2,33
3,44
4,55
5,66
6,88
7,99
8,76
ここで、最初の値は Rack_id で、2 番目の値は温度です
以下に示すように、input-stream と WarnigsStream の両方で print() を発行しました。
inputEventStream.print();
warnings.print();
ここで、問題が発生します。Flink CEP の出力を以下に示します。
08/10/2017 23:43:15 Job execution switched to status RUNNING.
08/10/2017 23:43:15 Source: Custom Source -> Sink: Unnamed(1/1) switched to SCHEDULED
08/10/2017 23:43:15 Source: Custom Source -> Sink: Unnamed(1/1) switched to DEPLOYING
08/10/2017 23:43:15 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to SCHEDULED
08/10/2017 23:43:15 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to DEPLOYING
08/10/2017 23:43:15 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to RUNNING
08/10/2017 23:43:15 Source: Custom Source -> Sink: Unnamed(1/1) switched to RUNNING
Rack id = 1 and temprature = 98.0)
Rack id = 2 and temprature = 33.0)
Rack id = 3 and temprature = 44.0)
Rack id = 4 and temprature = 55.0)
Rack id = 5 and temprature = 66.0)
Rack id = 6 and temprature = 88.0)
Rack id = 7 and temprature = 99.0)
Rack id = 8 and temprature = 76.0)
08/10/2017 23:43:16 Source: Custom Source -> Sink: Unnamed(1/1) switched to FINISHED
Rack id = 1 and temprature = 98.0)
Rack id = 8 and temprature = 76.0)
Rack id = 7 and temprature = 99.0)
Rack id = 6 and temprature = 88.0)
Rack id = 5 and temprature = 66.0)
Rack id = 4 and temprature = 55.0)
08/10/2017 23:43:16 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to FINISHED
08/10/2017 23:43:16 Job execution switched to status FINISHED.
Process finished with exit code 0
ご覧のとおり、最初の複合イベント (ラック ID = 1 および温度 = 98.0)) は同じ順序で出力されますが、この後、temp > 50 を持つ他のすべての複合イベントは、入力に対して逆の順序で出力されます。ストリーム。
My questions are :-
1. Any idea why events are getting printed in reverse order?
2. Is there a custom way to print values{w/o using warnings.print()} of
warning stream, like can I print only temperature, rather than rack-id ?
前もって感謝します