Package com.apple.foundationdb.record.query.plan.temp.view
ViewExpression
abstraction.
A view expression is an abstraction that represents a stream of values that can be represented as tuple-encoded keys
and binary values in FoundationDB. View expressions are quite general and can represent a large variety of index
structures and even queries. However, because they are defined by their close relationship to the FDB
tuple layer encoding, they are extremely useful for many query planning operations, such as incremental index
selection (for example, see PushElementWithComparisonIntoExistingScanRule
).
Semantically, a view expression can be read much like a query in a declarative query language like SQL. For example,
it can specify a projection, sort order, and filter predicate. When used to represent the structure of an index,
a view expression can be interpreted as a query for which the index acts as a materialized view.
ViewExpression
describes the specific semantics in further
detail.
The two key abstractions that are used for defining view expressions are Source
s
and Element
s. A source represents a stream of entities
that can be manipulated to form a view expression, while an element defines the mapping from one entry in a source's
stream to a value that can be represented as part of a tuple. For example, the
RecordTypeSource
represents a stream of records with
types from a specified set of record types. A FieldElement
produces values from a field of each entry in a stream of records.
During query planning with the Cascades-style planner
,
Comparisons.Comparison
s are matched to elements of a view
expression. The state and logic for determining which comparisons can be matched to a (partially matched) view
expression is encapsulated in the ViewExpressionComparisons
class.
-
Interface Summary Interface Description Element A value in theViewExpression
language that can be represented as an element of FoundationDB tuple. -
Class Summary Class Description FieldElement An element that extracts a single, non-repeated field (at an arbitrary nesting depth) from a source.LiteralElement<T> A value representing a single, static value of typeT
.MessageValue A utility class for extracting data and meta-data from Protocol BufferMessage
s, as used in the Record Layer.RecordTypeElement An element representing the record type of each entry generated by the source.RecordTypeSource ASource
representing the stream of all records of a particular type or types.RepeatedFieldSource ASource
representing the stream of the zero or more values of a repeated field.Source A source represents a stream of entities that can be used to generateElement
s, such as records or field values.SourceEntry A single entity produced by a source from a record, mapping each (inclusive) dependant source to a concrete value.ValueElement AnElement
representing an entire value, such as a scalar or message, obtained from a source.VersionElement AnElement
representing a serialized versionstamp in a query or index entry.ViewExpression An abstraction that represents a stream of values that can be represented as tuple-encoding keys and binary values in FoundationDB.ViewExpression.Builder A builder class for constructing an (immutable) view expression.ViewExpressionComparisons A data structure that represents aViewExpression
with aComparisonRange
on some of theElement
s in its sort order.