Module Source.Pred
Predicates on one row: the filters that sources apply.
A predicate compares columns of the source against values. It means what its filter means in talon: a comparison uses talon's total order (Type.compare_value) and is null when the column's value is null, and Pred.t.Not, Pred.t.And and Pred.t.Or are Kleene's, so a row passes a predicate iff the predicate is true on it. A source answers Exact only for a predicate whose meaning it honours entirely: for example, a float column's minimum and maximum prune a row group only when the source knows the group holds no NaN, since NaN passes >, >= and <>.
type value = - #
| Value : 'a Type.t * 'a -> value(*The type for values.
*)Value (ty, v)isvat the typetythat the comparison is made in, which holdsv(Type.holds). It is the column's type, or a type that contains it (Type.common), such asstringfor a categorical column, which then compares by text rather than by dictionary position. For an extension column it is the storage type, andvis the value's storage.vis a value oftyexactly, astystores it: afloat32value is rounded tofloat32.
type t = - #
| Cmp of string * [ `Eq | `Ne | `Lt | `Le | `Gt | `Ge ] * value(*
*)Cmp (c, op, v)compares the columnctovwithop:`Eqis=,`Neis<>,`Ltis<,`Leis<=,`Gtis>and`Geis>=. It is null wherecis null. - #
| In of string * value list(*
*)In (c, vs)istrueiff the columncis the same key as one ofvs, which have one type, andfalseelsewhere, nullcincluded.In (c, [])isfalse. - #
| Null of string(*
*)Null cistrueiff the columncis null. - #
| Valid of string(*
*)Valid cistrueiff the columncis not null. - #
| And of t list(*
*)And psisfalseif one ofpsis, else null if one is null, elsetrue.And []istrue. - #
| Or of t list(*
*)Or psistrueif one ofpsis, else null if one is null, elsefalse.Or []isfalse. - #
| Not of t(*
*)Not pis the negation ofp, null wherepis.
The type for predicates.
filter s p is the filter that p is over a table of the columns s describes: it is true, false or null where p is, so Query.filter of it keeps the rows that pass p. A source that answers Exact can apply a conjunct with it, on each batch it reads. It is None if p names a column that s lacks, or one whose type is or contains an extension type, which a filter reads only with its declaration (Ext.col).