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

[Early feedback] [HUDI-8163] Refactor UnMergedLogHandler with iterators #12608

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vamshipasunuru
Copy link

Change Logs

Refactor code to deprecate usage of callbacks and replace with iterators

Impact

Describe any public API or user-facing feature change or any performance impact.

Risk level (write none, low medium or high below)

If medium or high, explain what verification was done to mitigate the risks.

Documentation Update

Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@vamshipasunuru vamshipasunuru marked this pull request as draft January 9, 2025 12:57
@vamshipasunuru
Copy link
Author

@danny0405

@github-actions github-actions bot added the size:M PR with lines of changes in (100, 300] label Jan 9, 2025
@hudi-bot
Copy link

hudi-bot commented Jan 9, 2025

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

.build();
scanner.scan(false);
Iterator<HoodieRecord<?>> recordIterator = scanner.iterator();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible we return an iterator too for method getUnmergedLogFileRecords to the list add/get can be simplified.

@@ -617,6 +617,8 @@ && compareTimestamps(logBlock.getLogBlockHeader().get(INSTANT_TIME), GREATER_THA
/**
* Iterate over the GenericRecord in the block, read the hoodie key and partition path and call subclass processors to
* handle it.
* TODO:
* 1. what is the purpose of this method? should the HoodieRecord be added to a queue and consumed by an iterator?
*/
private void processDataBlock(HoodieDataBlock dataBlock, Option<KeySpec> keySpecOpt) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be the main entry for handling the log blocks, each kind of log block would trigger invocation of specific row-level handling methods.

}

public Builder withRecordDeletionCallback(RecordDeletionCallback recordDeletionCallback) {
this.recordDeletionCallback = recordDeletionCallback;
Copy link
Contributor

Choose a reason for hiding this comment

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

The recordDeletionCallback is only consumer for deleted reords from the delete avro block, we may need another iterator impl specifically for it.

while (recordIterator.hasNext()) {
try {
records.add(recordIterator.next());
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The code is exactly the same if we collect all the records in the collection again , maybe we do not remove those two callbacks and just add a new iterator impl for the case that really need it: the Flink streaming reader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M PR with lines of changes in (100, 300]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants