Commit 467b416
authored
Feat/RAAE-1377/add-is-null-is-not-null-support (#13)
* feat: add IS NULL / IS NOT NULL support via RediSearch ismissing()
Translate SQL IS NULL and IS NOT NULL to RediSearch ismissing(@field)
and -ismissing(@field) respectively. Requires Redis 7.4+ with the
INDEXMISSING attribute declared on the target field.
Changes:
- parser: handle sqlglot exp.Is nodes, emit IS_NULL / IS_NOT_NULL operators
- query_builder: add build_missing_condition() for ismissing() syntax
- translator: short-circuit IS_NULL/IS_NOT_NULL before field-type dispatch
- translator: make DIALECT 2 the default for all FT.SEARCH and FT.AGGREGATE
- executor: catch and re-raise ResponseError with clear version guidance
when ismissing() fails (both sync and async paths)
- translator: emit UserWarning on IS NULL/IS NOT NULL noting Redis 7.4+
and INDEXMISSING requirements
Tests:
- 18 integration tests against Redis 8 (TAG, TEXT, NUMERIC field types,
combined conditions, edge cases, raw command verification)
- Unit tests for parser, query_builder, and translator
- Warning and error message verification tests
* chore: linter
* fix: changes based on pr review
- Changed to "ismissing(@" in both sync and async executor
- Changed to negated=not negated to support double negation
- Parameter test Now asserts on _substitute_params() output deterministically + verifies at least one value executes
- Renamed to test_is_not_null_on_indexmissing_field_returns_present_docs with accurate docstring
- AsyncExecutor catches broad Exception, Changed to catch redis.ResponseError directly (confirmed it's the same class in both sync/async)
* fix: changes based on pr review
- Changed to "ismissing(@" in both sync and async executor
- Changed to negated=not negated to support double negation
- Parameter test Now asserts on _substitute_params() output deterministically + verifies at least one value executes
- Renamed to test_is_not_null_on_indexmissing_field_returns_present_docs with accurate docstring
- AsyncExecutor catches broad Exception, Changed to catch redis.ResponseError directly (confirmed it's the same class in both sync/async)
* fix: pr comments
Executor error re-wrap narrowed (sync + async) — now only augments the error when the server message contains known signatures ("Unknown function", "No such function", "Syntax error", "INDEXMISSING"). Unrelated errors (auth, OOM, unknown index) pass through untouched.
Parser exp.Is else branch — raises ValueError for unsupported IS variants (e.g., IS TRUE, IS DISTINCT FROM) instead of silently dropping the condition.1 parent e33c29a commit 467b416
9 files changed
Lines changed: 702 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
144 | 163 | | |
145 | 164 | | |
146 | 165 | | |
| |||
207 | 226 | | |
208 | 227 | | |
209 | 228 | | |
210 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
211 | 249 | | |
212 | 250 | | |
213 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
645 | 667 | | |
646 | 668 | | |
647 | 669 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
173 | 186 | | |
174 | 187 | | |
175 | 188 | | |
| |||
257 | 270 | | |
258 | 271 | | |
259 | 272 | | |
260 | | - | |
261 | | - | |
262 | 273 | | |
263 | 274 | | |
264 | 275 | | |
| |||
288 | 299 | | |
289 | 300 | | |
290 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
291 | 305 | | |
292 | 306 | | |
293 | 307 | | |
| |||
496 | 510 | | |
497 | 511 | | |
498 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
499 | 516 | | |
500 | 517 | | |
501 | 518 | | |
| |||
0 commit comments