Converts RQ AST into SqlRQ AST and applies a few preprocessing operations. Note that some SQL translation mechanisms depend on behavior of some of these functions (i.e. reorder).
(
pipeline: Vec<Transform>,
ctx: &mut Context,
)
| 20 | /// Note that some SQL translation mechanisms depend on behavior of some of these |
| 21 | /// functions (i.e. reorder). |
| 22 | pub(in crate::sql) fn preprocess( |
| 23 | pipeline: Vec<Transform>, |
| 24 | ctx: &mut Context, |
| 25 | ) -> Result<Vec<SqlTransform>> { |
| 26 | Ok(pipeline) |
| 27 | .and_then(normalize) |
| 28 | .and_then(|p| wrap(p, ctx)) |
| 29 | .and_then(|p| prune_inputs(p, ctx)) |
| 30 | .and_then(|p| distinct(p, ctx)) |
| 31 | .and_then(|p| union(p, ctx)) |
| 32 | .and_then(|p| except(p, ctx)) |
| 33 | .and_then(|p| intersect(p, ctx)) |
| 34 | .map(reorder) |
| 35 | .inspect(|p| { |
| 36 | debug::log_entry(|| debug::DebugEntryKind::ReprPqEarly(p.clone())); |
| 37 | }) |
| 38 | } |
| 39 | |
| 40 | // This function was disabled because it changes semantics of the pipeline in some cases. |
| 41 | // /// Pushes all [Transform::Select]s to the back of the pipeline. |