pub struct ParallelSqlParser { /* private fields */ }Expand description
Parallel SQL parser for batch processing
Implementations§
Source§impl ParallelSqlParser
impl ParallelSqlParser
Sourcepub fn with_thread_pool(thread_pool: Arc<ThreadPool>) -> Self
pub fn with_thread_pool(thread_pool: Arc<ThreadPool>) -> Self
Create a new parallel SQL parser with a custom thread pool
Sourcepub fn parse_batch(&self, sqls: &[&str]) -> DbxResult<Vec<Vec<Statement>>>
pub fn parse_batch(&self, sqls: &[&str]) -> DbxResult<Vec<Vec<Statement>>>
Parse multiple SQL strings in parallel with optimized scheduling
Applies three optimization layers:
- Dynamic thread pool: adjusts parallelism based on workload complexity
- Adaptive batch splitting: distributes work by estimated query complexity
- Lock-free result collection: pre-allocated indexed output
§Arguments
sqls- A slice of SQL strings to parse
§Example
use dbx_core::sql::parallel_parser::ParallelSqlParser;
let parser = ParallelSqlParser::new();
let sqls = vec![
"SELECT * FROM users",
"SELECT * FROM orders",
"SELECT * FROM products",
];
let results = parser.parse_batch(&sqls).unwrap();
assert_eq!(results.len(), 3);Sourcepub fn parse_batch_partial(
&self,
sqls: &[&str],
) -> (Vec<Vec<Statement>>, Vec<(usize, DbxError)>)
pub fn parse_batch_partial( &self, sqls: &[&str], ) -> (Vec<Vec<Statement>>, Vec<(usize, DbxError)>)
Parse multiple SQL strings in parallel, collecting only successful results
Returns a vector of successful parse results and a vector of errors. This is useful when you want to continue processing even if some SQL strings fail.
§Arguments
sqls- A slice of SQL strings to parse
§Returns
A tuple of (successful_results, errors)
Sourcepub fn parse_batch_with_callback<F>(
&self,
sqls: &[&str],
callback: F,
) -> DbxResult<()>
pub fn parse_batch_with_callback<F>( &self, sqls: &[&str], callback: F, ) -> DbxResult<()>
Parse multiple SQL strings and execute a callback for each result
This is useful for streaming processing where you want to handle each result as it becomes available.
§Arguments
sqls- A slice of SQL strings to parsecallback- A function to call for each parse result
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParallelSqlParser
impl !RefUnwindSafe for ParallelSqlParser
impl Send for ParallelSqlParser
impl Sync for ParallelSqlParser
impl Unpin for ParallelSqlParser
impl UnsafeUnpin for ParallelSqlParser
impl !UnwindSafe for ParallelSqlParser
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
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>
Converts
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>
Converts
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