Skip to content

Commit e2d793b

Browse files
committed
[review] fixes docs
1 parent 5ce9725 commit e2d793b

File tree

19 files changed

+167
-167
lines changed

19 files changed

+167
-167
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-
.window(TumblingProcessingTimeWindow.of(Time.seconds(5)))
44+
.window(TumblingProcessingTimeWindow.of(Duration.ofSeconds(5)))
4545
.sum("count")
4646

4747
windowCounts.print()

docs/content.zh/docs/dev/datastream/event-time/generating_watermarks.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ DataStream<MyEvent> withTimestampsAndWatermarks = stream
125125

126126
withTimestampsAndWatermarks
127127
.keyBy( (event) -> event.getGroup() )
128-
.window(TumblingEventTimeWindows.of(Time.seconds(10)))
128+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(10)))
129129
.reduce( (a, b) -> a.add(b) )
130130
.addSink(...);
131131
```
@@ -144,7 +144,7 @@ val withTimestampsAndWatermarks: DataStream[MyEvent] = stream
144144

145145
withTimestampsAndWatermarks
146146
.keyBy( _.getGroup )
147-
.window(TumblingEventTimeWindows.of(Time.seconds(10)))
147+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(10)))
148148
.reduce( (a, b) => a.add(b) )
149149
.addSink(...)
150150
```
@@ -164,7 +164,7 @@ with_timestamp_and_watermarks = stream \
164164

