← All topics

Filtering & Querying · Topic 144

How to handle “Null” metadata values

Points in a collection may have null, missing, or optional metadata fields. Filtering (“where field = X”) must define whether null is equal to nothing, excluded from the index, or matched explicitly (e.g. “IS NULL”). This affects bitset construction for pre-filtering, index design for optional attributes, and query semantics so users get consistent results when some payloads are sparse or schemaless.

Summary

  • Points may have null, missing, or optional metadata. Filtering must define whether null is excluded, matched explicitly (e.g. “IS NULL”), or treated in three-valued logic. Affects bitset construction for pre-filtering and query semantics for sparse or schemaless payloads.
  • VDBs differ in how they represent null; AND/OR/NOT with nulls and index design for optional attributes vary. Consistent semantics ensure users get predictable results. Pipeline: evaluate filter per point, map unknown to in/out of bitset. Practical tip: document null semantics; use IS NULL when you need to find sparse attributes.

Null semantics and indexing

Points may have null, missing, or optional metadata fields. Filtering must define whether null is equal to nothing, excluded from the index, or matched explicitly (e.g. IS NULL). Different VDBs represent null differently; some support IS NULL or IS MISSING, others treat missing as excluded from equality filters. Three-valued logic (true, false, unknown) affects AND/OR/NOT: e.g. (field = X AND field IS NULL) typically yields no rows, but (field = X OR field IS NULL) can match both.

Pipeline: evaluate filter per point → true/false/unknown → map unknown to included or excluded in bitset for pre-filtering. Trade-off: including unknown in the bitset can over-fetch; excluding can miss intended null matches. Practical tip: document your null semantics for queries; use IS NULL when you need to find sparse or optional attributes.

Bitsets and optional attributes

For bitset construction, each point evaluates to in-set or out-of-set. How unknown (null) is mapped affects which points are considered during index traversal. Some VDBs index only non-null values; others keep a separate null bitmap. Index design for optional attributes affects performance and filter semantics. See metadata filtering basics and in-bitmap filtering for how bitsets combine with vector search.

Frequently Asked Questions

How do I filter on null or missing metadata?

Define semantics: is null equal to nothing, excluded from the index, or matched explicitly (e.g. IS NULL)? This affects bitset construction for pre-filtering and ensures consistent results for sparse or schemaless payloads.

Do VDBs support IS NULL?

Support varies. Some support field IS NULL or field IS MISSING; others treat missing as excluded. Check your engine for three-valued logic and AND/OR/NOT with nulls.

How does null affect bitsets for pre-filtering?

For each point, the filter evaluates to true/false/unknown. How unknown maps to the bitset (included vs. excluded) affects which points are considered during traversal. Document your choice for query semantics.

What about optional attributes in the schema?

Index design for optional attributes: some VDBs index only non-null values; others keep a separate null bitmap. Affects performance and filter semantics. See metadata filtering basics.