Ray's Knowledge Base
Unlock

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_holds returns !fv.is_null() && holds(fv). So x != 5 and x not in [...] already exclude records without x; only not (x == 5) selects them.
  • A field that is present but null counts as absent, and resolve_field then falls back to args.<name>: {"ret": null, "args": {"ret": 5}} matches ret == 5.
  • A type mismatch in compare_value is nullopt, so the comparison is false.
  • Every pattern goes through std::regex (ECMAScript), including like, ilike and the "text" in field substring test. like turns % into .*, which does not match a newline, so like "%x%" misses multi-line strings.
  • The path catalog is per file (IndexDatabase::catalog(file_id)), not per chunk. enumerate_leaves records only scalar and null leaves, so an empty object or array adds no path: a file where x is only ever [] or {} has no catalog entry for x.

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's x != v selects 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