165165
with_timestamp_and_watermarks \
166166
.key_by(lambda e: e.get_group()) \
167-
.window(TumblingEventTimeWindows.of(Time.seconds(10))) \
167+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(10))) \
168168
.reduce(lambda a, b: a.add(b)) \
169169
.add_sink(...)
170170
```

docs/content.zh/docs/dev/datastream/execution/parallel.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ DataStream<String> text = [...];
5050
DataStream<Tuple2<String, Integer>> wordCounts = text
5151
.flatMap(new LineSplitter())
5252
.keyBy(value -> value.f0)
53-
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
53+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(5)))
5454
.sum(1).setParallelism(5);
5555

5656
wordCounts.print();
@@ -66,7 +66,7 @@ val text = [...]
6666
val wordCounts = text
6767
.flatMap{ _.split(" ") map { (_, 1) } }
6868
.keyBy(_._1)
69-
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
69+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(5)))
7070
.sum(1).setParallelism(5)
7171
wordCounts.print()
7272

@@ -82,7 +82,7 @@ word_counts = text
8282
.flat_map(lambda x: x.split(" ")) \
8383
.map(lambda i: (i, 1), output_type=Types.TUPLE([Types.STRING(), Types.INT()])) \
8484
.key_by(lambda i: i[0]) \
85-
.window(TumblingEventTimeWindows.of(Time.seconds(5))) \
85+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(5))) \
8686
.reduce(lambda i, j: (i[0], i[1] + j[1])) \
8787
.set_parallelism(5)
8888
word_counts.print()
@@ -121,7 +121,7 @@ val text = [...]
121121
val wordCounts = text
122122
.flatMap{ _.split(" ") map { (_, 1) } }
123123
.keyBy(_._1)
124-
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
124+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(5)))
125125
.sum(1)
126126
wordCounts.print()
127127

@@ -138,7 +138,7 @@ word_counts = text
138138
.flat_map(lambda x: x.split(" ")) \
139139
.map(lambda i: (i, 1), output_type=Types.TUPLE([Types.STRING(), Types.INT()])) \
140140
.key_by(lambda i: i[0]) \
141-
.window(TumblingEventTimeWindows.of(Time.seconds(5))) \
141+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(5))) \
142142
.reduce(lambda i, j: (i[0], i[1] + j[1]))
143143
word_counts.print()
144144

docs/content.zh/docs/dev/datastream/experimental.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Code example:
6464
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
6565
DataStreamSource<Integer> source = ...;
6666
DataStreamUtils.reinterpretAsKeyedStream(source, (in) -> in, TypeInformation.of(Integer.class))
67-
.window(TumblingEventTimeWindows.of(Time.seconds(1)))
67+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(1)))
6868
.reduce((a, b) -> a + b)
6969
.addSink(new DiscardingSink<>());
7070
env.execute();
@@ -76,7 +76,7 @@ val env = StreamExecutionEnvironment.getExecutionEnvironment
7676
env.setParallelism(1)
7777
val source = ...
7878
new DataStreamUtils(source).reinterpretAsKeyedStream((in) => in)
79-
.window(TumblingEventTimeWindows.of(Time.seconds(1)))
79+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(1)))
8080
.reduce((a, b) => a + b)
8181
.addSink(new DiscardingSink[Int])
8282
env.execute()

docs/content.zh/docs/dev/datastream/operators/overview.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,19 @@ data_stream.key_by(lambda x: x[1]).reduce(lambda a, b: (a[0] + b[0], b[1]))
198198
```java
199199
dataStream
200200
.keyBy(value -> value.f0)
201-
.window(TumblingEventTimeWindows.of(Time.seconds(5)));
201+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(5)));
202202
```
203203
{{< /tab >}}
204204
{{< tab "Scala">}}
205205
```scala
206206
dataStream
207207
.keyBy(_._1)
208-
.window(TumblingEventTimeWindows.of(Time.seconds(5)))
208+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(5)))
209209
```
210210
{{< /tab >}}
211211
{{< tab "Python" >}}
212212
```python
213-
data_stream.key_by(lambda x: x[1]).window(TumblingEventTimeWindows.of(Time.seconds(5)))
213+
data_stream.key_by(lambda x: x[1]).window(TumblingEventTimeWindows.of(Duration.ofSeconds(5)))
214214
```
215215
{{< /tab >}}
216216
{{< /tabs>}}
@@ -228,18 +228,18 @@ data_stream.key_by(lambda x: x[1]).window(TumblingEventTimeWindows.of(Time.secon
228228
{{< tab "Java">}}
229229
```java
230230
dataStream
231-
.windowAll(TumblingEventTimeWindows.of(Time.seconds(5)));
231+
.windowAll(TumblingEventTimeWindows.of(Duration.ofSeconds(5)));
232232
```
233233
{{< /tab >}}
234234
{{< tab "Scala">}}
235235
```scala
236236
dataStream
237-
.windowAll(TumblingEventTimeWindows.of(Time.seconds(5)))
237+
.windowAll(TumblingEventTimeWindows.of(Duration.ofSeconds(5)))
238238
```
239239
{{< /tab >}}
240240
{{< tab "Python" >}}
241241
```python
242-
data_stream.window_all(TumblingEventTimeWindows.of(Time.seconds(5)))
242+
data_stream.window_all(TumblingEventTimeWindows.of(Duration.ofSeconds(5)))
243243
```
244244
{{< /tab >}}
245245
{{< /tabs>}}
@@ -386,15 +386,15 @@ data_stream.union(otherStream1, otherStream2, ...)
386386
```java
387387
dataStream.join(otherStream)
388388
.where(<key selector>).equalTo(<key selector>)
389-
.window(TumblingEventTimeWindows.of(Time.seconds(3)))
389+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(3)))
390390
.apply (new JoinFunction () {...});
391391
```
392392
{{< /tab >}}
393393
{{< tab "Scala" >}}
394394
```scala
395395
dataStream.join(otherStream)
396396
.where(<key selector>).equalTo(<key selector>)
397-
.window(TumblingEventTimeWindows.of(Time.seconds(3)))
397+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(3)))
398398
.apply { ... }
399399
```
400400
{{< /tab >}}
@@ -414,7 +414,7 @@ Python 中尚不支持此特性。
414414
// this will join the two streams so that
415415
// key1 == key2 && leftTs - 2 < rightTs < leftTs + 2
416416
keyedStream.intervalJoin(otherKeyedStream)
417-
.between(Time.milliseconds(-2), Time.milliseconds(2)) // lower and upper bound
417+
.between(Duration.ofMillis(-2), Duration.ofMillis(2)) // lower and upper bound
418418
.upperBoundExclusive(true) // optional
419419
.lowerBoundExclusive(true) // optional
420420
.process(new IntervalJoinFunction() {...});
@@ -425,7 +425,7 @@ keyedStream.intervalJoin(otherKeyedStream)
425425
// this will join the two streams so that
426426
// key1 == key2 && leftTs - 2 < rightTs < leftTs + 2
427427
keyedStream.intervalJoin(otherKeyedStream)
428-
.between(Time.milliseconds(-2), Time.milliseconds(2))
428+
.between(Duration.ofMillis(-2), Duration.ofMillis(2))
429429
// lower and upper bound
430430
.upperBoundExclusive(true) // optional
431431
.lowerBoundExclusive(true) // optional
@@ -447,15 +447,15 @@ Python 中尚不支持此特性。
447447
```java
448448
dataStream.coGroup(otherStream)
449449
.where(0).equalTo(1)
450-
.window(TumblingEventTimeWindows.of(Time.seconds(3)))
450+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(3)))
451451
.apply (new CoGroupFunction () {...});
452452
```
453453
{{< /tab >}}
454454
{{< tab "Scala" >}}
455455
```scala
456456
dataStream.coGroup(otherStream)
457457
.where(0).equalTo(1)
458-
.window(TumblingEventTimeWindows.of(Time.seconds(3)))
458+
.window(TumblingEventTimeWindows.of(Duration.ofSeconds(3)))
459459
.apply {}
460460
```
461461
{{< /tab >}}

0 commit comments

Comments
 (0)