query: fix empty Contacts view in TUI Texts mode (DuckDB OOM)#361
Open
bjabes wants to merge 1 commit into
Open
query: fix empty Contacts view in TUI Texts mode (DuckDB OOM)#361bjabes wants to merge 1 commit into
bjabes wants to merge 1 commit into
Conversation
The DuckDB text Contacts/Contact-Names aggregates resolved the sending participant with a correlated scalar subquery embedded in the JOIN ON clause. DuckDB cannot push the message_type filter through a correlated join, so it evaluated the subquery across the entire email-dominated messages dataset and exhausted temp memory — surfacing as an empty/error Contacts view in the TUI (SQLite mode was unaffected). Resolve the 'from' participant via an uncorrelated derived table joined on message_id instead, preserving COALESCE(sender_id, from-recipient) semantics. Against a real ~1M-row text cache this drops from OOM to ~150ms. Add the first DuckDB TextAggregate coverage (Contacts + Contact-Names), extending the test fixture builder with MessageType/SenderID so text messages can be modeled. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
roborev: PassNo issues found. Review type: | Agent: codex | Job: 19264 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The TUI's Texts-mode Contacts and Contact Names aggregate views came up empty because the DuckDB engine resolved each message's sender with a correlated scalar subquery inside the JOIN ON clause, which DuckDB couldn't push the message-type filter through — so it scanned the entire email-dominated messages dataset and exhausted memory. This rewrites the join to resolve the 'from' participant via an uncorrelated derived table while preserving the COALESCE(sender_id, from-recipient) semantics; against a ~1M-row text cache it drops from OOM to ~150ms. SQLite mode was already unaffected. Also adds the first DuckDB
TextAggregatetest coverage (Contacts + Contact Names), extending the fixture builder with MessageType/SenderID so text messages can be modeled.