feat(common-utils): apply direct_read KV items optimization to SQL filters#2405
Conversation
…lters
SQL `type: 'sql'` filters on Map columns now get the same has()/hasAny()
rewrite that Lucene filters already use when a KV items column with a
text(tokenizer=array) skip index exists.
- Map['k'] = 'v' → has(Items, concat('k', '=', 'v'))
- Map['k'] IN ('a','b') → hasAny(Items, array(concat(...), ...))
Extracts buildKvItemsLookup from CustomSchemaSQLSerializerV2 into a
shared export. Removes debug console.log('AVK filter').
🦋 Changeset detectedLatest commit: 15b35ce The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
E2E Test Results✅ All tests passed • 194 passed • 3 skipped • 1314s
Tests ran across 4 shards in parallel. |
Deep Review✅ No critical issues found. No P0/P1 ship-blockers: the change is well-tested, falls back safely to valid (if unoptimized) SQL on any parse failure, and reaches parity with the existing Lucene rewrite. The recommendations below center on one new broad round-trip path, escaping/encoding edges, and release hygiene. 🟡 P2 -- recommended
🔵 P3 nitpicks (8)
Reviewers (9): correctness, security, adversarial, performance, reliability, kieran-typescript, testing, maintainability, project-standards. Testing gaps:
Note on a dropped finding: Two reviewers flagged a "duplicate |
Summary
SQL
type: 'sql'filters on Map columns now get the same has()/hasAny() rewrite that Lucene filters already use when a KV items column with a text(tokenizer=array) skip index exists.Extracts buildKvItemsLookup from CustomSchemaSQLSerializerV2 into a shared export. Removes debug console.log('AVK filter').
References
This accomplishes the
direct_readoptimization for filters instead of the approach reverted by #2401