Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zero dim vector save/load #654

Merged
merged 1 commit into from
Apr 21, 2024
Merged

zero dim vector save/load #654

merged 1 commit into from
Apr 21, 2024

Conversation

swilly22
Copy link
Contributor

@swilly22 swilly22 commented Apr 20, 2024

fix #655

Summary by CodeRabbit

  • Bug Fixes
    • Improved vector handling to prevent errors when working with empty vectors.
  • Tests
    • Added tests for empty vector scenarios and updated test sequence for better reliability.

@swilly22 swilly22 added the bug Something isn't working label Apr 20, 2024
Copy link

coderabbitai bot commented Apr 20, 2024

Walkthrough

The recent updates focus on enhancing robustness in vector handling and effects processing within a software project. Changes include adding safety checks to prevent operations on empty vectors, and the test suite has been expanded and reorganized to ensure these new conditions are properly validated.

Changes

File Path Change Summary
src/.../vector.c Added check to prevent reading elements from zero-dimension vectors.
src/.../effects.c Ensured no bytes are written when vector size is zero.
tests/.../test_effects.py Added tests for empty vectors and reorganized existing tests.

🐰✨
Oh hark! A change, a fix, a tweak,
In code where vectors speak.
No more shall zeros lead astray,
Safety checks now lead the way.
Hop, skip, a test, a pass, all's well,
In code rabbit burrows, tales to tell. 🌟
🐰


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between bb04c83 and 2342f54.
Files selected for processing (3)
  • src/datatypes/vector.c (1 hunks)
  • src/effects/effects.c (1 hunks)
  • tests/flow/test_effects.py (2 hunks)
Additional Context Used
Ruff (12)
tests/flow/test_effects.py (12)

3-3: from common import * used; unable to detect undefined names


4-4: from index_utils import * used; unable to detect undefined names


36-36: Do not use bare except


84-84: Env may be undefined, or defined from star imports


88-88: Graph may be undefined, or defined from star imports


89-89: Graph may be undefined, or defined from star imports


92-92: create_node_range_index may be undefined, or defined from star imports


93-93: create_edge_range_index may be undefined, or defined from star imports


791-791: Graph may be undefined, or defined from star imports


792-792: Graph may be undefined, or defined from star imports


822-822: Graph may be undefined, or defined from star imports


823-823: Graph may be undefined, or defined from star imports

Additional comments not posted (3)
src/datatypes/vector.c (1)

85-87: The conditional check to ensure dim > 0 before reading vector elements is a crucial fix for handling zero-dimensional vectors. Good job on this preventive measure.

src/effects/effects.c (1)

241-243: The conditional check to ensure n > 0 before writing bytes is a crucial fix for handling zero-dimensional vectors. Good job on this preventive measure.

tests/flow/test_effects.py (1)

762-778: The new test test14_empty_vector effectively checks the creation and handling of an empty vector, directly addressing the issue highlighted by the PR. Well done on this addition.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@swilly22 swilly22 linked an issue Apr 21, 2024 that may be closed by this pull request
@swilly22 swilly22 merged commit 7e5c58f into master Apr 21, 2024
14 checks passed
@swilly22 swilly22 deleted the zero-length-vector-write branch April 21, 2024 06:39
swilly22 added a commit that referenced this pull request May 13, 2024
* 600 add browser usage for the docker image (#601)

* add instructions to run browser UI

* set hostname to 0.0.0.0

* fix crash in rewrite call subquery (#604)

* fix crash in rewrite call subquery

* simplified test query

---------

Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>

* use debug assert in rust (#606)

* fix merge init (#609)

* fix merge init

* remove unused function, simplified branch assignment logic

* clean

---------

Co-authored-by: Roi Lipman <roilipman@gmail.com>

* Unwind persist (#613)

* persist unwind record

* deep clone base record

* Disable jit (#612)

* persist unwind record

* disable GraphBLAS JIT

* Update module api (#617)

* update RediSearch submodule

* bump RediSearch version

* updated redis module api header file

* make sure there's a record to emit (#623)

* update RediSearch (#640)

* Fix #634 Add Cloud link to README.md (#635)

* fix #645 Add objective to README (#646)

* Add objective to README

* Update wordlist.txt

---------

Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>

* fix union validation with call subquery (#648)

* Seek by id runtime optimization (#643)

* wip runtime optimization

* fix leak

* fix node by label scan

* fix leak

* fix leak

* address review

* add tests

* address review

* review

* review

* review

* add memory hook to roaring bitmap

* introduce bitmap range

---------

Co-authored-by: Roi Lipman <roilipman@gmail.com>
Co-authored-by: Roi Lipman <swilly22@users.noreply.github.com>

* zero dim vector save/load (#654)

* update redisearch, do not escape TAG field (#667)

* Code coverage (#674)

* add coverage build

* rename

* fix

* fix cache

* install redis in coverage

* ignore some path in code coverage (#678)

* Ref count record (#663)

* ref count record

* nullify record on deletion

* handle record ref count within execution plan return record

* address PR comments

* remove head & tail calls to persist

* trying to simplify and make value passing safer and simpler

* free aggregated group once yield

* removed Record_PersistScalars

* removed override flag

* remove extra persists

* group no longer holds a keys array

* only persists keys which are not graph entities

* allow for record cloning from different execution plans

---------

Co-authored-by: Dudi <16744955+dudizimber@users.noreply.github.com>
Co-authored-by: Avi Avni <avi.avni@gmail.com>
Co-authored-by: Guy Korland <gkorland@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zero length vector crash on replication
3 participants