-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix(flink): reuse the preceeding avg size if there is no eligible estimation #19022
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,8 +29,6 @@ | |
| import org.apache.hudi.config.HoodieWriteConfig; | ||
| import org.apache.hudi.table.action.commit.SmallFile; | ||
|
|
||
| import lombok.extern.slf4j.Slf4j; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
@@ -41,7 +39,6 @@ | |
| * | ||
| * <p>Note: assumes the index can always index log files for Flink write. | ||
| */ | ||
| @Slf4j | ||
| public class DeltaWriteProfile extends WriteProfile { | ||
|
|
||
| public DeltaWriteProfile(HoodieWriteConfig config, HoodieFlinkEngineContext context) { | ||
|
|
@@ -93,7 +90,7 @@ protected List<SmallFile> smallFilesProfile(String partitionPath) { | |
|
|
||
| @Override | ||
| protected long averageBytesPerRecord() { | ||
| long avgSize = config.getCopyOnWriteRecordSizeEstimate(); | ||
| long avgSize = this.avgSize > 0 ? this.avgSize : config.getCopyOnWriteRecordSizeEstimate(); | ||
| HoodieTimeline commitTimeline = metaClient.getCommitTimeline().filterCompletedInstants(); | ||
| if (!commitTimeline.empty()) { | ||
| long sizeFromCommitMetadata = calculateRecordSizeThroughCommitMetadata(commitTimeline, 1.0D); | ||
|
|
@@ -109,7 +106,6 @@ protected long averageBytesPerRecord() { | |
| } | ||
| } | ||
| } | ||
| log.info("Refresh average bytes per record => " + avgSize); | ||
| return avgSize; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the |
||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 nit: the
this.avgSize > 0 ? this.avgSize : config.getCopyOnWriteRecordSizeEstimate()initializer is now identical in bothWriteProfile.averageBytesPerRecord()and here — could you pull it into a small protected helper onWriteProfile(e.g.initialAvgSizeEstimate()) so the two overrides stay in sync if the fallback logic ever changes?- AI-generated; verify before applying. React 👍/👎 to flag quality.