Skip to content

Fix APPLY/FILTER parser - [MOD-7804]#5520

Merged
GuyAv46 merged 20 commits intomasterfrom
guyav-fix_apply_filter_parser
Jan 23, 2025
Merged

Fix APPLY/FILTER parser - [MOD-7804]#5520
GuyAv46 merged 20 commits intomasterfrom
guyav-fix_apply_filter_parser

Conversation

@GuyAv46
Copy link
Collaborator

@GuyAv46 GuyAv46 commented Jan 17, 2025

Describe the changes in the pull request

Refactor parser to follow the expected order of operations.

This PR also enables some internal optimizations to the expression AST, such as:

  1. perform in-place numeric calculations for literals, when possible
  2. Double negation cancels each other and yields the inner node

Which additional issues this PR fixes

  1. MOD-6835

Main objects this PR modified

  1. APPLY/FILTER parser

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

@GuyAv46 GuyAv46 marked this pull request as draft January 17, 2025 13:45
@GuyAv46 GuyAv46 marked this pull request as ready for review January 17, 2025 13:50
@GuyAv46 GuyAv46 marked this pull request as draft January 17, 2025 13:51
@codecov
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 97.60479% with 8 lines in your changes missing coverage. Please review.

Project coverage is 87.27%. Comparing base (861d36d) to head (e937404).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
src/aggregate/expr/lexer.c 86.36% 6 Missing ⚠️
src/aggregate/expr/expression.c 80.00% 1 Missing ⚠️
src/aggregate/expr/parser.c 99.37% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5520      +/-   ##
==========================================
+ Coverage   87.18%   87.27%   +0.08%     
==========================================
  Files         196      196              
  Lines       35110    35268     +158     
==========================================
+ Hits        30611    30780     +169     
+ Misses       4499     4488      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GuyAv46 GuyAv46 marked this pull request as ready for review January 17, 2025 14:58
@GuyAv46 GuyAv46 marked this pull request as draft January 17, 2025 14:58
@GuyAv46 GuyAv46 marked this pull request as ready for review January 17, 2025 15:34
@GuyAv46 GuyAv46 marked this pull request as draft January 17, 2025 15:35
@GuyAv46 GuyAv46 marked this pull request as ready for review January 17, 2025 16:37
@GuyAv46 GuyAv46 marked this pull request as draft January 17, 2025 16:38
@GuyAv46 GuyAv46 changed the title Fix APPLY/FILTER parser Fix APPLY/FILTER parser - [MOD-7804] Jan 19, 2025
@GuyAv46 GuyAv46 requested a review from kei-nan January 22, 2025 11:47
Copy link
Collaborator

@raz-mon raz-mon left a comment

Choose a reason for hiding this comment

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

Very nice!
Some small comments

@GuyAv46 GuyAv46 requested review from kei-nan and raz-mon January 23, 2025 10:43
kei-nan
kei-nan previously approved these changes Jan 23, 2025
Copy link
Collaborator

@kei-nan kei-nan left a comment

Choose a reason for hiding this comment

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

Added one optional comment, besides that looks good.

Copy link
Collaborator

@raz-mon raz-mon left a comment

Choose a reason for hiding this comment

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

💯

@GuyAv46 GuyAv46 added this pull request to the merge queue Jan 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 23, 2025
@GuyAv46 GuyAv46 added this pull request to the merge queue Jan 23, 2025
Merged via the queue into master with commit eb14b95 Jan 23, 2025
10 checks passed
@GuyAv46 GuyAv46 deleted the guyav-fix_apply_filter_parser branch January 23, 2025 17:30
redisearch-backport-pull-request bot pushed a commit that referenced this pull request Jan 23, 2025
* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

(cherry picked from commit eb14b95)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 8.0:

