How the filter language treated missing fields, null, types and patterns before duql
FactVerified 27 Sep 2026Holds project: dftracer-utils
Fact. A statement and the evidence for it.
Statement#
This is the behaviour before duql. Stage 12a2a (duql-three-valued, commit c72dc296) replaced the missing and null rules: a comparison on a missing or null field is UNKNOWN, a filter keeps only TRUE, an empty string is a value, and the args. fallback applies only when the name is absent, not when it is null (see the null filler pitfall).
Read from src/dftracer/utils/query/evaluator.cpp, parser.cpp, include/dftracer/utils/query/pattern.h and src/dftracer/utils/trace/views/fold.cpp on 2026-09-27, before the duql work:
- A comparison on a missing field is false, for every operator:
field_holdsreturns!fv.is_null() && holds(fv). Sox != 5andx not in [...]already exclude records withoutx; onlynot (x == 5)selects them. - A field that is present but
nullcounts as absent, andresolve_fieldthen falls back toargs.<name>:{"ret": null, "args": {"ret": 5}}matchesret == 5. - A type mismatch in
compare_valueisnullopt, so the comparison is false. - Every pattern goes through
std::regex(ECMAScript), includinglike,ilikeand the"text" in fieldsubstring test.liketurns%into.*, which does not match a newline, solike "%x%"misses multi-line strings. - The path catalog is per file (
IndexDatabase::catalog(file_id)), not per chunk.enumerate_leavesrecords only scalar and null leaves, so an empty object or array adds no path: a file wherexis only ever[]or{}has no catalog entry forx.
Use these facts when changing query semantics or pruning: a rule "skip when the catalog lacks the path" is wrong for exists(x) on empty containers and for chunk-level decisions.
Evidence#
- The duql design audit (
docs/plans/2026-09-27-duql.md, Compatibility section) relied on these; the first draft wrongly claimed today'sx != vselects missing records.
Also found by searching
- old filter query on missing field behaved differently before duql, comparisons with null
- I need the legacy query language semantics for missing fields, null and patterns
- how did the pre-duql filter language evaluate missing or null fields and args fallback
- evaluator.cpp parser.cpp pattern.h old rules vs duql three-valued logic UNKNOWN empty string
- how did the old query filter treat null or missing fields before duql three-valued logic
- comparison on missing field in old evaluator.cpp, args fallback rules
- what did empty string and null mean in the pre-duql filter language
- legacy query pattern semantics, evaluator parser pattern.h behavior baseline for migration