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

Fixes for group-by #1938

Merged
merged 25 commits into from
May 22, 2023
Merged

Fixes for group-by #1938

merged 25 commits into from
May 22, 2023

Conversation

generall
Copy link
Member

  • Fix for the payload selector:

    • search request doesn't support nested payload selectors, but group_by should
    • New logic only pre-selects top-level key, which might be a subject for possible further improvements
  • additional must-not condition for re-search requests doesn't work with multiple payload values per field. It excludes too much

    • had to introduce a new except match condition, which fixes the problem.
    • as a bonus: except condition also available outside the groups
    • test for reproducing the problem also included

@generall generall requested review from agourlay and coszio May 21, 2023 19:12
Copy link
Member

@timvisee timvisee left a comment

Choose a reason for hiding this comment

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

Nice work!

I do not see any logical issues. Added some Rust idiomaticness comments. Approved anyway as these are not required.

lib/collection/src/grouping/group_by.rs Outdated Show resolved Hide resolved
lib/collection/src/grouping/group_by.rs Outdated Show resolved Hide resolved
lib/segment/src/index/field_index/map_index.rs Outdated Show resolved Hide resolved
lib/segment/src/index/field_index/map_index.rs Outdated Show resolved Hide resolved
lib/segment/src/index/field_index/map_index.rs Outdated Show resolved Hide resolved
lib/segment/src/index/field_index/map_index.rs Outdated Show resolved Hide resolved
lib/segment/src/vector_storage/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@timvisee timvisee left a comment

Choose a reason for hiding this comment

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

I did have a possible logic issue, see this. I'll re-approved once this is fixed.

coszio
coszio previously approved these changes May 22, 2023
Copy link
Contributor

@coszio coszio left a comment

Choose a reason for hiding this comment

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

Great fix to add the except match. Though can it be that the estimation for must_not can be improved in the future?

lib/collection/src/grouping/group_by.rs Outdated Show resolved Hide resolved
lib/collection/src/grouping/group_by.rs Outdated Show resolved Hide resolved
lib/collection/src/grouping/group_by.rs Outdated Show resolved Hide resolved
lib/segment/src/index/field_index/map_index.rs Outdated Show resolved Hide resolved
lib/segment/src/index/field_index/map_index.rs Outdated Show resolved Hide resolved
@coszio coszio dismissed their stale review May 22, 2023 13:32

Meant to request the change of except_on and match_on

@coszio
Copy link
Contributor

coszio commented May 22, 2023

@timvisee requested changes are fixed now 👍

@generall generall requested review from timvisee and coszio May 22, 2023 17:51
@timvisee timvisee self-assigned this May 22, 2023
@timvisee timvisee removed their assignment May 22, 2023
Copy link
Member

@timvisee timvisee left a comment

Choose a reason for hiding this comment

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

LGTM! 😄

@generall generall merged commit d624512 into dev May 22, 2023
generall added a commit that referenced this pull request May 22, 2023
* fix payload seletor

* clippy

* except cardinality estimation

* implement match except iterator and api

* use except instead of must-not + test

* Fix doc error

* Update lib/collection/src/grouping/group_by.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/index/field_index/map_index.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/index/field_index/map_index.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/index/field_index/map_index.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/index/query_optimization/condition_converter.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/index/query_optimization/condition_converter.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/index/query_optimization/condition_converter.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/vector_storage/mod.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/segment/src/index/field_index/map_index.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* Update lib/collection/src/grouping/group_by.rs

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>

* Update lib/segment/src/index/field_index/map_index.rs

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>

* Update lib/segment/src/index/field_index/map_index.rs [skip ci]

Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>

* fix: `except_on` and `match_on` now produce `Vec<Condition>`s

* Apply suggestions from code review (lib/segment/src/index/field_index/map_index.rs)

* fix: reset review suggestion

* Remove unnecessary move

* Use Rust idiomatic map_else rather than match-none-false

* is-null -> is-empty

* de-comment drop_collection

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
@agourlay agourlay deleted the match-except branch July 12, 2023 15:52
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.

4 participants