Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flink: Implement data statistics coordinator to aggregate data statistics from operator subtasks #7360

Merged
merged 27 commits into from
Sep 25, 2023

Conversation

yegangy0718
Copy link
Contributor

@yegangy0718 yegangy0718 commented Apr 17, 2023

This PR is created as part of issue #6303 and project https://github.com/apache/iceberg/projects/27

Motivation:
In this PR, we implement DataStatisticsCoordinator to receive DataStatisticsEvent from DataStatisticsOperator, aggregate those DataStatisticsEvent from operator subtasks via AggregateDataStatistics and then send the aggregation result back to operators.

Changes:

  1. Implement AggregateDataStatistics for aggregating DataStatistics from subtasks
  2. Implement DataStatisticsCoordinatorContext for creating subways to send aggregation result back to operator subtasks
  3. Implement DataStatisticsCoordinator
  4. Implement DataStatisticsCoordinatorProvider which can create DataStatisticsCoordinator and provide CoordinatorExecutorThreadFactory.

@github-actions github-actions bot added the flink label Apr 17, 2023
@stevenzwu stevenzwu self-requested a review April 17, 2023 14:01
@stevenzwu
Copy link
Contributor

@hililiwei can you also help review?

LOG.info(
"Restoring data statistic coordinator {} from checkpoint {}.", operatorName, checkpointId);
lastCompletedAggregator =
InstantiationUtil.deserializeObject(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later, we should follow up with a separate PR with a more stable serializer for checkpoint state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I will have a separate PR for the serializer

LOG.info(
"Restoring data statistic coordinator {} from checkpoint {}.", operatorName, checkpointId);
lastCompletedAggregator =
InstantiationUtil.deserializeObject(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I will have a separate PR for the serializer

@yegangy0718 yegangy0718 force-pushed the 20230412-shuffle-coordinator branch from 9595f7a to bb332cc Compare May 1, 2023 16:54
@yegangy0718 yegangy0718 force-pushed the 20230412-shuffle-coordinator branch from 17f83b2 to c1ff366 Compare May 17, 2023 06:47
@yegangy0718 yegangy0718 force-pushed the 20230412-shuffle-coordinator branch from 5690c28 to fc36623 Compare May 23, 2023 05:26
new RowDataSerializer(RowType.of(new VarCharType())));
provider =
new DataStatisticsCoordinatorProvider<>(
"DataStatisticsCoordinatorProviderTest", OPERATOR_ID, statisticsSerializer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: DataStatisticsCoordinatorProviderTest. maybe just use class name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant getClass().getSimpleName()

DataStatisticsEvent<MapDataStatistics, Map<RowData, Long>>
checkpoint1Subtask0DataStatisticEvent =
DataStatisticsEvent.create(1, checkpoint1Subtask0DataStatistic, statisticsSerializer);
Assert.assertNull(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we convert everything to assertj? I believe the guideline for new unit test should be assertj.
https://iceberg.apache.org/contribute/#assertj

example for equals

    Assertions.assertThat(UpdateRequirementParser.toJson(actual))
        .as("AssertRefSnapshotId should convert to the correct JSON value")
        .isEqualTo(expected);

new RowDataSerializer(RowType.of(new VarCharType())));
provider =
new DataStatisticsCoordinatorProvider<>(
"DataStatisticsCoordinatorProviderTest", OPERATOR_ID, statisticsSerializer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant getClass().getSimpleName()

@stevenzwu stevenzwu merged commit e8a28af into apache:master Sep 25, 2023
13 checks passed
@stevenzwu
Copy link
Contributor

thanks @yegangy0718 for the contribution!

yegangy0718 pushed a commit to yegangy0718/iceberg that referenced this pull request Oct 8, 2023
…dinator to aggregate data statistics from operator subtasks
yegangy0718 pushed a commit to yegangy0718/iceberg that referenced this pull request Oct 8, 2023
…dinator to aggregate data statistics from operator subtasks
yegangy0718 pushed a commit to yegangy0718/iceberg that referenced this pull request Oct 8, 2023
…dinator to aggregate data statistics from operator subtasks
yegangy0718 pushed a commit to yegangy0718/iceberg that referenced this pull request Oct 9, 2023
…dinator to aggregate data statistics from operator subtasks
stevenzwu pushed a commit that referenced this pull request Oct 15, 2023
…r to aggregate data statistics from operator subtasks (#8747)

Co-authored-by: gang_ye <[email protected]>
stevenzwu pushed a commit that referenced this pull request Oct 15, 2023
…r to aggregate data statistics from operator subtasks (#8749)

Co-authored-by: gang_ye <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants