httk.store.mongo.evaluator

Exact three-valued evaluation for Mongo stored-property predicates.

The Mongo query path deliberately evaluates this small, frozen AST over hydrated records. That is important for child records: document storage keeps their content-addressed SID links, while MongoStore.fetch gives the evaluator their exact Python values.

Classes

MongoScope

A root, child, reference, or filtered record-object scope.

MongoValue

A field, aggregate, null, or literal value in the neutral AST.

MongoPredicate

A frozen three-valued predicate in the neutral stored-property AST.

Functions

evaluate(predicate, record)

Evaluate predicate exactly over a hydrated backing object.

canonical_predicate(predicate)

Return canonical JSON used as the verifier identity and cursor input.

Module Contents

class httk.store.mongo.evaluator.MongoScope[source]

A root, child, reference, or filtered record-object scope.

identifier: int[source]
schema: httk.store.db.schema.TableSchema[source]
parent: MongoScope | None = None[source]
relationship: httk.store.db.schema.FieldSpec | None = None[source]
filter_predicate: MongoPredicate | None = None[source]
scalar_child: bool = False[source]
context: Any = None[source]
field(name)[source]

Select a scalar field from this scope.

scope(name)[source]

Follow one child or reference relationship from this scope.

class httk.store.mongo.evaluator.MongoValue[source]

A field, aggregate, null, or literal value in the neutral AST.

kind: Literal['field', 'present', 'constant', 'null', 'count', 'distinct_count'][source]
scope: MongoScope | None = None[source]
field: str | None = None[source]
spec: httk.store.db.schema.FieldSpec | None = None[source]
literal: object[source]
value: MongoValue | None = None[source]
class httk.store.mongo.evaluator.MongoPredicate[source]

A frozen three-valued predicate in the neutral stored-property AST.

kind: Literal['constant', 'compare', 'is_null', 'exists', 'and', 'or', 'not', 'when_known', 'scaled'][source]
operands: tuple[object, Ellipsis] = ()[source]
httk.store.mongo.evaluator.evaluate(predicate, record)[source]

Evaluate predicate exactly over a hydrated backing object.

Parameters:
  • predicate (MongoPredicate) – Frozen predicate produced by _MongoQueryContext.

  • record (object) – Hydrated backing record for the candidate SID.

Returns:

True, False, or None for SQL UNKNOWN.

Return type:

bool | None

httk.store.mongo.evaluator.canonical_predicate(predicate)[source]

Return canonical JSON used as the verifier identity and cursor input.