Skip to content

Conversation

@APozdniakov
Copy link
Member

Changelog entry

Add new watermark options: granularity, idle timeout, late arrival policy

Changelog category

  • Not for changelog (changelog entry is not required)

Description for reviewers

...

@APozdniakov APozdniakov self-assigned this Nov 26, 2025
@APozdniakov APozdniakov requested a review from a team as a code owner November 26, 2025 18:05
@github-actions
Copy link

github-actions bot commented Nov 26, 2025

2025-11-26 18:07:37 UTC Pre-commit check linux-x86_64-relwithdebinfo for c32bf17 has started.
2025-11-26 18:07:55 UTC Artifacts will be uploaded here
2025-11-26 18:10:07 UTC ya make is running...
🟡 2025-11-26 19:48:21 UTC Some tests failed, follow the links below. Going to retry failed tests...

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39490 36621 0 6 2836 27

2025-11-26 19:48:34 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-11-26 20:01:05 UTC Tests successful.

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
54 (only retried tests) 40 0 0 0 14

🟢 2025-11-26 20:01:12 UTC Build successful.
🟢 2025-11-26 20:01:31 UTC ydbd size 2.3 GiB changed* by +71.5 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: f11c39b merge: c32bf17 diff diff %
ydbd size 2 456 394 232 Bytes 2 456 467 424 Bytes +71.5 KiB +0.003%
ydbd stripped size 523 433 984 Bytes 523 450 240 Bytes +15.9 KiB +0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Nov 26, 2025

2025-11-26 18:07:46 UTC Pre-commit check linux-x86_64-release-asan for c32bf17 has started.
2025-11-26 18:08:04 UTC Artifacts will be uploaded here
2025-11-26 18:10:08 UTC ya make is running...
🟡 2025-11-26 19:20:49 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
11882 11678 0 188 8 8

🟢 2025-11-26 19:20:58 UTC Build successful.
🟡 2025-11-26 19:21:21 UTC ydbd size 3.8 GiB changed* by +116.8 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: f11c39b merge: c32bf17 diff diff %
ydbd size 4 111 666 568 Bytes 4 111 786 136 Bytes +116.8 KiB +0.003%
ydbd stripped size 1 528 107 376 Bytes 1 528 143 824 Bytes +35.6 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

🟢 2025-11-26 18:08:49 UTC The validation of the Pull Request description is successful.

@GrigoriyPA GrigoriyPA requested a review from Copilot November 27, 2025 08:13
Copilot finished reviewing on behalf of GrigoriyPA November 27, 2025 08:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds new watermark configuration options to YQL streaming queries, enabling finer control over watermark behavior. The implementation includes granularity, idle timeout, and late arrival policy settings that can be specified both at the PRAGMA level and per-table in the WITH clause.

  • Added support for WATERMARK_GRANULARITY and WATERMARK_IDLE_TIMEOUT table-level settings
  • Added support for WATERMARK_ADJUST_LATE_EVENTS and WATERMARK_DROP_LATE_EVENTS flags for controlling late event handling
  • Refactored settings processing to use TCoNameValueTupleList instead of TExprList for better type safety

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
watermarks_drop.sql, watermarks_as.sql, watermarks_adjust.sql, watermarks.sql Test SQL files demonstrating new watermark options usage
yql_pq_topic_key_parser.h/cpp Added getter methods and parsing logic for new watermark settings
yql_pq_dq_integration.cpp Main implementation of watermark settings validation and conversion, including mutual exclusivity checks for late event policies
yql_pq_datasource.cpp Updated to pass new watermark settings through the query pipeline
yql_pq_datasource_type_ann.cpp Added type annotation validation for settings tuple
yql_pq_expr_nodes.json Changed Settings field type from TExprList to TCoNameValueTupleList
yql_names.h Added WatermarksLateEventsPolicySetting constant
ya.make Reorganized PEERDIR dependencies (formatting change)
canondata/*.txt Expected test output files for the new test cases
result.json Test registry updates for new test cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
if (!watermarksLateEventsPolicy.Empty()) {
ctx.AddError(TIssue(ctx.GetPosition(pqReadTopic.Pos()),
TStringBuilder() << "Cannot adjust and " << *watermarksLateEventsPolicy << " late events at the same time"));
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The error message uses inconsistent verb forms. When watermarksLateEventsPolicy is "drop", the message reads "Cannot adjust and drop late events", but when it's "adjust", it reads "Cannot drop and adjust late events". Consider using a consistent format like "Cannot use both adjust and drop policies for late events" or "WATERMARK_ADJUST_LATE_EVENTS and WATERMARK_DROP_LATE_EVENTS are mutually exclusive".

Copilot uses AI. Check for mistakes.
}
if (!watermarksLateEventsPolicy.Empty()) {
ctx.AddError(TIssue(ctx.GetPosition(pqReadTopic.Pos()),
TStringBuilder() << "Cannot drop and " << *watermarksLateEventsPolicy << " late events at the same time"));
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The error message uses inconsistent verb forms. When watermarksLateEventsPolicy is "adjust", the message reads "Cannot drop and adjust late events", but when it's "drop", it reads "Cannot adjust and drop late events". Consider using a consistent format like "Cannot use both drop and adjust policies for late events" or "WATERMARK_ADJUST_LATE_EVENTS and WATERMARK_DROP_LATE_EVENTS are mutually exclusive".

Copilot uses AI. Check for mistakes.
.GetOrElse(TDqSettings::TDefault::WatermarksLateArrivalDelayMs));
Add(props, WatermarksLateArrivalDelayUsSetting, ToString(lateArrivalDelay.MicroSeconds()), pos, ctx);

const auto lateEventsPolicy = watermarksLateEventsPolicy
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

The default late events policy of "adjust" is implicit and undocumented. Consider adding a comment explaining why "adjust" is the default behavior, especially since this is a breaking change from the previous behavior where this setting didn't exist.

Suggested change
const auto lateEventsPolicy = watermarksLateEventsPolicy
const auto lateEventsPolicy = watermarksLateEventsPolicy
// Default late events policy is set to "adjust" for backward compatibility.
// This is a breaking change from previous behavior where this setting did not exist.
// See relevant documentation or design notes for further details.

Copilot uses AI. Check for mistakes.
@APozdniakov APozdniakov merged commit b38939e into ydb-platform:main Nov 27, 2025
17 checks passed
@APozdniakov APozdniakov deleted the YQ-4903 branch November 27, 2025 09:36
APozdniakov added a commit to APozdniakov/ydb that referenced this pull request Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants