You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ChenZhongPu (via GitHub)" <gi...@apache.org> on 2023/02/22 05:48:28 UTC
[GitHub] [flink] ChenZhongPu commented on a diff in pull request #21989: [FLINK-31174][Doc] Resolve inconsistent data format between Learn-Flink Doc and flink-training-repo
ChenZhongPu commented on code in PR #21989:
URL: https://github.com/apache/flink/pull/21989#discussion_r1113863744
##########
docs/content.zh/docs/learn-flink/etl.md:
##########
@@ -156,56 +154,50 @@ keyBy(ride -> GeoUtils.mapToGridCell(ride.startLon, ride.startLat))
### Keyed Stream 的聚合
-以下代码为每个行程结束事件创建了一个新的包含 `startCell` 和时长(分钟)的元组流:
+以下代码为每个行程结束事件创建了一个新的包含 `startCell` 和距离的元组流:
```java
-import org.joda.time.Interval;
-
-DataStream<Tuple2<Integer, Minutes>> minutesByStartCell = enrichedNYCRides
- .flatMap(new FlatMapFunction<EnrichedRide, Tuple2<Integer, Minutes>>() {
+DataStream<Tuple2<Integer, Double>> minutesByStartCell = enrichedNYCRides
+ .flatMap(new FlatMapFunction<EnrichedRide, Tuple2<Integer, Double>>() {
@Override
public void flatMap(EnrichedRide ride,
- Collector<Tuple2<Integer, Minutes>> out) throws Exception {
- if (!ride.isStart) {
- Interval rideInterval = new Interval(ride.startTime, ride.endTime);
- Minutes duration = rideInterval.toDuration().toStandardMinutes();
- out.collect(new Tuple2<>(ride.startCell, duration));
+ Collector<Tuple2<Integer, Double>> out) throws Exception {
+ if (ride.isStart) {
Review Comment:
I think either `ride.isStart` or `!ride.isStart` makes sense. For a start ride event, we compute the distance from `endLon` and `endLat`. If we use `!rideisStart` (i.e., end ride event), then we compute the distance from `startLon` and `startLat`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org