github-merge-queue bot pushed a commit that referenced this pull request Jan 23, 2025
Fix APPLY/FILTER parser - [MOD-7804] (#5520)

* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

(cherry picked from commit eb14b95)

Co-authored-by: GuyAv46 <[email protected]>
dor-forer pushed a commit that referenced this pull request Jan 26, 2025
* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2025
* Adding numeric check

* changes

* change to each one

* MOD-6786 Fix search on larger then 128 terms (#5524)

* Move length slicing to NOMODIFY if

* add py test

* fix slicing

* fix test

* fix text skip cluster

* Adding comments

* Update test_issues - skip cluster

* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

* Load config params for Redis 8.0-m03 (#5538)

* Load config params for Redis v7.9.226

* Add step to get latest unreleased redis tag

* Remove commented-out step `Get Latest Release Tag with Prefix`

* Revert: task-get-latest-tag.yml

* MOD-8601: Fix error message for LOAD (#5531)

* Enhance error message for LOAD

* Fix error message

* Address review

* Fix flakiness in a test (#5541)

* fix flakiness

* revert whitespace change

* Fix Max Frequency Misscalculation - [MOD-8158] (#5553)

* fix unrelated test

* add a failing test

* fix issue

* revert whitespace change from test_vecsim.py

* revert whitespace change in test_issues.py

* Fix APPLY/FILTER parser - [MOD-7804] (#5520)

* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

* remove unncessary

* Added tests for legacy filter empty

* Adding numeric check

* changes

* change to each one

* remove unncessary

* Added tests for legacy filter empty

* * Change the order of params
* Add support in GEOFILTER

* Forgot one file

* * Changed to AC_GetString with no advance
* Added comment
* change the string check

* PR changes

* Changes

* push the test

* change style

---------

Co-authored-by: lerman25 <[email protected]>
Co-authored-by: kei-nan <[email protected]>
Co-authored-by: nafraf <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
redisearch-backport-pull-request bot pushed a commit that referenced this pull request Jan 30, 2025
* Adding numeric check

* changes

* change to each one

* MOD-6786 Fix search on larger then 128 terms (#5524)

* Move length slicing to NOMODIFY if

* add py test

* fix slicing

* fix test

* fix text skip cluster

* Adding comments

* Update test_issues - skip cluster

* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

* Load config params for Redis 8.0-m03 (#5538)

* Load config params for Redis v7.9.226

* Add step to get latest unreleased redis tag

* Remove commented-out step `Get Latest Release Tag with Prefix`

* Revert: task-get-latest-tag.yml

* MOD-8601: Fix error message for LOAD (#5531)

* Enhance error message for LOAD

* Fix error message

* Address review

* Fix flakiness in a test (#5541)

* fix flakiness

* revert whitespace change

* Fix Max Frequency Misscalculation - [MOD-8158] (#5553)

* fix unrelated test

* add a failing test

* fix issue

* revert whitespace change from test_vecsim.py

* revert whitespace change in test_issues.py

* Fix APPLY/FILTER parser - [MOD-7804] (#5520)

* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

* remove unncessary

* Added tests for legacy filter empty

* Adding numeric check

* changes

* change to each one

* remove unncessary

* Added tests for legacy filter empty

* * Change the order of params
* Add support in GEOFILTER

* Forgot one file

* * Changed to AC_GetString with no advance
* Added comment
* change the string check

* PR changes

* Changes

* push the test

* change style

---------

Co-authored-by: lerman25 <[email protected]>
Co-authored-by: kei-nan <[email protected]>
Co-authored-by: nafraf <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit e4d8fa0)
github-merge-queue bot pushed a commit that referenced this pull request Feb 4, 2025
* Fix Empty Numeric Value - [MOD-7244] (#5566)

* Adding numeric check

* changes

* change to each one

* MOD-6786 Fix search on larger then 128 terms (#5524)

* Move length slicing to NOMODIFY if

* add py test

* fix slicing

* fix test

* fix text skip cluster

* Adding comments

* Update test_issues - skip cluster

* MOD-8561: Fix Inverted Index SeekTo Edge Case (#5528)

* * initial commit

* * simplify the fix

* * revert to old code to solve edge case

* Load config params for Redis 8.0-m03 (#5538)

* Load config params for Redis v7.9.226

* Add step to get latest unreleased redis tag

* Remove commented-out step `Get Latest Release Tag with Prefix`

* Revert: task-get-latest-tag.yml

* MOD-8601: Fix error message for LOAD (#5531)

* Enhance error message for LOAD

* Fix error message

* Address review

* Fix flakiness in a test (#5541)

* fix flakiness

* revert whitespace change

* Fix Max Frequency Misscalculation - [MOD-8158] (#5553)

* fix unrelated test

* add a failing test

* fix issue

* revert whitespace change from test_vecsim.py

* revert whitespace change in test_issues.py

* Fix APPLY/FILTER parser - [MOD-7804] (#5520)

* fix order of operations

* minor improvements to the lexer

* improve functions parsing

* optimize "NOT" logic and perform arithmetic operations immediately

* fix flow tests

* fix grammar optimization

* changed function API

* added a test

* minor fix

* fix precedence

* minor improvement

* reorder rule and fix leak

* another fix

* added test

* more tests for a better coverage

* improved test

* fix assertion

* review fixes

* address code review

* added comments

* remove unncessary

* Added tests for legacy filter empty

* Adding numeric check

* changes

* change to each one

* remove unncessary

* Added tests for legacy filter empty

* * Change the order of params
* Add support in GEOFILTER

* Forgot one file

* * Changed to AC_GetString with no advance
* Added comment
* change the string check

* PR changes

* Changes

* push the test

* change style

---------

Co-authored-by: lerman25 <[email protected]>
Co-authored-by: kei-nan <[email protected]>
Co-authored-by: nafraf <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: GuyAv46 <[email protected]>
(cherry picked from commit e4d8fa0)

* Change python to fit python3.7

---------

Co-authored-by: dor-forer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants