Skip to content

Conversation

@gridnevvvit
Copy link
Member

Changelog entry

Changelog category

  • Not for changelog (changelog entry is not required)

Description for reviewers

...

Copilot AI review requested due to automatic review settings December 24, 2025 19:30
@gridnevvvit gridnevvvit requested review from a team as code owners December 24, 2025 19:30
@ydbot
Copy link
Collaborator

ydbot commented Dec 24, 2025

Run Extra Tests

Run additional tests for this PR. You can customize:

  • Test Size: small, medium, large (default: all)
  • Test Targets: any directory path (default: ydb/)
  • Sanitizers: ASAN, MSAN, TSAN
  • Coredumps: enable for debugging (default: off)
  • Additional args: custom ya make arguments

▶  Run tests

@github-actions
Copy link

🟢 2025-12-24 19:34:07 UTC The validation of the Pull Request description is successful.

@github-actions
Copy link

github-actions bot commented Dec 24, 2025

2025-12-24 19:34:21 UTC Pre-commit check linux-x86_64-relwithdebinfo for e20d1b2 has started.
2025-12-24 19:34:39 UTC Artifacts will be uploaded here
2025-12-24 19:36:50 UTC ya make is running...
🟡 2025-12-24 21:31:24 UTC Some tests failed, follow the links below. Going to retry failed tests...

Details

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
43943 40341 0 6 3383 213

2025-12-24 21:31:41 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-12-24 22:04:23 UTC Some tests failed, follow the links below. Going to retry failed tests...

Details

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1929 (only retried tests) 1916 0 1 0 12

2025-12-24 22:04:30 UTC ya make is running... (failed tests rerun, try 3)
🔴 2025-12-24 22:08:29 UTC Some tests failed, follow the links below.

Ya make output | Test bloat | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
255 (only retried tests) 243 0 1 0 11

🟢 2025-12-24 22:08:36 UTC Build successful.
🟢 2025-12-24 22:09:02 UTC ydbd size 2.3 GiB changed* by +1.1 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: d39bf3d merge: e20d1b2 diff diff %
ydbd size 2 489 119 392 Bytes 2 489 120 536 Bytes +1.1 KiB +0.000%
ydbd stripped size 529 586 496 Bytes 529 587 392 Bytes +896 Bytes +0.000%

*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 Dec 24, 2025

2025-12-24 19:35:02 UTC Pre-commit check linux-x86_64-release-asan for e20d1b2 has started.
2025-12-24 19:35:18 UTC Artifacts will be uploaded here
2025-12-24 19:37:30 UTC ya make is running...
🟡 2025-12-24 20:52:29 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?
13839 13726 0 84 9 20

🟢 2025-12-24 20:52:38 UTC Build successful.
🟢 2025-12-24 20:53:08 UTC ydbd size 3.8 GiB changed* by -26.3 KiB, which is <= 0 Bytes vs main: OK

ydbd size dash main: d39bf3d merge: e20d1b2 diff diff %
ydbd size 4 091 822 032 Bytes 4 091 795 064 Bytes -26.3 KiB -0.001%
ydbd stripped size 1 531 618 456 Bytes 1 531 605 400 Bytes -12.8 KiB -0.001%

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

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 enables returning relevance values as results from full-text search queries. Previously, relevance could only be used internally for sorting; now it can be included in the SELECT clause and returned to users.

Key changes:

  • Uncommented and updated test code to verify relevance values can be retrieved in query results
  • Refactored full-text search optimization logic by extracting common functionality into reusable helper functions (FindMatchingApply and ExtractFullTextSearchParams)
  • Extended KqpRewriteFlatMapOverFullTextContains to handle both FullText.Contains and FullText.Relevance operations

Reviewed changes

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

File Description
ydb/core/kqp/ut/indexes/kqp_indexes_fulltext_ut.cpp Uncommented test code that verifies relevance values can be selected and retrieved from full-text search results, added relevance value extraction and updated debug output
ydb/core/kqp/opt/logical/kqp_opt_log_indexes.cpp Refactored full-text search query optimization by extracting common logic into helper functions, added support for returning relevance values in FlatMap operations, and simplified lambda construction logic

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

