-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-9624] Warn when event-time field is set without watermark tracking #18721
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -43,6 +43,7 @@ | |
| import org.apache.hudi.common.fs.FileSystemRetryConfig; | ||
| import org.apache.hudi.common.model.HoodieCleaningPolicy; | ||
| import org.apache.hudi.common.model.HoodieFailedWritesCleaningPolicy; | ||
| import org.apache.hudi.common.model.HoodiePayloadProps; | ||
| import org.apache.hudi.common.model.HoodiePreWriteCleanerPolicy; | ||
| import org.apache.hudi.common.model.HoodieFileFormat; | ||
| import org.apache.hudi.common.model.HoodieRecordMerger; | ||
|
|
@@ -3862,6 +3863,23 @@ private void validate() { | |
| checkArgument(lookbackCommits >= 0, | ||
| String.format("%s must be non-negative, but was %d", | ||
| ROLLING_METADATA_TIMELINE_LOOKBACK_COMMITS.key(), lookbackCommits)); | ||
|
|
||
| validateEventTimeConfigs(); | ||
| } | ||
|
|
||
| private void validateEventTimeConfigs() { | ||
| // Event-time field is configured but watermark tracking is off — the field | ||
| // will be ignored at commit time. Surface a hint so the user can opt in via | ||
| // TRACK_EVENT_TIME_WATERMARK. | ||
| String eventTimeFieldName = writeConfig.getString(HoodiePayloadProps.PAYLOAD_EVENT_TIME_FIELD_PROP_KEY); | ||
| if (!StringUtils.isNullOrEmpty(eventTimeFieldName) | ||
| && !writeConfig.getBooleanOrDefault(TRACK_EVENT_TIME_WATERMARK)) { | ||
| log.warn("{}={} is configured but {}={}; event-time watermark metadata will not be tracked. " | ||
| + "Set {}=true to record event-time watermark in commit metadata.", | ||
| HoodiePayloadProps.PAYLOAD_EVENT_TIME_FIELD_PROP_KEY, eventTimeFieldName, | ||
| TRACK_EVENT_TIME_WATERMARK.key(), writeConfig.getBooleanOrDefault(TRACK_EVENT_TIME_WATERMARK), | ||
|
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. 🤖 nit: - AI-generated; verify before applying. React 👍/👎 to flag quality. |
||
| TRACK_EVENT_TIME_WATERMARK.key()); | ||
| } | ||
|
Comment on lines
+3866
to
+3882
Collaborator
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. We can extract this logic to a separate method like validateEventTimeConfigs within this function.
Author
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. Done in c3d3f45 — extracted to |
||
| } | ||
|
|
||
| public HoodieWriteConfig build() { | ||
|
|
||
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:
validateEventTimeConfigsreads like it enforces a constraint and throws on failure — which is what othervalidate*methods in this builder typically do. Since this one only logs a warning, a name likewarnIfEventTimeWatermarkNotTrackedwould more accurately signal the intent to future readers.- AI-generated; verify before applying. React 👍/👎 to flag quality.