Skip to content

Fix Empty Numeric Value - [MOD-7244]#5566

Merged
dor-forer merged 25 commits intomasterfrom
dor-fix-parse-double
Jan 30, 2025
Merged

Fix Empty Numeric Value - [MOD-7244]#5566
dor-forer merged 25 commits intomasterfrom
dor-fix-parse-double

Conversation

@dor-forer
Copy link
Collaborator

Describe the changes in the pull request

  • Added check for empty numeric string before legacy SEARCH FILTER (only if dialect version is greater than 2).
  • Added check for an empty string when evaluating pramas (only if dialect version is greater than 2).

Main objects this PR modified

  1. An empty string param doesn't evaluate as 0.

Mark if applicable

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

@dor-forer dor-forer requested review from GuyAv46 and alonre24 January 26, 2025 08:26
@CLAassistant
Copy link

CLAassistant commented Jan 26, 2025

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.28%. Comparing base (eb14b95) to head (5a5f246).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5566   +/-   ##
=======================================
  Coverage   87.28%   87.28%           
=======================================
  Files         196      196           
  Lines       35267    35292   +25     
=======================================
+ Hits        30783    30805   +22     
- Misses       4484     4487    +3     

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

lerman25 and others added 9 commits January 26, 2025 12:59
* Move length slicing to NOMODIFY if

* add py test

* fix slicing

* fix test

* fix text skip cluster

* Adding comments

* Update test_issues - skip cluster
* * initial commit

* * simplify the fix

* * revert to old code to solve edge case
* 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
* Enhance error message for LOAD

* Fix error message

* Address review
* fix flakiness

* revert whitespace change
* fix unrelated test

* add a failing test

* fix issue

* revert whitespace change from test_vecsim.py

* revert whitespace change in test_issues.py
* 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
return REDISMODULE_ERR;
} else if (strcmp(s, "*")) {
QERR_MKBADARGS_FMT(status, "Bad arguments for LOAD: Expected number of fields or `*`");
return REDISMODULE_ERR;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was changed here? Is it relevant for the PR?

@alonre24 alonre24 requested review from raz-mon and removed request for alonre24 January 26, 2025 14:34
@dor-forer dor-forer requested a review from GuyAv46 January 27, 2025 09:30
* Added comment
* change the string check
@dor-forer dor-forer requested a review from GuyAv46 January 28, 2025 07:24
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.

Nicely done.
See a few comments

src/geo_index.c Outdated
return REDISMODULE_ERR;
}

CheckAndSetEmptyFilterValue(ac, hasEmptyFilterValue);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider putting these checks after the parsing (i.e., 4 lines below), and conditioning it on the value of the argument. I.e., if it is not 0, we don't need this extra parsing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The issue is that AC_GetDouble already advances the curser so the check is not relevant anymore.
Do you think I should pass the AC_F_NOADVANCE to AC_GetDouble, and advance the curser afterward?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah that sounds good, since most of the times this won't be the case and we'll just advance the cursor by 1.

@dor-forer dor-forer requested a review from raz-mon January 29, 2025 13:51
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.

LGTM 👍
Small style comment

@dor-forer dor-forer added this pull request to the merge queue Jan 30, 2025
Merged via the queue into master with commit e4d8fa0 Jan 30, 2025
13 checks passed
@dor-forer dor-forer deleted the dor-fix-parse-double branch January 30, 2025 12:14
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)
@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 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants