Skip to content

Commit 45a9b35

Browse files
committed
[FLINK-19318] Remove mentions of timeWindow*() from documentation
It's deprecated and we want to encourage users to use the explicit window assigners.
1 parent fe573dd commit 45a9b35

16 files changed

+44
-44
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ val text = env.socketTextStream(host, port, '\n')
4141
val windowCounts = text.flatMap { w => w.split("\\s") }
4242
.map { w => WordWithCount(w, 1) }
4343
.keyBy("word")
44-
.timeWindow(Time.seconds(5))
44+
.window(TumblingProcessingTimeWindow.of(Time.seconds(5)))
4545
.sum("count")
4646

4747
windowCounts.print()

docs/dev/connectors/cassandra.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ DataStream<Tuple2<String, Long>> result = text
161161
}
162162
})
163163
.keyBy(value -> value.f0)
164-
.timeWindow(Time.seconds(5))
164+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
165165
.sum(1);
166166

167167
CassandraSink.addSink(result)
@@ -186,7 +186,7 @@ val result: DataStream[(String, Long)] = text
186186
.map((_, 1L))
187187
// group by the tuple field "0" and sum up tuple field "1"
188188
.keyBy(_._1)
189-
.timeWindow(Time.seconds(5))
189+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
190190
.sum(1)
191191

192192
CassandraSink.addSink(result)
@@ -232,7 +232,7 @@ DataStream<WordCount> result = text
232232
}
233233
})
234234
.keyBy(WordCount::getWord)
235-
.timeWindow(Time.seconds(5))
235+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
236236

237237
.reduce(new ReduceFunction<WordCount>() {
238238
@Override

docs/dev/connectors/cassandra.zh.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ DataStream<Tuple2<String, Long>> result = text
161161
}
162162
})
163163
.keyBy(value -> value.f0)
164-
.timeWindow(Time.seconds(5))
164+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
165165
.sum(1);
166166

167167
CassandraSink.addSink(result)
@@ -186,7 +186,7 @@ val result: DataStream[(String, Long)] = text
186186
.map((_, 1L))
187187
// group by the tuple field "0" and sum up tuple field "1"
188188
.keyBy(_._1)
189-
.timeWindow(Time.seconds(5))
189+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
190190
.sum(1)
191191

192192
CassandraSink.addSink(result)
@@ -232,7 +232,7 @@ DataStream<WordCount> result = text
232232
}
233233
})
234234
.keyBy(WordCount::getWord)
235-
.timeWindow(Time.seconds(5))
235+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
236236

