Skip to content

Fix missing optional fields in grouped query results - #2280

Open
remote-controlled-man wants to merge 1 commit into
weaviate:mainfrom
remote-controlled-man:codex/prflow-277f40208496
Open

remote-controlled-man wants to merge 1 commit into
weaviate:mainfrom
remote-controlled-man:codex/prflow-277f40208496

Conversation

@remote-controlled-man

Copy link
Copy Markdown

Grouped query responses currently turn absent protobuf rerank and generative messages into 0.0 and "". For example, a grouped collection.query.near_text(...) without reranking reports a rerank score, and a grouped collection.generate.near_vector(..., single_prompt=...) without a grouped task reports an empty grouped result.

Use protobuf field presence when constructing Group and GenerativeGroup. Absent messages now produce None, while present zero scores and empty strings are preserved.

Regression tests exercise public async collection query and generate methods with real protobuf replies and a mocked transport.

Validation:

  • Python 3.11 unit and mock suites (pytest test mock_tests): 725 passed, 1 skipped (the existing, unimplemented collection-model module).
  • Ruff check, Ruff format check and Flake8 on both changed files: passed.
  • Live integration tests were not run.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 02:32

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the grouped-query and generation result changes.

No open issues 🎉

What changed in this PR

Fixes grouped query and generation results so absent protobuf messages produce None, while explicitly present zero scores and empty strings are preserved.

Changes:

  • Uses protobuf field presence checks when constructing Group and GenerativeGroup.
  • Adds async regression tests using real protobuf replies and a mocked transport, covering absent, default-valued, and populated fields.
File Description
weaviate/​collections/​queries/​base_executor.py Checks message presence for grouped rerank scores and generated results.
test/​collection/​test_groupby_results.py Tests optional fields through public grouped query and generate methods.

Review effort: Balanced

@weaviate-git-bot

Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@remote-controlled-man

Copy link
Copy Markdown
Author

I have read and agree to the Weaviate Contributor License Agreement.

This branch has not been deployed

No deployments
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.

3 participants