pub struct PreprocessingPipeline { /* private fields */ }Expand description
The main preprocessing pipeline
Orchestrates the application of multiple AST transformers in sequence. Provides logging, debugging, and statistics collection.
§Example
ⓘ
use sql_cli::query_plan::{PreprocessingPipeline, PipelineConfig};
use sql_cli::query_plan::{CTEHoister, ExpressionLifter};
let mut pipeline = PreprocessingPipeline::new(PipelineConfig::default());
pipeline.add_transformer(Box::new(CTEHoister::new()));
pipeline.add_transformer(Box::new(ExpressionLifter::new()));
let transformed = pipeline.process(statement)?;Implementations§
Source§impl PreprocessingPipeline
impl PreprocessingPipeline
Sourcepub fn new(config: PipelineConfig) -> Self
pub fn new(config: PipelineConfig) -> Self
Create a new empty pipeline with the given configuration
Sourcepub fn add_transformer(&mut self, transformer: Box<dyn ASTTransformer>)
pub fn add_transformer(&mut self, transformer: Box<dyn ASTTransformer>)
Add a transformer to the pipeline
Transformers are applied in the order they are added.
Sourcepub fn stats(&self) -> &PreprocessingStats
pub fn stats(&self) -> &PreprocessingStats
Get the collected statistics
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Reset statistics
Sourcepub fn process(&mut self, stmt: SelectStatement) -> Result<SelectStatement>
pub fn process(&mut self, stmt: SelectStatement) -> Result<SelectStatement>
Process a SQL statement through the pipeline
Applies each enabled transformer in sequence, collecting statistics and logging as configured.
Sourcepub fn transformer_summary(&self) -> String
pub fn transformer_summary(&self) -> String
Get a summary of what transformers are in the pipeline
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PreprocessingPipeline
impl !RefUnwindSafe for PreprocessingPipeline
impl Send for PreprocessingPipeline
impl Sync for PreprocessingPipeline
impl Unpin for PreprocessingPipeline
impl !UnwindSafe for PreprocessingPipeline
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