Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6332 +/- ##
==========================================
- Coverage 88.89% 88.87% -0.03%
==========================================
Files 247 247
Lines 41275 41291 +16
Branches 3483 3483
==========================================
+ Hits 36693 36696 +3
- Misses 4539 4552 +13
Partials 43 43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new APPLY stage function, case(), for supporting ternary conditional logic in aggregation pipelines. The changes include new test cases covering various scenarios for the case() function, placeholder registration of the case() function in the function registry, and its evaluation implementation in the expression evaluation code.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/pytests/test_case.py | New tests for validating the case() function with different conditions. |
| src/aggregate/functions/string.c | Registers the new case() function with a placeholder implementation. |
| src/aggregate/expr/expression.c | Implements evalFuncCase() to properly evaluate the case() function logic. |
Comments suppressed due to low confidence (1)
src/aggregate/functions/string.c:279
- Consider expanding the comment for func_case to clarify that it serves solely for function registration and that its execution logic is deferred to evalFuncCase in expression.c.
int func_case(ExprEval *ctx, RSValue *argv, size_t argc, RSValue *result) {
…o improve product classification and result validation
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.10
git worktree add -d .worktree/backport-6332-to-2.10 origin/2.10
cd .worktree/backport-6332-to-2.10
git switch --create backport-6332-to-2.10
git cherry-pick -x f338602a603ffe2fdd9498b2feb4f34e4ae444a3 |
* WIP: Implement func_case * Add tests * Test nested case * Rename testNestedCase to testNestedCaseAndGroup * Add test for invalid apply expressions * Remove TODO comment * Fix flaky test * Test with document which doesn't have neither of the fields. * Add unit tests * Add tests for NULL and missing fields * Add more unit tests * refactor evalFuncCase and update test cases for func_case handling * Fix typo * Refactor testCaseWithLogicalOperators and testCaseWithMissingFields to improve product classification and result validation * Add test with deep nesting of case * One more simple test --------- Co-authored-by: oshadmi <[email protected]> (cherry picked from commit f338602)
|
Successfully created backport PR for |
(cherry picked from commit f338602)
* MOD-10153: New APPLY function case() (#6332) (cherry picked from commit f338602) * Guard case() by ENABLE_UNSTABLE_FEATURES * Add argument validation for case() function and corresponding tests * Fix func_case function signature * Free arg list in parser * Remove unnecessary error handling for unknown function names in parser
* MOD-10153: New APPLY function case() (#6332) * WIP: Implement func_case * Add tests * Test nested case * Rename testNestedCase to testNestedCaseAndGroup * Add test for invalid apply expressions * Remove TODO comment * Fix flaky test * Test with document which doesn't have neither of the fields. * Add unit tests * Add tests for NULL and missing fields * Add more unit tests * refactor evalFuncCase and update test cases for func_case handling * Fix typo * Refactor testCaseWithLogicalOperators and testCaseWithMissingFields to improve product classification and result validation * Add test with deep nesting of case * One more simple test --------- Co-authored-by: oshadmi <[email protected]> (cherry picked from commit f338602) * Guarde case() by search-enable-unstable-features * Enable Unstable features for unit-tests --------- Co-authored-by: nafraf <[email protected]> Co-authored-by: oshadmi <[email protected]> Co-authored-by: nafraf <[email protected]>
Description:
Add a conditional case() function to aggregation pipeline APPLY stage for ternary conditional logic.
A clear and concise description of what the PR is solving, including:
Query error when trying to APPLY expression on results of a UNION QUERY where results could be present in the TEXT query but not in the VECTOR query.
Implement new function
case(condition, if_true, if_false)Which additional issues this PR fixes
Main objects this PR modified
Mark if applicable