237237
.reduce(new ReduceFunction<WordCount>() {
238238
@Override

docs/dev/datastream_api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public class WindowWordCount {
275275
.socketTextStream("localhost", 9999)
276276
.flatMap(new Splitter())
277277
.keyBy(value -> value.f0)
278-
.timeWindow(Time.seconds(5))
278+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
279279
.sum(1);
280280

281281
dataStream.print();
@@ -312,7 +312,7 @@ object WindowWordCount {
312312
val counts = text.flatMap { _.toLowerCase.split("\\W+") filter { _.nonEmpty } }
313313
.map { (_, 1) }
314314
.keyBy(_._1)
315-
.timeWindow(Time.seconds(5))
315+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
316316
.sum(1)
317317

318318
counts.print()

docs/dev/datastream_api.zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public class WindowWordCount {
275275
.socketTextStream("localhost", 9999)
276276
.flatMap(new Splitter())
277277
.keyBy(value -> value.f0)
278-
.timeWindow(Time.seconds(5))
278+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
279279
.sum(1);
280280

281281
dataStream.print();
@@ -312,7 +312,7 @@ object WindowWordCount {
312312
val counts = text.flatMap { _.toLowerCase.split("\\W+") filter { _.nonEmpty } }
313313
.map { (_, 1) }
314314
.keyBy(_._1)
315-
.timeWindow(Time.seconds(5))
315+
.window(TumblingProcessingTimeWindows.of(Time.seconds(5)))
316316
.sum(1)
317317

318318
counts.print()

docs/dev/event_time.zh.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ under the License.
2828

2929
有关如何在 Flink 程序中使用时间特性,请参阅[窗口]({% link dev/stream/operators/windows.zh.md %})和 [ProcessFunction]({% link dev/stream/operators/process_function.zh.md %}) 小节。
3030

31-
使用*事件时间*处理数据之前需要在程序中设置正确的*时间语义*。此项设置会定义源数据的处理方式(例如:程序是否会对数据分配时间戳),以及程序应使用什么时间语义执行 `KeyedStream.timeWindow(Time.seconds(30))` 之类的窗口操作。
31+
使用*事件时间*处理数据之前需要在程序中设置正确的*时间语义*。此项设置会定义源数据的处理方式(例如:程序是否会对数据分配时间戳),以及程序应使用什么时间语义执行 `KeyedStream.window(TumblingEventTimeWindows.of(Time.seconds(30)))` 之类的窗口操作。
3232

3333
可以通过 `StreamExecutionEnvironment.setStreamTimeCharacteristic()` 设置程序的时间语义,示例如下:
3434

@@ -43,7 +43,7 @@ DataStream<MyEvent> stream = env.addSource(new FlinkKafkaConsumer<MyEvent>(topic
4343

4444
stream
4545
.keyBy( (event) -> event.getUser() )
46-
.timeWindow(Time.hours(1))
46+
.window(TumblingEventTimeWindows.of(Time.hours(1)))
4747
.reduce( (a, b) -> a.add(b) )
4848
.addSink(...);
4949
{% endhighlight %}
@@ -58,7 +58,7 @@ val stream: DataStream[MyEvent] = env.addSource(new FlinkKafkaConsumer[MyEvent](
5858

5959
stream
6060
.keyBy( _.getUser )
61-
.timeWindow(Time.hours(1))
61+
.window(TumblingEventTimeWindows.of(Time.hours(1)))
6262
.reduce( (a, b) => a.add(b) )
6363
.addSink(...)
6464
{% endhighlight %}

docs/dev/event_timestamps_watermarks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ DataStream<MyEvent> withTimestampsAndWatermarks = stream
138138

139139
withTimestampsAndWatermarks
140140
.keyBy( (event) -> event.getGroup() )
141-
.timeWindow(Time.seconds(10))
141+
.window(TumblingEventTimeWindows.of(Time.seconds(10)))
142142
.reduce( (a, b) -> a.add(b) )
143143
.addSink(...);
144144
{% endhighlight %}
@@ -157,7 +157,7 @@ val withTimestampsAndWatermarks: DataStream[MyEvent] = stream
157157

158158
withTimestampsAndWatermarks
159159
.keyBy( _.getGroup )
160-
.timeWindow(Time.seconds(10))
160+
.window(TumblingEventTimeWindows.of(Time.seconds(10)))
161161
.reduce( (a, b) => a.add(b) )
162162
.addSink(...)
163163
{% endhighlight %}

docs/dev/event_timestamps_watermarks.zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ DataStream<MyEvent> withTimestampsAndWatermarks = stream
110110

111111
withTimestampsAndWatermarks
112112
.keyBy( (event) -> event.getGroup() )
113-
.timeWindow(Time.seconds(10))
113+
.window(TumblingEventTimeWindows.of(Time.seconds(10)))
114114
.reduce( (a, b) -> a.add(b) )
115115
.addSink(...);
116116
{% endhighlight %}
@@ -129,7 +129,7 @@ val withTimestampsAndWatermarks: DataStream[MyEvent] = stream
129129

130130
withTimestampsAndWatermarks
131131
.keyBy( _.getGroup )
132-
.timeWindow(Time.seconds(10))
132+
.window(TumblingEventTimeWindows.of(Time.seconds(10)))
133133
.reduce( (a, b) => a.add(b) )
134134
.addSink(...)
135135
{% endhighlight %}

docs/dev/parallel.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ DataStream<String> text = [...]
5555
DataStream<Tuple2<String, Integer>> wordCounts = text
5656
.flatMap(new LineSplitter())
5757
.keyBy(value -> value.f0)
58-
.timeWindow(Time.seconds(5))
58+
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
5959
.sum(1).setParallelism(5);
6060

6161
wordCounts.print();
@@ -71,7 +71,7 @@ val text = [...]
7171
val wordCounts = text
7272
.flatMap{ _.split(" ") map { (_, 1) } }
7373
.keyBy(_._1)
74-
.timeWindow(Time.seconds(5))
74+
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
7575
.sum(1).setParallelism(5)
7676
wordCounts.print()
7777

@@ -114,7 +114,7 @@ val text = [...]
114114
val wordCounts = text
115115
.flatMap{ _.split(" ") map { (_, 1) } }
116116
.keyBy(_._1)
117-
.timeWindow(Time.seconds(5))
117+
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
118118
.sum(1)
119119
wordCounts.print()
120120

docs/dev/parallel.zh.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ DataStream<String> text = [...]
4646
DataStream<Tuple2<String, Integer>> wordCounts = text
4747
.flatMap(new LineSplitter())
4848
.keyBy(value -> value.f0)
49-
.timeWindow(Time.seconds(5))
49+
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
5050
.sum(1).setParallelism(5);
5151

5252
wordCounts.print();
@@ -62,7 +62,7 @@ val text = [...]
6262
val wordCounts = text
6363
.flatMap{ _.split(" ") map { (_, 1) } }
6464
.keyBy(_._1)
65-
.timeWindow(Time.seconds(5))
65+
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
6666
.sum(1).setParallelism(5)
6767
wordCounts.print()
6868

@@ -99,7 +99,7 @@ val text = [...]
9999
val wordCounts = text
100100
.flatMap{ _.split(" ") map { (_, 1) } }
101101
.keyBy(_._1)
102-
.timeWindow(Time.seconds(5))
102+
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
103103
.sum(1)
104104
wordCounts.print()
105105

0 commit comments

Comments
 (0)