Comment on lines 1124 to 1168
TMaybeNode<TCoApply> FindMatchingApply(const TExprBase& node) {
TMaybeNode<TCoApply> matchingApply;

VisitExpr(node.Ptr(), [&] (const TExprNode::TPtr& expr) {
if (TCoApply::Match(expr.Get())) {
auto apply = TExprBase(expr).Cast<TCoApply>();
if (!apply.Callable().Maybe<TCoUdf>()) {
return true;
}

if (apply.Args().Count() != 3) {
return true;
}

auto udf = apply.Callable().Maybe<TCoUdf>().Cast();

if (IsIn({"FullText.Contains", "FullText.Relevance"}, udf.MethodName().Value())) {
matchingApply = apply;
return true;
}

}

return true;
});

return matchingApply;
}
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The FindMatchingApply function will return the last matching apply node if multiple FullText.Contains or FullText.Relevance calls exist in the expression tree, due to the visitor overwriting matchingApply on each match. This could lead to unexpected behavior if an expression contains multiple full-text operations. Consider either: (1) stopping after finding the first match by returning false from the visitor, or (2) detecting multiple matches and reporting an error if that's not a valid use case.

Copilot uses AI. Check for mistakes.
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@gridnevvvit gridnevvvit force-pushed the fix-top-sort-without-flat-map branch from ce5d823 to 8377d84 Compare December 24, 2025 22:30
@github-actions
Copy link

github-actions bot commented Dec 24, 2025

2025-12-24 22:34:07 UTC Pre-commit check linux-x86_64-relwithdebinfo for 2bd2c23 has started.
2025-12-24 22:34:23 UTC Artifacts will be uploaded here
2025-12-24 22:36:32 UTC ya make is running...
2025-12-24 22:40:29 UTC Check cancelled

@github-actions
Copy link

github-actions bot commented Dec 24, 2025

2025-12-24 22:34:31 UTC Pre-commit check linux-x86_64-release-asan for 2bd2c23 has started.
2025-12-24 22:34:47 UTC Artifacts will be uploaded here
2025-12-24 22:36:57 UTC ya make is running...
2025-12-24 22:40:38 UTC Check cancelled

@gridnevvvit gridnevvvit force-pushed the fix-top-sort-without-flat-map branch from 8377d84 to b295f0e Compare December 24, 2025 22:40
@github-actions
Copy link

github-actions bot commented Dec 24, 2025

2025-12-24 22:41:08 UTC Pre-commit check linux-x86_64-relwithdebinfo for 9d0607b has started.
2025-12-24 22:41:30 UTC Artifacts will be uploaded here
2025-12-24 22:42:51 UTC ya make is running...
🟡 2025-12-25 00:31:18 UTC Some tests failed, follow the links below. Going to retry failed tests...

Details

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
43943 40355 0 2 3383 203

2025-12-25 00:31:36 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-12-25 01:04:14 UTC Tests successful.

Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1767 (only retried tests) 1756 0 0 0 11

🟢 2025-12-25 01:04:21 UTC Build successful.
🟢 2025-12-25 01:04:45 UTC ydbd size 2.3 GiB changed* by -18.6 KiB, which is <= 0 Bytes vs main: OK

ydbd size dash main: 14437ea merge: 9d0607b diff diff %
ydbd size 2 489 124 728 Bytes 2 489 105 680 Bytes -18.6 KiB -0.001%
ydbd stripped size 529 587 136 Bytes 529 585 408 Bytes -1.7 KiB -0.000%

*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 Dec 24, 2025

2025-12-24 22:45:15 UTC Pre-commit check linux-x86_64-release-asan for 9d0607b has started.
2025-12-24 22:45:33 UTC Artifacts will be uploaded here
2025-12-24 22:47:43 UTC ya make is running...
🟡 2025-12-25 00:01:44 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?
13839 13653 0 86 83 17

🟢 2025-12-25 00:01:53 UTC Build successful.
🟢 2025-12-25 00:02:28 UTC ydbd size 3.8 GiB changed* by -28.0 KiB, which is <= 0 Bytes vs main: OK

ydbd size dash main: 14437ea merge: 9d0607b diff diff %
ydbd size 4 091 829 568 Bytes 4 091 800 880 Bytes -28.0 KiB -0.001%
ydbd stripped size 1 531 620 184 Bytes 1 531 614 360 Bytes -5.7 KiB -0.000%

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

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