pub struct QueryExecutor { /* private fields */ }Expand description
Query executor for parsed SQL queries
Implementations§
Source§impl QueryExecutor
impl QueryExecutor
Sourcepub const fn with_backend(backend: Backend) -> Self
pub const fn with_backend(backend: Backend) -> Self
Create executor with forced backend
Sourcepub fn execute(
&self,
plan: &QueryPlan,
storage: &StorageEngine,
) -> Result<RecordBatch>
pub fn execute( &self, plan: &QueryPlan, storage: &StorageEngine, ) -> Result<RecordBatch>
Execute a query plan against storage
§Arguments
plan- Parsed query plan fromQueryEngine::parse()storage- Storage engine containing the data
§Returns
Result record batch with query results
§Errors
Returns error if:
- Table not found in storage
- Column not found in schema
- Data type mismatch
- Backend execution failure
§Example
use trueno_db::query::{QueryEngine, QueryExecutor};
use trueno_db::storage::StorageEngine;
let storage = StorageEngine::load_parquet("data/events.parquet")?;
let engine = QueryEngine::new();
let executor = QueryExecutor::new();
let plan = engine.parse("SELECT category, SUM(value) FROM events GROUP BY category")?;
let result = executor.execute(&plan, &storage)?;
println!("Results: {} rows", result.num_rows());Trait Implementations§
Auto Trait Implementations§
impl Freeze for QueryExecutor
impl RefUnwindSafe for QueryExecutor
impl Send for QueryExecutor
impl Sync for QueryExecutor
impl Unpin for QueryExecutor
impl UnsafeUnpin for QueryExecutor
impl UnwindSafe for QueryExecutor
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
Mutably borrows from an owned value. Read more