stevenzwu commented on code in PR #10331: URL: https://github.com/apache/iceberg/pull/10331#discussion_r1625083271
########## flink/v1.19/flink/src/main/java/org/apache/iceberg/flink/sink/shuffle/DataStatisticsCoordinator.java: ########## @@ -158,30 +185,29 @@ private void ensureStarted() { } private int parallelism() { - return operatorCoordinatorContext.currentParallelism(); + return context.currentParallelism(); } - private void handleDataStatisticRequest(int subtask, DataStatisticsEvent<D, S> event) { - AggregatedStatistics<D, S> aggregatedStatistics = + private void handleDataStatisticRequest(int subtask, StatisticsEvent event) { + AggregatedStatistics aggregatedStatistics = aggregatedStatisticsTracker.updateAndCheckCompletion(subtask, event); if (aggregatedStatistics != null) { completedStatistics = aggregatedStatistics; - sendDataStatisticsToSubtasks( - completedStatistics.checkpointId(), completedStatistics.dataStatistics()); + sendAggregatedStatisticsToSubtasks(completedStatistics.checkpointId(), completedStatistics); } } @SuppressWarnings("FutureReturnValueIgnored") - private void sendDataStatisticsToSubtasks( - long checkpointId, DataStatistics<D, S> globalDataStatistics) { + private void sendAggregatedStatisticsToSubtasks( + long checkpointId, AggregatedStatistics globalStatistics) { callInCoordinatorThread( () -> { - DataStatisticsEvent<D, S> dataStatisticsEvent = - DataStatisticsEvent.create(checkpointId, globalDataStatistics, statisticsSerializer); - int parallelism = parallelism(); - for (int i = 0; i < parallelism; ++i) { - subtaskGateways.getSubtaskGateway(i).sendEvent(dataStatisticsEvent); + StatisticsEvent statisticsEvent = + StatisticsEvent.createAggregatedStatisticsEvent( + checkpointId, globalStatistics, aggregatedStatisticsSerializer); + for (int i = 0; i < context.currentParallelism(); ++i) { Review Comment: good catch. let me remove the `parallelism()` method as it is too trivial to be kept -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org