Skip to main content

DataSource

Trait DataSource 

Source
pub trait DataSource {
    // Required methods
    fn get_table_rows(&self, table: &str) -> ExecutionResult<Vec<Rc<Row>>>;
    fn get_index_range_with_limit(
        &self,
        table: &str,
        index: &str,
        range_start: Option<&Value>,
        range_end: Option<&Value>,
        include_start: bool,
        include_end: bool,
        limit: Option<usize>,
        offset: usize,
        reverse: bool,
    ) -> ExecutionResult<Vec<Rc<Row>>>;
    fn get_index_point(
        &self,
        table: &str,
        index: &str,
        key: &Value,
    ) -> ExecutionResult<Vec<Rc<Row>>>;
    fn get_column_count(&self, table: &str) -> ExecutionResult<usize>;

    // Provided methods
    fn get_index_range(
        &self,
        table: &str,
        index: &str,
        range_start: Option<&Value>,
        range_end: Option<&Value>,
        include_start: bool,
        include_end: bool,
    ) -> ExecutionResult<Vec<Rc<Row>>> { ... }
    fn get_index_point_with_limit(
        &self,
        table: &str,
        index: &str,
        key: &Value,
        limit: Option<usize>,
    ) -> ExecutionResult<Vec<Rc<Row>>> { ... }
    fn get_gin_index_rows(
        &self,
        table: &str,
        index: &str,
        key: &str,
        value: &str,
    ) -> ExecutionResult<Vec<Rc<Row>>> { ... }
    fn get_gin_index_rows_by_key(
        &self,
        table: &str,
        index: &str,
        key: &str,
    ) -> ExecutionResult<Vec<Rc<Row>>> { ... }
    fn get_gin_index_rows_multi(
        &self,
        table: &str,
        index: &str,
        pairs: &[(&str, &str)],
    ) -> ExecutionResult<Vec<Rc<Row>>> { ... }
}
Expand description

Data source trait for providing table and index data.

Implementations of this trait provide access to table rows and index lookups for the physical plan runner.

Required Methods§

Source

fn get_table_rows(&self, table: &str) -> ExecutionResult<Vec<Rc<Row>>>

Returns all rows from a table.

Source

fn get_index_range_with_limit( &self, table: &str, index: &str, range_start: Option<&Value>, range_end: Option<&Value>, include_start: bool, include_end: bool, limit: Option<usize>, offset: usize, reverse: bool, ) -> ExecutionResult<Vec<Rc<Row>>>

Returns rows from an index scan with a key range, limit, offset, and reverse option. This enables true pushdown of LIMIT to the storage layer.

Source

fn get_index_point( &self, table: &str, index: &str, key: &Value, ) -> ExecutionResult<Vec<Rc<Row>>>

Returns rows from an index point lookup.

Source

fn get_column_count(&self, table: &str) -> ExecutionResult<usize>

Returns the column count for a table.

Provided Methods§

Source

fn get_index_range( &self, table: &str, index: &str, range_start: Option<&Value>, range_end: Option<&Value>, include_start: bool, include_end: bool, ) -> ExecutionResult<Vec<Rc<Row>>>

Returns rows from an index scan with a key range.

Source

fn get_index_point_with_limit( &self, table: &str, index: &str, key: &Value, limit: Option<usize>, ) -> ExecutionResult<Vec<Rc<Row>>>

Returns rows from an index point lookup with limit.

Source

fn get_gin_index_rows( &self, table: &str, index: &str, key: &str, value: &str, ) -> ExecutionResult<Vec<Rc<Row>>>

Returns rows from a GIN index lookup by key-value pair. Used for JSONB path equality queries like $.category = 'Electronics'.

Source

fn get_gin_index_rows_by_key( &self, table: &str, index: &str, key: &str, ) -> ExecutionResult<Vec<Rc<Row>>>

Returns rows from a GIN index lookup by key existence. Used for JSONB key existence queries.

Source

fn get_gin_index_rows_multi( &self, table: &str, index: &str, pairs: &[(&str, &str)], ) -> ExecutionResult<Vec<Rc<Row>>>

Returns rows from a GIN index lookup by multiple key-value pairs (AND query). Used for combined JSONB path equality queries like $.category = 'A' AND $.status = 'active'.

Implementors§