pub struct OpenSearchTableProvider { /* private fields */ }Expand description
A DataFusion table backed by one OpenSearch index.
Implementations§
Source§impl OpenSearchTableProvider
impl OpenSearchTableProvider
Sourcepub fn new(
base_url: impl Into<String>,
index: impl Into<String>,
schema: SchemaRef,
) -> Self
pub fn new( base_url: impl Into<String>, index: impl Into<String>, schema: SchemaRef, ) -> Self
base_url e.g. http://localhost:9200; index e.g. my-index; schema declares the
columns (and Arrow types) to read from each hit’s _source. Supported column types:
Utf8, Int64, Float64, Boolean, Timestamp(Millisecond, _) (see
crate::schema::build_batch).
Sourcepub fn with_client_and_schema(
client: OpenSearchClient,
index: impl Into<String>,
schema: SchemaRef,
) -> Self
pub fn with_client_and_schema( client: OpenSearchClient, index: impl Into<String>, schema: SchemaRef, ) -> Self
Build over an existing OpenSearchClient (shared connection pool / auth / TLS).
Sourcepub fn with_sort(self, sort: Vec<(String, bool)>) -> Self
pub fn with_sort(self, sort: Vec<(String, bool)>) -> Self
Push a sort into _search — (field, ascending) pairs. Required for stable pagination
(and for a LIMIT to mean “top-N by this order” rather than an arbitrary N).
Sourcepub fn with_search_after(self, after: Vec<Value>) -> Self
pub fn with_search_after(self, after: Vec<Value>) -> Self
Continue after a prior page: OpenSearch search_after values, aligned with with_sort.
A scan then reads exactly one page (of the LIMIT, or the page size) — the loop is yours.
Sourcepub fn with_page_size(self, n: usize) -> Self
pub fn with_page_size(self, n: usize) -> Self
Hits per _search page while streaming a result (default DEFAULT_PAGE_SIZE).
Sourcepub fn with_max_rows(self, n: Option<usize>) -> Self
pub fn with_max_rows(self, n: Option<usize>) -> Self
Cap the rows a LIMIT-less scan returns. By default a scan streams the whole result.
Sourcepub fn with_partitions(self, n: usize) -> Self
pub fn with_partitions(self, n: usize) -> Self
Read the index through n DataFusion partitions in parallel, each an OpenSearch sliced
scroll (slice: { id, max }). Worthwhile for large scans on multi-shard indices; a query
with a LIMIT always uses one partition so the limit is exact. Default 1.
Sourcepub fn with_base_filter(self, clauses: Vec<Value>) -> Self
pub fn with_base_filter(self, clauses: Vec<Value>) -> Self
Add query-DSL clauses that are ANDed into the bool.filter of EVERY scan, on top of any
pushed-down WHERE. Use this for constraints the caller must never opt out of — e.g. a
row-level security predicate, a tenancy filter, or a soft-delete flag. The clauses are
opaque OpenSearch DSL (serde_json::Value), so this crate stays agnostic to what they express.
Sourcepub fn with_client(self, http: Client) -> Self
pub fn with_client(self, http: Client) -> Self
Supply a preconfigured reqwest client (timeouts, connection pool, TLS roots, headers).
Sourcepub fn search_body(&self, projected: &SchemaRef, filters: &[Expr]) -> Value
pub fn search_body(&self, projected: &SchemaRef, filters: &[Expr]) -> Value
The _search body (without size) a scan with these filters and this projection sends.
Exposed so callers can see exactly what was pushed down.
Trait Implementations§
Source§impl Debug for OpenSearchTableProvider
impl Debug for OpenSearchTableProvider
Source§impl TableProvider for OpenSearchTableProvider
impl TableProvider for OpenSearchTableProvider
Source§fn supports_filters_pushdown(
&self,
filters: &[&Expr],
) -> DataFusionResult<Vec<TableProviderFilterPushDown>>
fn supports_filters_pushdown( &self, filters: &[&Expr], ) -> DataFusionResult<Vec<TableProviderFilterPushDown>>
Report Exact for filters pushdown::expr_to_query can translate (DataFusion drops its
Filter node), Unsupported for the rest (DataFusion keeps filtering them). Same predicate
as scan uses, so the two never disagree.
Source§fn table_type(&self) -> TableType
fn table_type(&self) -> TableType
Source§fn scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
projection: Option<&'life2 Vec<usize>>,
filters: &'life3 [Expr],
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = DataFusionResult<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
projection: Option<&'life2 Vec<usize>>,
filters: &'life3 [Expr],
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = DataFusionResult<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
ExecutionPlan for scanning the table with optional
projection, filter, and limit, described below. Read moreSource§fn constraints(&self) -> Option<&Constraints>
fn constraints(&self) -> Option<&Constraints>
Source§fn get_table_definition(&self) -> Option<&str>
fn get_table_definition(&self) -> Option<&str>
Source§fn get_logical_plan(&self) -> Option<Cow<'_, LogicalPlan>>
fn get_logical_plan(&self) -> Option<Cow<'_, LogicalPlan>>
LogicalPlan of this table, if available.Source§fn get_column_default(&self, _column: &str) -> Option<&Expr>
fn get_column_default(&self, _column: &str) -> Option<&Expr>
Source§fn scan_with_args<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 dyn Session,
args: ScanArgs<'a>,
) -> Pin<Box<dyn Future<Output = Result<ScanResult, DataFusionError>> + Send + 'async_trait>>where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn scan_with_args<'a, 'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 dyn Session,
args: ScanArgs<'a>,
) -> Pin<Box<dyn Future<Output = Result<ScanResult, DataFusionError>> + Send + 'async_trait>>where
'a: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
ExecutionPlan for scanning the table using structured arguments. Read moreSource§fn statistics(&self) -> Option<Statistics>
fn statistics(&self) -> Option<Statistics>
Source§fn insert_into<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_input: Arc<dyn ExecutionPlan>,
_insert_op: InsertOp,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn insert_into<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_input: Arc<dyn ExecutionPlan>,
_insert_op: InsertOp,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
ExecutionPlan to insert data into this table, if
supported. Read moreSource§fn delete_from<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_filters: Vec<Expr>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_from<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_filters: Vec<Expr>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Source§fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_assignments: Vec<(String, Expr)>,
_filters: Vec<Expr>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
_assignments: Vec<(String, Expr)>,
_filters: Vec<Expr>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Source§fn truncate<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn truncate<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>, DataFusionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for OpenSearchTableProvider
impl !UnwindSafe for OpenSearchTableProvider
impl Freeze for OpenSearchTableProvider
impl Send for OpenSearchTableProvider
impl Sync for OpenSearchTableProvider
impl Unpin for OpenSearchTableProvider
impl UnsafeUnpin for OpenSearchTableProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more