Struct lance_index::scalar::expression::IndexedExpression
source · pub struct IndexedExpression {
pub scalar_query: Option<ScalarIndexExpr>,
pub refine_expr: Option<Expr>,
}Expand description
An indexed expression consists of a scalar index query with a post-scan filter
When a user wants to filter the data returned by a scan we may be able to use one or more scalar indices to reduce the amount of data we load from the disk.
For example, if a user provides the filter “x = 7”, and we have a scalar index on x, then we can possibly identify the exact row that the user desires with our index. A full-table scan can then turn into a take operation fetching the rows desired. This would create an IndexedExpression with a scalar_query but no refine.
If the user asked for “type = ‘dog’ && z = 3” and we had a scalar index on the “type” column then we could convert this to an indexed scan for “type=‘dog’” followed by an in-memory filter for z=3. This would create an IndexedExpression with both a scalar_query AND a refine.
Finally, if the user asked for “z = 3” and we do not have a scalar index on the “z” column then we must fallback to an IndexedExpression with no scalar_query and only a refine.
Two IndexedExpressions can be AND’d together. Each part is AND’d together. Two IndexedExpressions cannot be OR’d together unless both are scalar_query only or both are refine only An IndexedExpression cannot be negated if it has both a refine and a scalar_query
When an operation cannot be performed we fallback to the original expression-only representation
Fields§
§scalar_query: Option<ScalarIndexExpr>The portion of the query that can be satisfied by scalar indices
refine_expr: Option<Expr>The portion of the query that cannot be satisfied by scalar indices
Trait Implementations§
source§impl Debug for IndexedExpression
impl Debug for IndexedExpression
source§impl PartialEq for IndexedExpression
impl PartialEq for IndexedExpression
source§fn eq(&self, other: &IndexedExpression) -> bool
fn eq(&self, other: &IndexedExpression) -> bool
self and other values to be equal, and is used
by ==.