diff --git a/prqlc/bindings/prqlc-python/src/lib.rs b/prqlc/bindings/prqlc-python/src/lib.rs index b7e45ac1ae38..c8ecb101c93f 100644 --- a/prqlc/bindings/prqlc-python/src/lib.rs +++ b/prqlc/bindings/prqlc-python/src/lib.rs @@ -232,7 +232,7 @@ mod test { fn debug_prql_lineage() { assert_snapshot!( debug::prql_lineage(r#"from a | select { beta, gamma }"#).unwrap(), - @r#"{"frames":[["1:9-31",{"columns":[{"Single":{"name":["a","beta"],"target_id":120,"target_name":null}},{"Single":{"name":["a","gamma"],"target_id":121,"target_name":null}}],"inputs":[{"id":118,"name":"a","table":["default_db","a"]}]}]],"nodes":[{"id":118,"kind":"Ident","span":"1:0-6","ident":{"Ident":["default_db","a"]},"parent":123},{"id":120,"kind":"Ident","span":"1:18-22","ident":{"Ident":["this","a","beta"]},"targets":[118],"parent":122},{"id":121,"kind":"Ident","span":"1:24-29","ident":{"Ident":["this","a","gamma"]},"targets":[118],"parent":122},{"id":122,"kind":"Tuple","span":"1:16-31","children":[120,121],"parent":123},{"id":123,"kind":"TransformCall: Select","span":"1:9-31","children":[118,122]}],"ast":{"name":"Project","stmts":[{"VarDef":{"kind":"Main","name":"main","value":{"Pipeline":{"exprs":[{"FuncCall":{"name":{"Ident":["from"],"span":"1:0-4"},"args":[{"Ident":["a"],"span":"1:5-6"}]},"span":"1:0-6"},{"FuncCall":{"name":{"Ident":["select"],"span":"1:9-15"},"args":[{"Tuple":[{"Ident":["beta"],"span":"1:18-22"},{"Ident":["gamma"],"span":"1:24-29"}],"span":"1:16-31"}]},"span":"1:9-31"}]},"span":"1:0-31"}},"span":"1:0-31"}]}}"# + @r###"{"frames":[["1:9-31",{"columns":[{"Single":{"name":["a","beta"],"target_id":123,"target_name":null}},{"Single":{"name":["a","gamma"],"target_id":124,"target_name":null}}],"inputs":[{"id":121,"name":"a","table":["default_db","a"]}]}]],"nodes":[{"id":121,"kind":"Ident","span":"1:0-6","ident":{"Ident":["default_db","a"]},"parent":126},{"id":123,"kind":"Ident","span":"1:18-22","ident":{"Ident":["this","a","beta"]},"targets":[121],"parent":125},{"id":124,"kind":"Ident","span":"1:24-29","ident":{"Ident":["this","a","gamma"]},"targets":[121],"parent":125},{"id":125,"kind":"Tuple","span":"1:16-31","children":[123,124],"parent":126},{"id":126,"kind":"TransformCall: Select","span":"1:9-31","children":[121,125]}],"ast":{"name":"Project","stmts":[{"VarDef":{"kind":"Main","name":"main","value":{"Pipeline":{"exprs":[{"FuncCall":{"name":{"Ident":["from"],"span":"1:0-4"},"args":[{"Ident":["a"],"span":"1:5-6"}]},"span":"1:0-6"},{"FuncCall":{"name":{"Ident":["select"],"span":"1:9-15"},"args":[{"Tuple":[{"Ident":["beta"],"span":"1:18-22"},{"Ident":["gamma"],"span":"1:24-29"}],"span":"1:16-31"}]},"span":"1:9-31"}]},"span":"1:0-31"}},"span":"1:0-31"}]}}"### ); } @@ -240,7 +240,7 @@ mod test { fn debug_pl_to_lineage() { assert_snapshot!( prql_to_pl(r#"from a | select { beta, gamma }"#).and_then(|x| debug::pl_to_lineage(&x)).unwrap(), - @r#"{"frames":[["1:9-31",{"columns":[{"Single":{"name":["a","beta"],"target_id":120,"target_name":null}},{"Single":{"name":["a","gamma"],"target_id":121,"target_name":null}}],"inputs":[{"id":118,"name":"a","table":["default_db","a"]}]}]],"nodes":[{"id":118,"kind":"Ident","span":"1:0-6","ident":{"Ident":["default_db","a"]},"parent":123},{"id":120,"kind":"Ident","span":"1:18-22","ident":{"Ident":["this","a","beta"]},"targets":[118],"parent":122},{"id":121,"kind":"Ident","span":"1:24-29","ident":{"Ident":["this","a","gamma"]},"targets":[118],"parent":122},{"id":122,"kind":"Tuple","span":"1:16-31","children":[120,121],"parent":123},{"id":123,"kind":"TransformCall: Select","span":"1:9-31","children":[118,122]}],"ast":{"name":"Project","stmts":[{"VarDef":{"kind":"Main","name":"main","value":{"Pipeline":{"exprs":[{"FuncCall":{"name":{"Ident":["from"],"span":"1:0-4"},"args":[{"Ident":["a"],"span":"1:5-6"}]},"span":"1:0-6"},{"FuncCall":{"name":{"Ident":["select"],"span":"1:9-15"},"args":[{"Tuple":[{"Ident":["beta"],"span":"1:18-22"},{"Ident":["gamma"],"span":"1:24-29"}],"span":"1:16-31"}]},"span":"1:9-31"}]},"span":"1:0-31"}},"span":"1:0-31"}]}}"# + @r###"{"frames":[["1:9-31",{"columns":[{"Single":{"name":["a","beta"],"target_id":123,"target_name":null}},{"Single":{"name":["a","gamma"],"target_id":124,"target_name":null}}],"inputs":[{"id":121,"name":"a","table":["default_db","a"]}]}]],"nodes":[{"id":121,"kind":"Ident","span":"1:0-6","ident":{"Ident":["default_db","a"]},"parent":126},{"id":123,"kind":"Ident","span":"1:18-22","ident":{"Ident":["this","a","beta"]},"targets":[121],"parent":125},{"id":124,"kind":"Ident","span":"1:24-29","ident":{"Ident":["this","a","gamma"]},"targets":[121],"parent":125},{"id":125,"kind":"Tuple","span":"1:16-31","children":[123,124],"parent":126},{"id":126,"kind":"TransformCall: Select","span":"1:9-31","children":[121,125]}],"ast":{"name":"Project","stmts":[{"VarDef":{"kind":"Main","name":"main","value":{"Pipeline":{"exprs":[{"FuncCall":{"name":{"Ident":["from"],"span":"1:0-4"},"args":[{"Ident":["a"],"span":"1:5-6"}]},"span":"1:0-6"},{"FuncCall":{"name":{"Ident":["select"],"span":"1:9-15"},"args":[{"Tuple":[{"Ident":["beta"],"span":"1:18-22"},{"Ident":["gamma"],"span":"1:24-29"}],"span":"1:16-31"}]},"span":"1:9-31"}]},"span":"1:0-31"}},"span":"1:0-31"}]}}"### ); } } diff --git a/prqlc/prqlc/src/cli/test.rs b/prqlc/prqlc/src/cli/test.rs index 0e2fcbb09104..0e5c717fb80f 100644 --- a/prqlc/prqlc/src/cli/test.rs +++ b/prqlc/prqlc/src/cli/test.rs @@ -424,7 +424,7 @@ fn compare_directories(dir1: &Path, dir2: &Path) { fn debug() { assert_cmd_snapshot!(prqlc_command() .args(["debug", "lineage"]) - .pass_stdin("from tracks | select {artist, album}"), @" + .pass_stdin("from tracks | select {artist, album}"), @r###" success: true exit_code: 0 ----- stdout ----- @@ -435,29 +435,29 @@ fn debug() { name: - tracks - artist - target_id: 120 + target_id: 123 target_name: null - !Single name: - tracks - album - target_id: 121 + target_id: 124 target_name: null inputs: - - id: 118 + - id: 121 name: tracks table: - default_db - tracks nodes: - - id: 118 + - id: 121 kind: Ident span: 1:0-11 ident: !Ident - default_db - tracks - parent: 123 - - id: 120 + parent: 126 + - id: 123 kind: Ident span: 1:22-28 ident: !Ident @@ -465,9 +465,9 @@ fn debug() { - tracks - artist targets: - - 118 - parent: 122 - - id: 121 + - 121 + parent: 125 + - id: 124 kind: Ident span: 1:30-35 ident: !Ident @@ -475,21 +475,21 @@ fn debug() { - tracks - album targets: - - 118 - parent: 122 - - id: 122 + - 121 + parent: 125 + - id: 125 kind: Tuple span: 1:21-36 children: - - 120 - - 121 - parent: 123 - - id: 123 + - 123 + - 124 + parent: 126 + - id: 126 kind: 'TransformCall: Select' span: 1:14-36 children: - - 118 - - 122 + - 121 + - 125 ast: name: Project stmts: @@ -528,7 +528,7 @@ fn debug() { span: 1:0-36 ----- stderr ----- - "); + "###); // Don't test the output of this, since on one min-versions check it had // different results, and didn't repro on Mac. It having different results diff --git a/prqlc/prqlc/src/semantic/module.rs b/prqlc/prqlc/src/semantic/module.rs index 4f841bd76162..34f5f70a1270 100644 --- a/prqlc/prqlc/src/semantic/module.rs +++ b/prqlc/prqlc/src/semantic/module.rs @@ -134,6 +134,33 @@ impl Module { ns.names.get(&fq_ident.name) } + /// Recursively list all idents within this module. Useful for debugging. + pub fn all_names(&self, prefix: Option<&Ident>) -> Vec { + let mut rv = Vec::new(); + + for (name, decl) in &self.names { + let name = match prefix { + Some(p) => p.clone() + Ident::from_name(name), + None => Ident::from_name(name), + }; + rv.push(name.clone()); + + match &decl.kind { + DeclKind::Module(inner) => { + rv.extend(inner.all_names(Some(&name))); + } + DeclKind::LayeredModules(stack) => { + for inner in stack { + rv.extend(inner.all_names(Some(&name))); + } + } + _ => {} + } + } + + rv + } + pub fn lookup(&self, ident: &Ident) -> HashSet { fn lookup_in(module: &Module, ident: Ident) -> HashSet { let (prefix, ident) = ident.pop_front(); @@ -217,6 +244,7 @@ impl Module { None => { namespace.redirects.push(Ident::from_name(input_name)); + log::trace!("find_input_by_name {input_name} {:#?}", lineage.inputs); let input = lineage.find_input_by_name(input_name).unwrap(); let order = lineage.inputs.iter().position(|i| i.id == input.id); let order = order.unwrap(); diff --git a/prqlc/prqlc/src/semantic/resolver/expr.rs b/prqlc/prqlc/src/semantic/resolver/expr.rs index a2e7f5354ddb..ceb68e402b6f 100644 --- a/prqlc/prqlc/src/semantic/resolver/expr.rs +++ b/prqlc/prqlc/src/semantic/resolver/expr.rs @@ -75,6 +75,15 @@ impl pl::PlFold for Resolver<'_> { let r = match node.kind { pl::ExprKind::Ident(ident) => { log::debug!("resolving ident {ident}..."); + log::trace!( + "... candidates: {:#?}", + self.root_mod + .module + .all_names(None) + .into_iter() + .map(|i| i.to_string()) + .collect::>() + ); let fq_ident = self .resolve_ident(&ident) .map_err(|e| e.with_span(node.span))?; @@ -311,6 +320,55 @@ impl Resolver<'_> { } res } + + pub fn construct_wildcard_from_lineage( + &mut self, + prefix: &[&String], + expr: &pl::Expr, + ) -> Vec { + let Some(lineage) = &expr.lineage else { + return vec![]; + }; + + log::trace!("construct_wildcard_from_lineage: {lineage:#?}"); + + lineage + .columns + .iter() + .filter_map(|col| match col { + pl::LineageColumn::All { input_id, .. } => Some(pl::Expr { + id: Some(self.id.gen()), + target_id: Some(*input_id), + flatten: true, + ty: Some(Ty::new(TyKind::Tuple(vec![TyTupleField::Wildcard(None)]))), + ..pl::Expr::new(pl::Ident::from_name(NS_SELF)) + }), + pl::LineageColumn::Single { + target_id, + target_name: Some(target_name), + .. + } => Some(pl::Expr { + id: Some(self.id.gen()), + target_id: Some(*target_id), + alias: Some(target_name.to_string()), + ..pl::Expr::new(pl::Ident::from_path( + [prefix.to_vec(), vec![target_name]].concat(), + )) + }), + pl::LineageColumn::Single { + target_id, + name: Some(ident), + .. + } => Some(pl::Expr { + id: Some(self.id.gen()), + target_id: Some(*target_id), + alias: Some(ident.name.to_string()), + ..pl::Expr::new(ident.clone()) + }), + _ => None, + }) + .collect() + } } fn ty_of_lineage(lineage: &pl::Lineage) -> Ty { diff --git a/prqlc/prqlc/src/semantic/resolver/names.rs b/prqlc/prqlc/src/semantic/resolver/names.rs index a1c3ddfbbf88..01e7ee48af45 100644 --- a/prqlc/prqlc/src/semantic/resolver/names.rs +++ b/prqlc/prqlc/src/semantic/resolver/names.rs @@ -6,6 +6,7 @@ use super::Resolver; use crate::ir::decl::{Decl, DeclKind, Module}; use crate::ir::pl::{Expr, ExprKind}; use crate::pr::Ident; +use crate::pr::TyKind; use crate::semantic::{NS_INFER, NS_INFER_MODULE, NS_SELF, NS_THAT, NS_THIS}; use crate::Error; use crate::Result; @@ -238,18 +239,76 @@ impl Resolver<'_> { ..Expr::new(ExprKind::Tuple(fields)) }; let cols_expr = DeclKind::Expr(Box::new(cols_expr)); - let save_as = "_wildcard_match"; + let save_as = format!("_wildcard_match_{module_fq_self}"); self.root_mod .module .names .insert(save_as.to_string(), cols_expr.into()); // Then we can return ident to that decl. - Ok(Ident::from_name(save_as)) + return Ok(Ident::from_name(save_as)); } - 0 => Err(Error::new_simple(format!("Unknown relation {ident}"))), - _ => Err(ambiguous_error(decls, Some(&ident.name))), + 0 => {} // fallthrough + _ => return Err(ambiguous_error(decls, Some(&ident.name))), + }; + + // Second pass - look for an Expr referenced by the ident; if + // it has an inferred ty that is relation-shaped, return that. + let ident = ident.clone().pop().unwrap(); + let decls = self.root_mod.module.lookup(&ident); + log::trace!("resolve_ident_wildcard pass 2 decls: {decls:?}"); + + match decls.len() { + 1 => { + let relation_fq = decls.into_iter().next().unwrap(); + + // Retrieve the expr type + let decl = self.root_mod.module.get(&relation_fq).unwrap(); + let decl_kind = decl.kind.clone(); + + let ty_tuple = (|| { + let DeclKind::Expr(expr) = &decl_kind else { + return None; + }; + let Some(ty) = &expr.ty else { return None }; + let TyKind::Array(Some(ty)) = &ty.kind else { + return None; + }; + let TyKind::Tuple(tup) = &ty.kind else { + return None; + }; + Some(tup) + })(); + + if let (DeclKind::Expr(expr), Some(ty_tuple)) = (&decl_kind, ty_tuple) { + log::trace!("ty_tuple is {ty_tuple:#?}"); + + let prefix = relation_fq.iter().collect_vec(); + let fields = self.construct_wildcard_from_lineage(&prefix, expr); + log::trace!("resolve_ident_wildcard pass 2 fields: {fields:?}"); + + // This is just a workaround to return an Expr from this function. + // We wrap the expr into DeclKind::Expr and save it into the root module. + let cols_expr = Expr { + flatten: true, + ..Expr::new(ExprKind::Tuple(fields)) + }; + let cols_expr = DeclKind::Expr(Box::new(cols_expr)); + let save_as = format!("_wildcard_match_{relation_fq}"); + self.root_mod + .module + .names + .insert(save_as.to_string(), cols_expr.into()); + + // Then we can return ident to that decl. + return Ok(Ident::from_name(save_as)); + } + } + 0 => {} // fallthrough + _ => return Err(ambiguous_error(decls, Some(&ident.name))), } + + Err(Error::new_simple(format!("Unknown relation {ident}"))) } } diff --git a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__append_union_different_tables.snap b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__append_union_different_tables.snap index 4a4a7c96be2b..a58ca444b1f3 100644 --- a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__append_union_different_tables.snap +++ b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__append_union_different_tables.snap @@ -7,21 +7,21 @@ columns: name: - employees - name - target_id: 134 + target_id: 137 target_name: ~ - Single: name: - employees - salary - target_id: 135 + target_id: 138 target_name: ~ inputs: - - id: 132 + - id: 135 name: employees table: - default_db - employees - - id: 121 + - id: 124 name: managers table: - default_db diff --git a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-2.snap b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-2.snap index d12c3c8104d0..9ebe4bca6a23 100644 --- a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-2.snap +++ b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-2.snap @@ -4,18 +4,18 @@ expression: "resolve_lineage(r#\"\n from table_1\n join cu --- columns: - All: - input_id: 119 + input_id: 122 except: [] - All: - input_id: 116 + input_id: 119 except: [] inputs: - - id: 119 + - id: 122 name: table_1 table: - default_db - table_1 - - id: 116 + - id: 119 name: customers table: - default_db diff --git a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-3.snap b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-3.snap index 804e9f996604..d073e5c05e30 100644 --- a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-3.snap +++ b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names-3.snap @@ -7,26 +7,26 @@ columns: name: - e - emp_no - target_id: 129 + target_id: 132 target_name: ~ - Single: name: - e - gender - target_id: 130 + target_id: 133 target_name: ~ - Single: name: - emp_salary - target_id: 148 + target_id: 151 target_name: ~ inputs: - - id: 122 + - id: 125 name: e table: - default_db - employees - - id: 119 + - id: 122 name: salaries table: - default_db diff --git a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names.snap b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names.snap index e1d5c30ad09f..f0d5a9faa62a 100644 --- a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names.snap +++ b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__test__frames_and_names.snap @@ -7,26 +7,26 @@ columns: name: - orders - customer_no - target_id: 123 + target_id: 126 target_name: ~ - Single: name: - orders - gross - target_id: 124 + target_id: 127 target_name: ~ - Single: name: - orders - tax - target_id: 125 + target_id: 128 target_name: ~ - Single: name: ~ - target_id: 126 + target_id: 129 target_name: ~ inputs: - - id: 121 + - id: 124 name: orders table: - default_db diff --git a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__transforms__tests__aggregate_positional_arg-2.snap b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__transforms__tests__aggregate_positional_arg-2.snap index b69b52fe7aed..68b2dbfc30b9 100644 --- a/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__transforms__tests__aggregate_positional_arg-2.snap +++ b/prqlc/prqlc/src/semantic/resolver/snapshots/prqlc__semantic__resolver__transforms__tests__aggregate_positional_arg-2.snap @@ -21,10 +21,10 @@ TransformCall: lineage: columns: - All: - input_id: 118 + input_id: 121 except: [] inputs: - - id: 118 + - id: 121 name: c_invoice table: - default_db @@ -94,14 +94,14 @@ lineage: name: - c_invoice - issued_at - target_id: 120 + target_id: 123 target_name: ~ - Single: name: ~ - target_id: 136 + target_id: 139 target_name: ~ inputs: - - id: 118 + - id: 121 name: c_invoice table: - default_db diff --git a/prqlc/prqlc/src/semantic/resolver/transforms.rs b/prqlc/prqlc/src/semantic/resolver/transforms.rs index f15b63562754..2e61fba69eea 100644 --- a/prqlc/prqlc/src/semantic/resolver/transforms.rs +++ b/prqlc/prqlc/src/semantic/resolver/transforms.rs @@ -254,9 +254,63 @@ impl Resolver<'_> { (transform_kind, tbl) } "append" => { - let [bottom, top] = unpack::<2>(func.args); + let [by, bottom, top] = unpack::<3>(func.args); - (TransformKind::Append(Box::new(bottom)), top) + let by_name = { + let span = by.span; + let ident = by + .clone() + .try_cast(ExprKind::into_ident, Some("by"), "ident")?; + + match ident.to_string().as_str() { + "position" => false, + "name" => true, + _ => { + return Err(Error::new(Reason::Expected { + who: Some("`by`".to_string()), + expected: "position or name".to_string(), + found: ident.to_string(), + }) + .with_span(span)) + } + } + }; + + // TODO: support database engine-level UNION ALL BY NAME in PR #6037 + if by_name { + // input validation for PRQL-native implementation + for (name, rel) in [("top", top.clone()), ("bottom", bottom.clone())] { + let lineage = rel.lineage.clone().ok_or_else(|| { + Error::new(Reason::Expected { + who: Some(format!("`{name}`")), + expected: "relation".to_string(), + found: write_pl(rel.clone()), + }) + .with_span(rel.span) + })?; + + lineage.columns.iter().try_for_each(|c| match c { + LineageColumn::All { .. } => Err(Error::new(Reason::Simple(format!( + "{name} input to append by:name must have all columns defined" + ))) + .push_hint("try adding a select earlier in the pipeline") + .with_span(rel.span)), + LineageColumn::Single { + name: None, + target_name: None, + .. + } => Err(Error::new(Reason::Simple(format!( + "{name} input to append by:name must not have any unnamed columns" + ))) + .with_span(rel.span)), + _ => Ok(()), + })?; + } + + return Ok(new_binop(bottom, &["std", "_append_by_name"], top)); + } else { + (TransformKind::Append(Box::new(bottom)), top) + } } "loop" => { let [pipeline, tbl] = unpack::<2>(func.args); @@ -386,6 +440,75 @@ impl Resolver<'_> { return Ok(Expr::new(ExprKind::Tuple(res))); } + "tuple_uniq" => { + let [take, list] = unpack::<2>(func.args); + + let take_late = { + let span = take.span; + let ident = + take.clone() + .try_cast(ExprKind::into_ident, Some("take"), "ident")?; + + match ident.to_string().as_str() { + "early" => false, + "late" => true, + _ => { + return Err(Error::new(Reason::Expected { + who: Some("`take`".to_string()), + expected: "early or late".to_string(), + found: ident.to_string(), + }) + .with_span(span)) + } + } + }; + + let list_items = list.kind.into_tuple().unwrap(); + + log::trace!("tuple_uniq before: {list_items:#?}"); + + let mut list_names: Vec = Vec::new(); + let mut list_out: HashMap = HashMap::new(); + + for item in list_items { + let Some(name) = (match (&item.alias, &item.kind) { + (Some(name), _) => Some(name.to_string()), + (None, ExprKind::Ident(ident)) => Some(&ident.name).cloned(), + _ => None, + }) else { + continue; + }; + + if !list_out.contains_key(&name.to_string()) { + list_names.push(name.to_string()); + } + + if !list_out.contains_key(&name.to_string()) || take_late { + list_out.insert(name.to_string(), item); + } + } + + let list_items = list_names + .into_iter() + .map(|name| list_out.get(&name).unwrap().clone()) + .collect(); + + log::trace!("tuple_uniq after: {list_items:#?}"); + + return Ok(Expr::new(ExprKind::Tuple(list_items))); + } + + "tuple_reverse" => { + let [list] = unpack::<1>(func.args); + let list_items = list.kind.into_tuple().unwrap(); + + log::trace!("tuple_reverse: {list_items:#?}"); + + return Ok(Expr::new(ExprKind::Tuple( + list_items.into_iter().rev().collect(), + ))); + } + "_eq" => { // yes, this is not a transform, but this is the most appropriate place for it diff --git a/prqlc/prqlc/src/semantic/resolver/types.rs b/prqlc/prqlc/src/semantic/resolver/types.rs index 4f3f74f67dc1..39d59ce10876 100644 --- a/prqlc/prqlc/src/semantic/resolver/types.rs +++ b/prqlc/prqlc/src/semantic/resolver/types.rs @@ -413,6 +413,8 @@ fn type_intersection_of_tuples(a: Vec, b: Vec) -> Re let mut a_fields = a.into_iter().filter_map(|f| f.into_single().ok()); let mut b_fields = b.into_iter().filter_map(|f| f.into_single().ok()); + log::trace!("tuple intersection: {a_fields:#?} {b_fields:#?}"); + let mut fields = Vec::new(); let mut has_other = false; loop { diff --git a/prqlc/prqlc/src/semantic/std.prql b/prqlc/prqlc/src/semantic/std.prql index 24b709f0cd4f..c006a79b7e53 100644 --- a/prqlc/prqlc/src/semantic/std.prql +++ b/prqlc/prqlc/src/semantic/std.prql @@ -118,7 +118,23 @@ let window = func tbl -> internal window -let append = `default_db.bottom` top -> internal append +let append = func + `noresolve.by`:position + `default_db.bottom` + top + -> internal append + +let _append_by_name = func + `default_db.bottom` + top + -> ( + top + select (tuple_uniq take:early {top.*, (tuple_map (func _ -> null) _param.bottom.*)}) + append (b = bottom | select ( + tuple_uniq take:late {(tuple_map (func _ -> null) _param.top.*), b.*} + )) +) + let intersect = `default_db.bottom` top -> ( t = top join (b = bottom) (tuple_reduce std.and (tuple_map _eq (tuple_zip t.* b.*))) @@ -202,6 +218,8 @@ let in = pattern value -> internal in let tuple_reduce = func initial:"__missing" fn list -> internal tuple_reduce let tuple_map = func fn list -> internal tuple_map let tuple_zip = func a b -> internal tuple_zip +let tuple_uniq = func `noresolve.take`:early list -> internal tuple_uniq +let tuple_reverse = func list -> internal tuple_reverse let _eq = func a -> internal _eq let _is_null = func a -> _param.a == null diff --git a/prqlc/prqlc/tests/integration/error_messages.rs b/prqlc/prqlc/tests/integration/error_messages.rs index d17d3df97315..fb14604e0103 100644 --- a/prqlc/prqlc/tests/integration/error_messages.rs +++ b/prqlc/prqlc/tests/integration/error_messages.rs @@ -490,3 +490,67 @@ fn bare_lambda_expression() { ───╯ "); } + +#[test] +fn append_by_wrong() { + assert_snapshot!(compile(r###" + from foo + append by:bar baz + "###).unwrap_err(), @" + Error: + ╭─[ :3:15 ] + │ + 3 │ append by:bar baz + │ ─┬─ + │ ╰─── `by` expected position or name, but found bar + ───╯ + "); +} + +#[test] +fn tuple_uniq_take_wrong() { + assert_snapshot!(compile(r###" + from foo + select (tuple_uniq take:bar this) + "###).unwrap_err(), @" + Error: + ╭─[ :3:29 ] + │ + 3 │ select (tuple_uniq take:bar this) + │ ─┬─ + │ ╰─── `take` expected early or late, but found bar + ───╯ + "); +} + +#[test] +fn append_by_name_wildcard() { + assert_snapshot!(compile(r"from foo | append by:name (from bar)").unwrap_err(), @" + Error: + ╭─[ :1:1 ] + │ + 1 │ from foo | append by:name (from bar) + │ ────┬─── + │ ╰───── top input to append by:name must have all columns defined + │ + │ Help: try adding a select earlier in the pipeline + ───╯ + "); +} + +#[test] +fn append_by_name_unnamed() { + assert_snapshot!(compile(r###" + from foo + select {x, y} + append by:name (from bar | select {x, y+3}) + "###).unwrap_err(), @" + Error: + ╭─[ :4:32 ] + │ + 4 │ append by:name (from bar | select {x, y+3}) + │ ───────┬─────── + │ ╰───────── bottom input to append by:name must not have any unnamed columns + ───╯ + "); +} diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__aggregation.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__aggregation.snap index d89effb1f540..cae96f6e80d7 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__aggregation.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__aggregation.snap @@ -7,10 +7,10 @@ frames: - - 1:101-123 - columns: - !All - input_id: 124 + input_id: 127 except: [] inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -18,25 +18,21 @@ frames: - - 1:124-154 - columns: - !All - input_id: 124 + input_id: 127 except: [] - !Single name: - empty_name - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db - tracks - - 1:155-230 - columns: - - !Single - name: null - target_id: 137 - target_name: null - !Single name: null target_id: 140 @@ -49,28 +45,32 @@ frames: name: null target_id: 146 target_name: null + - !Single + name: null + target_id: 149 + target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db - tracks nodes: -- id: 124 +- id: 127 kind: Ident span: 1:89-100 ident: !Ident - default_db - tracks - parent: 130 -- id: 126 + parent: 133 +- id: 129 kind: RqOperator span: 1:108-123 targets: - - 128 - - 129 - parent: 130 -- id: 128 + - 131 + - 132 + parent: 133 +- id: 131 kind: Ident span: 1:108-116 ident: !Ident @@ -78,26 +78,26 @@ nodes: - tracks - genre_id targets: - - 124 -- id: 129 + - 127 +- id: 132 kind: Literal span: 1:120-123 -- id: 130 +- id: 133 kind: 'TransformCall: Filter' span: 1:101-123 children: - - 124 - - 126 - parent: 136 -- id: 131 + - 127 + - 129 + parent: 139 +- id: 134 kind: RqOperator span: 1:144-154 alias: empty_name targets: - - 133 - - 134 - parent: 135 -- id: 133 + - 136 + - 137 + parent: 138 +- id: 136 kind: Ident span: 1:144-148 ident: !Ident @@ -105,30 +105,30 @@ nodes: - tracks - name targets: - - 124 -- id: 134 + - 127 +- id: 137 kind: Literal span: 1:152-154 -- id: 135 +- id: 138 kind: Tuple span: 1:144-154 children: - - 131 - parent: 136 -- id: 136 + - 134 + parent: 139 +- id: 139 kind: 'TransformCall: Derive' span: 1:124-154 children: - - 130 - - 135 - parent: 150 -- id: 137 + - 133 + - 138 + parent: 153 +- id: 140 kind: RqOperator span: 1:166-178 targets: - - 139 - parent: 149 -- id: 139 + - 142 + parent: 152 +- id: 142 kind: Ident span: 1:170-178 ident: !Ident @@ -136,14 +136,14 @@ nodes: - tracks - track_id targets: - - 124 -- id: 140 + - 127 +- id: 143 kind: RqOperator span: 1:180-197 targets: - - 142 - parent: 149 -- id: 142 + - 145 + parent: 152 +- id: 145 kind: Ident span: 1:193-197 ident: !Ident @@ -151,50 +151,50 @@ nodes: - tracks - name targets: - - 124 -- id: 143 + - 127 +- id: 146 kind: RqOperator span: 1:199-213 targets: - - 145 - parent: 149 -- id: 145 + - 148 + parent: 152 +- id: 148 kind: Ident span: 1:203-213 ident: !Ident - this - empty_name targets: - - 131 -- id: 146 + - 134 +- id: 149 kind: RqOperator span: 1:215-229 targets: - - 148 - parent: 149 -- id: 148 + - 151 + parent: 152 +- id: 151 kind: Ident span: 1:219-229 ident: !Ident - this - empty_name targets: - - 131 -- id: 149 + - 134 +- id: 152 kind: Tuple span: 1:165-230 children: - - 137 - 140 - 143 - 146 - parent: 150 -- id: 150 + - 149 + parent: 153 +- id: 153 kind: 'TransformCall: Aggregate' span: 1:155-230 children: - - 136 - - 149 + - 139 + - 152 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select.snap index dcdeb7ead05a..518a43fa7bd4 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select.snap @@ -10,22 +10,22 @@ frames: name: - invoices - customer_id - target_id: 148 + target_id: 151 target_name: null - !Single name: - invoices - invoice_id - target_id: 149 + target_id: 152 target_name: null - !Single name: - invoices - billing_country - target_id: 150 + target_id: 153 target_name: null inputs: - - id: 146 + - id: 149 name: invoices table: - default_db @@ -36,22 +36,22 @@ frames: name: - invoices - customer_id - target_id: 148 + target_id: 151 target_name: null - !Single name: - invoices - invoice_id - target_id: 149 + target_id: 152 target_name: null - !Single name: - invoices - billing_country - target_id: 150 + target_id: 153 target_name: null inputs: - - id: 146 + - id: 149 name: invoices table: - default_db @@ -62,22 +62,22 @@ frames: name: - invoices - customer_id - target_id: 129 + target_id: 132 target_name: null - !Single name: - invoices - invoice_id - target_id: 130 + target_id: 133 target_name: null - !Single name: - invoices - billing_country - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 127 + - id: 130 name: invoices table: - default_db @@ -88,22 +88,22 @@ frames: name: - invoices - customer_id - target_id: 129 + target_id: 132 target_name: null - !Single name: - invoices - invoice_id - target_id: 130 + target_id: 133 target_name: null - !Single name: - invoices - billing_country - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 127 + - id: 130 name: invoices table: - default_db @@ -114,27 +114,27 @@ frames: name: - invoices - customer_id - target_id: 148 + target_id: 151 target_name: null - !Single name: - invoices - invoice_id - target_id: 149 + target_id: 152 target_name: null - !Single name: - invoices - billing_country - target_id: 150 + target_id: 153 target_name: null inputs: - - id: 146 + - id: 149 name: invoices table: - default_db - invoices - - id: 127 + - id: 130 name: invoices table: - default_db @@ -145,34 +145,34 @@ frames: name: - invoices - billing_country - target_id: 158 + target_id: 161 target_name: null - !Single name: - invoices - invoice_id - target_id: 159 + target_id: 162 target_name: null inputs: - - id: 146 + - id: 149 name: invoices table: - default_db - invoices - - id: 127 + - id: 130 name: invoices table: - default_db - invoices nodes: -- id: 127 +- id: 130 kind: Ident span: 1:89-102 ident: !Ident - default_db - invoices - parent: 133 -- id: 129 + parent: 136 +- id: 132 kind: Ident span: 1:114-125 ident: !Ident @@ -180,9 +180,9 @@ nodes: - invoices - customer_id targets: - - 127 - parent: 132 -- id: 130 + - 130 + parent: 135 +- id: 133 kind: Ident span: 1:127-137 ident: !Ident @@ -190,9 +190,9 @@ nodes: - invoices - invoice_id targets: - - 127 - parent: 132 -- id: 131 + - 130 + parent: 135 +- id: 134 kind: Ident span: 1:139-154 ident: !Ident @@ -200,49 +200,49 @@ nodes: - invoices - billing_country targets: - - 127 - parent: 132 -- id: 132 + - 130 + parent: 135 +- id: 135 kind: Tuple span: 1:112-156 children: - - 129 - - 130 - - 131 - parent: 133 -- id: 133 + - 132 + - 133 + - 134 + parent: 136 +- id: 136 kind: 'TransformCall: Select' span: 1:105-156 children: - - 127 - - 132 - parent: 137 -- id: 134 + - 130 + - 135 + parent: 140 +- id: 137 kind: Literal span: 1:164-166 alias: start - parent: 137 -- id: 135 + parent: 140 +- id: 138 kind: Literal span: 1:168-170 alias: end - parent: 137 -- id: 137 + parent: 140 +- id: 140 kind: 'TransformCall: Take' span: 1:159-170 children: - - 133 - - 134 - - 135 - parent: 157 -- id: 146 + - 136 + - 137 + - 138 + parent: 160 +- id: 149 kind: Ident span: 1:0-13 ident: !Ident - default_db - invoices - parent: 152 -- id: 148 + parent: 155 +- id: 151 kind: Ident span: 1:23-34 ident: !Ident @@ -250,9 +250,9 @@ nodes: - invoices - customer_id targets: - - 146 - parent: 151 -- id: 149 + - 149 + parent: 154 +- id: 152 kind: Ident span: 1:36-46 ident: !Ident @@ -260,9 +260,9 @@ nodes: - invoices - invoice_id targets: - - 146 - parent: 151 -- id: 150 + - 149 + parent: 154 +- id: 153 kind: Ident span: 1:48-63 ident: !Ident @@ -270,49 +270,49 @@ nodes: - invoices - billing_country targets: - - 146 - parent: 151 -- id: 151 + - 149 + parent: 154 +- id: 154 kind: Tuple span: 1:21-65 children: - - 148 - - 149 - - 150 - parent: 152 -- id: 152 + - 151 + - 152 + - 153 + parent: 155 +- id: 155 kind: 'TransformCall: Select' span: 1:14-65 children: - - 146 - - 151 - parent: 156 -- id: 153 + - 149 + - 154 + parent: 159 +- id: 156 kind: Literal span: 1:71-73 alias: start - parent: 156 -- id: 154 + parent: 159 +- id: 157 kind: Literal span: 1:75-77 alias: end - parent: 156 -- id: 156 + parent: 159 +- id: 159 kind: 'TransformCall: Take' span: 1:66-77 children: - - 152 - - 153 - - 154 - parent: 157 -- id: 157 + - 155 + - 156 + - 157 + parent: 160 +- id: 160 kind: 'TransformCall: Append' span: 1:78-172 children: - - 156 - - 137 - parent: 161 -- id: 158 + - 159 + - 140 + parent: 164 +- id: 161 kind: Ident span: 1:182-197 ident: !Ident @@ -320,9 +320,9 @@ nodes: - invoices - billing_country targets: - - 150 - parent: 160 -- id: 159 + - 153 + parent: 163 +- id: 162 kind: Ident span: 1:199-209 ident: !Ident @@ -330,21 +330,21 @@ nodes: - invoices - invoice_id targets: - - 149 - parent: 160 -- id: 160 + - 152 + parent: 163 +- id: 163 kind: Tuple span: 1:180-211 children: - - 158 - - 159 - parent: 161 -- id: 161 + - 161 + - 162 + parent: 164 +- id: 164 kind: 'TransformCall: Select' span: 1:173-211 children: - - 157 - 160 + - 163 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_compute.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_compute.snap index 7ae27c22007f..8c6dd942dcac 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_compute.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_compute.snap @@ -7,15 +7,15 @@ frames: - - 1:14-74 - columns: - !All - input_id: 164 + input_id: 167 except: [] - !Single name: - total - target_id: 166 + target_id: 169 target_name: null inputs: - - id: 164 + - id: 167 name: invoices table: - default_db @@ -26,21 +26,21 @@ frames: name: - invoices - customer_id - target_id: 179 + target_id: 182 target_name: null - !Single name: - invoices - invoice_id - target_id: 180 + target_id: 183 target_name: null - !Single name: - total - target_id: 181 + target_id: 184 target_name: null inputs: - - id: 164 + - id: 167 name: invoices table: - default_db @@ -51,21 +51,21 @@ frames: name: - invoices - customer_id - target_id: 179 + target_id: 182 target_name: null - !Single name: - invoices - invoice_id - target_id: 180 + target_id: 183 target_name: null - !Single name: - total - target_id: 181 + target_id: 184 target_name: null inputs: - - id: 164 + - id: 167 name: invoices table: - default_db @@ -73,15 +73,15 @@ frames: - - 1:156-235 - columns: - !All - input_id: 130 + input_id: 133 except: [] - !Single name: - unit_price - target_id: 132 + target_id: 135 target_name: null inputs: - - id: 130 + - id: 133 name: invoice_items table: - default_db @@ -92,21 +92,21 @@ frames: name: - invoice_items - invoice_line_id - target_id: 145 + target_id: 148 target_name: null - !Single name: - invoice_items - invoice_id - target_id: 146 + target_id: 149 target_name: null - !Single name: - unit_price - target_id: 147 + target_id: 150 target_name: null inputs: - - id: 130 + - id: 133 name: invoice_items table: - default_db @@ -117,21 +117,21 @@ frames: name: - invoice_items - invoice_line_id - target_id: 145 + target_id: 148 target_name: null - !Single name: - invoice_items - invoice_id - target_id: 146 + target_id: 149 target_name: null - !Single name: - unit_price - target_id: 147 + target_id: 150 target_name: null inputs: - - id: 130 + - id: 133 name: invoice_items table: - default_db @@ -142,26 +142,26 @@ frames: name: - invoices - customer_id - target_id: 179 + target_id: 182 target_name: null - !Single name: - invoices - invoice_id - target_id: 180 + target_id: 183 target_name: null - !Single name: - total - target_id: 181 + target_id: 184 target_name: null inputs: - - id: 164 + - id: 167 name: invoices table: - default_db - invoices - - id: 130 + - id: 133 name: invoice_items table: - default_db @@ -171,49 +171,49 @@ frames: - !Single name: - a - target_id: 188 + target_id: 191 target_name: null - !Single name: - b - target_id: 192 + target_id: 195 target_name: null inputs: - - id: 164 + - id: 167 name: invoices table: - default_db - invoices - - id: 130 + - id: 133 name: invoice_items table: - default_db - invoice_items nodes: -- id: 130 +- id: 133 kind: Ident span: 1:135-153 ident: !Ident - default_db - invoice_items - parent: 144 -- id: 132 + parent: 147 +- id: 135 kind: Case span: 1:176-235 alias: unit_price targets: - - 133 - - 137 - - 141 - - 142 - parent: 143 -- id: 133 + - 136 + - 140 + - 144 + - 145 + parent: 146 +- id: 136 kind: RqOperator span: 1:182-196 targets: - - 135 - - 136 -- id: 135 + - 138 + - 139 +- id: 138 kind: Ident span: 1:182-192 ident: !Ident @@ -221,17 +221,17 @@ nodes: - invoice_items - unit_price targets: - - 130 -- id: 136 + - 133 +- id: 139 kind: Literal span: 1:195-196 -- id: 137 +- id: 140 kind: RqOperator span: 1:200-214 targets: - - 139 - - 140 -- id: 139 + - 142 + - 143 +- id: 142 kind: Ident span: 1:200-210 ident: !Ident @@ -239,14 +239,14 @@ nodes: - invoice_items - unit_price targets: - - 130 -- id: 140 + - 133 +- id: 143 kind: Literal span: 1:213-214 -- id: 141 +- id: 144 kind: Literal span: 1:216-220 -- id: 142 +- id: 145 kind: Ident span: 1:224-234 ident: !Ident @@ -254,21 +254,21 @@ nodes: - invoice_items - unit_price targets: - - 130 -- id: 143 + - 133 +- id: 146 kind: Tuple span: 1:176-235 children: - - 132 - parent: 144 -- id: 144 + - 135 + parent: 147 +- id: 147 kind: 'TransformCall: Derive' span: 1:156-235 children: - - 130 - - 143 - parent: 149 -- id: 145 + - 133 + - 146 + parent: 152 +- id: 148 kind: Ident span: 1:247-262 ident: !Ident @@ -276,9 +276,9 @@ nodes: - invoice_items - invoice_line_id targets: - - 130 - parent: 148 -- id: 146 + - 133 + parent: 151 +- id: 149 kind: Ident span: 1:264-274 ident: !Ident @@ -286,66 +286,66 @@ nodes: - invoice_items - invoice_id targets: - - 130 - parent: 148 -- id: 147 + - 133 + parent: 151 +- id: 150 kind: Ident span: 1:276-286 ident: !Ident - this - unit_price targets: - - 132 - parent: 148 -- id: 148 + - 135 + parent: 151 +- id: 151 kind: Tuple span: 1:245-288 children: - - 145 - - 146 - - 147 - parent: 149 -- id: 149 + - 148 + - 149 + - 150 + parent: 152 +- id: 152 kind: 'TransformCall: Select' span: 1:238-288 children: - - 144 - - 148 - parent: 151 -- id: 151 + - 147 + - 151 + parent: 154 +- id: 154 kind: 'TransformCall: Take' span: 1:291-297 children: - - 149 - 152 - parent: 187 -- id: 152 + - 155 + parent: 190 +- id: 155 kind: Literal - parent: 151 -- id: 164 + parent: 154 +- id: 167 kind: Ident span: 1:0-13 ident: !Ident - default_db - invoices - parent: 178 -- id: 166 + parent: 181 +- id: 169 kind: Case span: 1:29-74 alias: total targets: - - 167 - - 171 - - 175 - - 176 - parent: 177 -- id: 167 + - 170 + - 174 + - 178 + - 179 + parent: 180 +- id: 170 kind: RqOperator span: 1:35-45 targets: - - 169 - - 170 -- id: 169 + - 172 + - 173 +- id: 172 kind: Ident span: 1:35-40 ident: !Ident @@ -353,17 +353,17 @@ nodes: - invoices - total targets: - - 164 -- id: 170 + - 167 +- id: 173 kind: Literal span: 1:43-45 -- id: 171 +- id: 174 kind: RqOperator span: 1:49-58 targets: - - 173 - - 174 -- id: 173 + - 176 + - 177 +- id: 176 kind: Ident span: 1:49-54 ident: !Ident @@ -371,14 +371,14 @@ nodes: - invoices - total targets: - - 164 -- id: 174 + - 167 +- id: 177 kind: Literal span: 1:57-58 -- id: 175 +- id: 178 kind: Literal span: 1:60-64 -- id: 176 +- id: 179 kind: Ident span: 1:68-73 ident: !Ident @@ -386,21 +386,21 @@ nodes: - invoices - total targets: - - 164 -- id: 177 + - 167 +- id: 180 kind: Tuple span: 1:29-74 children: - - 166 - parent: 178 -- id: 178 + - 169 + parent: 181 +- id: 181 kind: 'TransformCall: Derive' span: 1:14-74 children: - - 164 - - 177 - parent: 183 -- id: 179 + - 167 + - 180 + parent: 186 +- id: 182 kind: Ident span: 1:84-95 ident: !Ident @@ -408,9 +408,9 @@ nodes: - invoices - customer_id targets: - - 164 - parent: 182 -- id: 180 + - 167 + parent: 185 +- id: 183 kind: Ident span: 1:97-107 ident: !Ident @@ -418,58 +418,58 @@ nodes: - invoices - invoice_id targets: - - 164 - parent: 182 -- id: 181 + - 167 + parent: 185 +- id: 184 kind: Ident span: 1:109-114 ident: !Ident - this - total targets: - - 166 - parent: 182 -- id: 182 + - 169 + parent: 185 +- id: 185 kind: Tuple span: 1:82-116 children: - - 179 - - 180 - - 181 - parent: 183 -- id: 183 + - 182 + - 183 + - 184 + parent: 186 +- id: 186 kind: 'TransformCall: Select' span: 1:75-116 children: - - 178 - - 182 - parent: 185 -- id: 185 + - 181 + - 185 + parent: 188 +- id: 188 kind: 'TransformCall: Take' span: 1:117-123 children: - - 183 - 186 - parent: 187 -- id: 186 + - 189 + parent: 190 +- id: 189 kind: Literal - parent: 185 -- id: 187 + parent: 188 +- id: 190 kind: 'TransformCall: Append' span: 1:124-299 children: - - 185 - - 151 - parent: 200 -- id: 188 + - 188 + - 154 + parent: 203 +- id: 191 kind: RqOperator span: 1:313-328 alias: a targets: - - 190 - - 191 - parent: 199 -- id: 190 + - 193 + - 194 + parent: 202 +- id: 193 kind: Ident span: 1:313-324 ident: !Ident @@ -477,28 +477,28 @@ nodes: - invoices - customer_id targets: - - 179 -- id: 191 + - 182 +- id: 194 kind: Literal span: 1:327-328 -- id: 192 +- id: 195 kind: RqOperator span: 1:334-367 alias: b targets: - - 194 - - 195 - parent: 199 -- id: 194 + - 197 + - 198 + parent: 202 +- id: 197 kind: Literal span: 1:345-346 -- id: 195 +- id: 198 kind: RqOperator span: 1:348-366 targets: - - 197 - - 198 -- id: 197 + - 200 + - 201 +- id: 200 kind: Ident span: 1:348-358 ident: !Ident @@ -506,28 +506,28 @@ nodes: - invoices - invoice_id targets: - - 180 -- id: 198 + - 183 +- id: 201 kind: Ident span: 1:361-366 ident: !Ident - this - total targets: - - 181 -- id: 199 + - 184 +- id: 202 kind: Tuple span: 1:307-369 children: - - 188 - - 192 - parent: 200 -- id: 200 + - 191 + - 195 + parent: 203 +- id: 203 kind: 'TransformCall: Select' span: 1:300-369 children: - - 187 - - 199 + - 190 + - 202 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_multiple_with_null.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_multiple_with_null.snap index feb63ea110c5..6f48d9bfe6b4 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_multiple_with_null.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_multiple_with_null.snap @@ -10,22 +10,22 @@ frames: name: - invoices - customer_id - target_id: 168 + target_id: 171 target_name: null - !Single name: - invoices - invoice_id - target_id: 169 + target_id: 172 target_name: null - !Single name: - invoices - billing_country - target_id: 170 + target_id: 173 target_name: null inputs: - - id: 166 + - id: 169 name: invoices table: - default_db @@ -36,22 +36,22 @@ frames: name: - invoices - customer_id - target_id: 168 + target_id: 171 target_name: null - !Single name: - invoices - invoice_id - target_id: 169 + target_id: 172 target_name: null - !Single name: - invoices - billing_country - target_id: 170 + target_id: 173 target_name: null inputs: - - id: 166 + - id: 169 name: invoices table: - default_db @@ -60,22 +60,22 @@ frames: - columns: - !Single name: null - target_id: 150 + target_id: 153 target_name: null - !Single name: - employees - employee_id - target_id: 151 + target_id: 154 target_name: null - !Single name: - employees - country - target_id: 152 + target_id: 155 target_name: null inputs: - - id: 148 + - id: 151 name: employees table: - default_db @@ -84,22 +84,22 @@ frames: - columns: - !Single name: null - target_id: 150 + target_id: 153 target_name: null - !Single name: - employees - employee_id - target_id: 151 + target_id: 154 target_name: null - !Single name: - employees - country - target_id: 152 + target_id: 155 target_name: null inputs: - - id: 148 + - id: 151 name: employees table: - default_db @@ -110,27 +110,27 @@ frames: name: - invoices - customer_id - target_id: 168 + target_id: 171 target_name: null - !Single name: - invoices - invoice_id - target_id: 169 + target_id: 172 target_name: null - !Single name: - invoices - billing_country - target_id: 170 + target_id: 173 target_name: null inputs: - - id: 166 + - id: 169 name: invoices table: - default_db - invoices - - id: 148 + - id: 151 name: employees table: - default_db @@ -141,20 +141,20 @@ frames: name: - invoice_items - invoice_line_id - target_id: 129 + target_id: 132 target_name: null - !Single name: - invoice_items - invoice_id - target_id: 130 + target_id: 133 target_name: null - !Single name: null - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 127 + - id: 130 name: invoice_items table: - default_db @@ -165,20 +165,20 @@ frames: name: - invoice_items - invoice_line_id - target_id: 129 + target_id: 132 target_name: null - !Single name: - invoice_items - invoice_id - target_id: 130 + target_id: 133 target_name: null - !Single name: null - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 127 + - id: 130 name: invoice_items table: - default_db @@ -189,32 +189,32 @@ frames: name: - invoices - customer_id - target_id: 168 + target_id: 171 target_name: null - !Single name: - invoices - invoice_id - target_id: 169 + target_id: 172 target_name: null - !Single name: - invoices - billing_country - target_id: 170 + target_id: 173 target_name: null inputs: - - id: 166 + - id: 169 name: invoices table: - default_db - invoices - - id: 148 + - id: 151 name: employees table: - default_db - employees - - id: 127 + - id: 130 name: invoice_items table: - default_db @@ -225,39 +225,39 @@ frames: name: - invoices - billing_country - target_id: 178 + target_id: 181 target_name: null - !Single name: - invoices - invoice_id - target_id: 179 + target_id: 182 target_name: null inputs: - - id: 166 + - id: 169 name: invoices table: - default_db - invoices - - id: 148 + - id: 151 name: employees table: - default_db - employees - - id: 127 + - id: 130 name: invoice_items table: - default_db - invoice_items nodes: -- id: 127 +- id: 130 kind: Ident span: 1:168-186 ident: !Ident - default_db - invoice_items - parent: 133 -- id: 129 + parent: 136 +- id: 132 kind: Ident span: 1:198-213 ident: !Ident @@ -265,9 +265,9 @@ nodes: - invoice_items - invoice_line_id targets: - - 127 - parent: 132 -- id: 130 + - 130 + parent: 135 +- id: 133 kind: Ident span: 1:215-225 ident: !Ident @@ -275,45 +275,45 @@ nodes: - invoice_items - invoice_id targets: - - 127 - parent: 132 -- id: 131 + - 130 + parent: 135 +- id: 134 kind: Literal span: 1:227-231 - parent: 132 -- id: 132 + parent: 135 +- id: 135 kind: Tuple span: 1:196-233 children: - - 129 - - 130 - - 131 - parent: 133 -- id: 133 + - 132 + - 133 + - 134 + parent: 136 +- id: 136 kind: 'TransformCall: Select' span: 1:189-233 children: - - 127 - - 132 - parent: 135 -- id: 135 + - 130 + - 135 + parent: 138 +- id: 138 kind: 'TransformCall: Take' span: 1:236-242 children: - - 133 - 136 - parent: 177 -- id: 136 + - 139 + parent: 180 +- id: 139 kind: Literal - parent: 135 -- id: 148 + parent: 138 +- id: 151 kind: Ident span: 1:84-98 ident: !Ident - default_db - employees - parent: 154 -- id: 150 + parent: 157 +- id: 153 kind: Ident span: 1:110-121 ident: !Ident @@ -321,9 +321,9 @@ nodes: - employees - employee_id targets: - - 148 - parent: 153 -- id: 151 + - 151 + parent: 156 +- id: 154 kind: Ident span: 1:123-134 ident: !Ident @@ -331,9 +331,9 @@ nodes: - employees - employee_id targets: - - 148 - parent: 153 -- id: 152 + - 151 + parent: 156 +- id: 155 kind: Ident span: 1:136-143 ident: !Ident @@ -341,41 +341,41 @@ nodes: - employees - country targets: - - 148 - parent: 153 -- id: 153 + - 151 + parent: 156 +- id: 156 kind: Tuple span: 1:108-145 children: - - 150 - - 151 - - 152 - parent: 154 -- id: 154 + - 153 + - 154 + - 155 + parent: 157 +- id: 157 kind: 'TransformCall: Select' span: 1:101-145 children: - - 148 - - 153 - parent: 156 -- id: 156 + - 151 + - 156 + parent: 159 +- id: 159 kind: 'TransformCall: Take' span: 1:148-154 children: - - 154 - 157 - parent: 176 -- id: 157 + - 160 + parent: 179 +- id: 160 kind: Literal - parent: 156 -- id: 166 + parent: 159 +- id: 169 kind: Ident span: 1:0-13 ident: !Ident - default_db - invoices - parent: 172 -- id: 168 + parent: 175 +- id: 171 kind: Ident span: 1:23-34 ident: !Ident @@ -383,9 +383,9 @@ nodes: - invoices - customer_id targets: - - 166 - parent: 171 -- id: 169 + - 169 + parent: 174 +- id: 172 kind: Ident span: 1:36-46 ident: !Ident @@ -393,9 +393,9 @@ nodes: - invoices - invoice_id targets: - - 166 - parent: 171 -- id: 170 + - 169 + parent: 174 +- id: 173 kind: Ident span: 1:48-63 ident: !Ident @@ -403,48 +403,48 @@ nodes: - invoices - billing_country targets: - - 166 - parent: 171 -- id: 171 + - 169 + parent: 174 +- id: 174 kind: Tuple span: 1:21-65 children: - - 168 - - 169 - - 170 - parent: 172 -- id: 172 + - 171 + - 172 + - 173 + parent: 175 +- id: 175 kind: 'TransformCall: Select' span: 1:14-65 children: - - 166 - - 171 - parent: 174 -- id: 174 + - 169 + - 174 + parent: 177 +- id: 177 kind: 'TransformCall: Take' span: 1:66-72 children: - - 172 - 175 - parent: 176 -- id: 175 + - 178 + parent: 179 +- id: 178 kind: Literal - parent: 174 -- id: 176 + parent: 177 +- id: 179 kind: 'TransformCall: Append' span: 1:73-156 children: - - 174 - - 156 - parent: 177 -- id: 177 + - 177 + - 159 + parent: 180 +- id: 180 kind: 'TransformCall: Append' span: 1:157-244 children: - - 176 - - 135 - parent: 181 -- id: 178 + - 179 + - 138 + parent: 184 +- id: 181 kind: Ident span: 1:254-269 ident: !Ident @@ -452,9 +452,9 @@ nodes: - invoices - billing_country targets: - - 170 - parent: 180 -- id: 179 + - 173 + parent: 183 +- id: 182 kind: Ident span: 1:271-281 ident: !Ident @@ -462,21 +462,21 @@ nodes: - invoices - invoice_id targets: - - 169 - parent: 180 -- id: 180 + - 172 + parent: 183 +- id: 183 kind: Tuple span: 1:252-283 children: - - 178 - - 179 - parent: 181 -- id: 181 + - 181 + - 182 + parent: 184 +- id: 184 kind: 'TransformCall: Select' span: 1:245-283 children: - - 177 - 180 + - 183 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_nulls.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_nulls.snap index 3b99f97e1c83..44e4a658b5e8 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_nulls.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_nulls.snap @@ -9,15 +9,15 @@ frames: - !Single name: - an_id - target_id: 143 + target_id: 146 target_name: null - !Single name: - name - target_id: 144 + target_id: 147 target_name: null inputs: - - id: 141 + - id: 144 name: invoices table: - default_db @@ -27,15 +27,15 @@ frames: - !Single name: - an_id - target_id: 143 + target_id: 146 target_name: null - !Single name: - name - target_id: 144 + target_id: 147 target_name: null inputs: - - id: 141 + - id: 144 name: invoices table: - default_db @@ -45,15 +45,15 @@ frames: - !Single name: - an_id - target_id: 126 + target_id: 129 target_name: null - !Single name: - name - target_id: 127 + target_id: 130 target_name: null inputs: - - id: 124 + - id: 127 name: employees table: - default_db @@ -63,15 +63,15 @@ frames: - !Single name: - an_id - target_id: 126 + target_id: 129 target_name: null - !Single name: - name - target_id: 127 + target_id: 130 target_name: null inputs: - - id: 124 + - id: 127 name: employees table: - default_db @@ -81,38 +81,38 @@ frames: - !Single name: - an_id - target_id: 143 + target_id: 146 target_name: null - !Single name: - name - target_id: 144 + target_id: 147 target_name: null inputs: - - id: 141 + - id: 144 name: invoices table: - default_db - invoices - - id: 124 + - id: 127 name: employees table: - default_db - employees nodes: -- id: 124 +- id: 127 kind: Ident span: 1:73-87 ident: !Ident - default_db - employees - parent: 129 -- id: 126 + parent: 132 +- id: 129 kind: Literal span: 1:106-110 alias: an_id - parent: 128 -- id: 127 + parent: 131 +- id: 130 kind: Ident span: 1:119-129 alias: name @@ -121,40 +121,40 @@ nodes: - employees - first_name targets: - - 124 - parent: 128 -- id: 128 + - 127 + parent: 131 +- id: 131 kind: Tuple span: 1:97-130 children: - - 126 - - 127 - parent: 129 -- id: 129 + - 129 + - 130 + parent: 132 +- id: 132 kind: 'TransformCall: Select' span: 1:90-130 children: - - 124 - - 128 - parent: 131 -- id: 131 + - 127 + - 131 + parent: 134 +- id: 134 kind: 'TransformCall: Take' span: 1:133-139 children: - - 129 - 132 - parent: 150 -- id: 132 + - 135 + parent: 153 +- id: 135 kind: Literal - parent: 131 -- id: 141 + parent: 134 +- id: 144 kind: Ident span: 1:0-13 ident: !Ident - default_db - invoices - parent: 146 -- id: 143 + parent: 149 +- id: 146 kind: Ident span: 1:30-40 alias: an_id @@ -163,43 +163,43 @@ nodes: - invoices - invoice_id targets: - - 141 - parent: 145 -- id: 144 + - 144 + parent: 148 +- id: 147 kind: Literal span: 1:49-53 alias: name - parent: 145 -- id: 145 + parent: 148 +- id: 148 kind: Tuple span: 1:21-54 children: - - 143 - - 144 - parent: 146 -- id: 146 + - 146 + - 147 + parent: 149 +- id: 149 kind: 'TransformCall: Select' span: 1:14-54 children: - - 141 - - 145 - parent: 148 -- id: 148 + - 144 + - 148 + parent: 151 +- id: 151 kind: 'TransformCall: Take' span: 1:55-61 children: - - 146 - 149 - parent: 150 -- id: 149 + - 152 + parent: 153 +- id: 152 kind: Literal - parent: 148 -- id: 150 + parent: 151 +- id: 153 kind: 'TransformCall: Append' span: 1:62-141 children: - - 148 - - 131 + - 151 + - 134 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_simple.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_simple.snap index bbd4f0cf1613..2c9bc7389654 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_simple.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__append_select_simple.snap @@ -10,16 +10,16 @@ frames: name: - invoices - invoice_id - target_id: 140 + target_id: 143 target_name: null - !Single name: - invoices - billing_country - target_id: 141 + target_id: 144 target_name: null inputs: - - id: 138 + - id: 141 name: invoices table: - default_db @@ -29,16 +29,16 @@ frames: - !Single name: - invoice_id - target_id: 126 + target_id: 129 target_name: null - !Single name: - invoices - billing_country - target_id: 130 + target_id: 133 target_name: null inputs: - - id: 124 + - id: 127 name: invoices table: - default_db @@ -49,21 +49,21 @@ frames: name: - invoices - invoice_id - target_id: 140 + target_id: 143 target_name: null - !Single name: - invoices - billing_country - target_id: 141 + target_id: 144 target_name: null inputs: - - id: 138 + - id: 141 name: invoices table: - default_db - invoices - - id: 124 + - id: 127 name: invoices table: - default_db @@ -74,42 +74,42 @@ frames: name: - invoices - invoice_id - target_id: 140 + target_id: 143 target_name: null - !Single name: - invoices - billing_country - target_id: 141 + target_id: 144 target_name: null inputs: - - id: 138 + - id: 141 name: invoices table: - default_db - invoices - - id: 124 + - id: 127 name: invoices table: - default_db - invoices nodes: -- id: 124 +- id: 127 kind: Ident span: 1:64-77 ident: !Ident - default_db - invoices - parent: 132 -- id: 126 + parent: 135 +- id: 129 kind: RqOperator span: 1:102-120 alias: invoice_id targets: - - 128 - - 129 - parent: 131 -- id: 128 + - 131 + - 132 + parent: 134 +- id: 131 kind: Ident span: 1:102-114 ident: !Ident @@ -117,11 +117,11 @@ nodes: - invoices - invoice_id targets: - - 124 -- id: 129 + - 127 +- id: 132 kind: Literal span: 1:117-120 -- id: 130 +- id: 133 kind: Ident span: 1:122-137 ident: !Ident @@ -129,30 +129,30 @@ nodes: - invoices - billing_country targets: - - 124 - parent: 131 -- id: 131 + - 127 + parent: 134 +- id: 134 kind: Tuple span: 1:87-139 children: - - 126 - - 130 - parent: 132 -- id: 132 + - 129 + - 133 + parent: 135 +- id: 135 kind: 'TransformCall: Select' span: 1:80-139 children: - - 124 - - 131 - parent: 144 -- id: 138 + - 127 + - 134 + parent: 147 +- id: 141 kind: Ident span: 1:0-13 ident: !Ident - default_db - invoices - parent: 143 -- id: 140 + parent: 146 +- id: 143 kind: Ident span: 1:23-33 ident: !Ident @@ -160,9 +160,9 @@ nodes: - invoices - invoice_id targets: - - 138 - parent: 142 -- id: 141 + - 141 + parent: 145 +- id: 144 kind: Ident span: 1:35-50 ident: !Ident @@ -170,40 +170,40 @@ nodes: - invoices - billing_country targets: - - 138 - parent: 142 -- id: 142 + - 141 + parent: 145 +- id: 145 kind: Tuple span: 1:21-52 children: - - 140 - - 141 - parent: 143 -- id: 143 + - 143 + - 144 + parent: 146 +- id: 146 kind: 'TransformCall: Select' span: 1:14-52 children: - - 138 - - 142 - parent: 144 -- id: 144 + - 141 + - 145 + parent: 147 +- id: 147 kind: 'TransformCall: Append' span: 1:53-141 children: - - 143 - - 132 - parent: 150 -- id: 145 + - 146 + - 135 + parent: 153 +- id: 148 kind: RqOperator span: 1:168-189 targets: - - 148 - - 149 - parent: 150 -- id: 148 + - 151 + - 152 + parent: 153 +- id: 151 kind: Literal span: 1:185-188 -- id: 149 +- id: 152 kind: Ident span: 1:150-165 ident: !Ident @@ -211,13 +211,13 @@ nodes: - invoices - billing_country targets: - - 141 -- id: 150 + - 144 +- id: 153 kind: 'TransformCall: Filter' span: 1:142-190 children: - - 144 - - 145 + - 147 + - 148 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__arithmetic.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__arithmetic.snap index c4254d6fc762..5415b91c186b 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__arithmetic.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__arithmetic.snap @@ -8,875 +8,875 @@ frames: - columns: - !Single name: - - _literal_121 + - _literal_124 - id - target_id: 163 + target_id: 166 target_name: null - !Single name: null - target_id: 164 + target_id: 167 target_name: null - !Single name: null - target_id: 168 + target_id: 171 target_name: null - !Single name: null - target_id: 172 + target_id: 175 target_name: null - !Single name: null - target_id: 176 + target_id: 179 target_name: null - !Single name: - q_ii - target_id: 180 + target_id: 183 target_name: null - !Single name: - q_if - target_id: 184 + target_id: 187 target_name: null - !Single name: - q_fi - target_id: 188 + target_id: 191 target_name: null - !Single name: - q_ff - target_id: 192 + target_id: 195 target_name: null - !Single name: - r_ii - target_id: 196 + target_id: 199 target_name: null - !Single name: - r_if - target_id: 200 + target_id: 203 target_name: null - !Single name: - r_fi - target_id: 204 + target_id: 207 target_name: null - !Single name: - r_ff - target_id: 208 + target_id: 211 target_name: null - !Single name: null - target_id: 212 + target_id: 215 target_name: null - !Single name: null - target_id: 223 + target_id: 226 target_name: null - !Single name: null - target_id: 234 + target_id: 237 target_name: null - !Single name: null - target_id: 245 + target_id: 248 target_name: null inputs: - - id: 121 - name: _literal_121 + - id: 124 + name: _literal_124 table: - default_db - - _literal_121 + - _literal_124 - - 1:825-832 - columns: - !Single name: - - _literal_121 + - _literal_124 - id - target_id: 163 + target_id: 166 target_name: null - !Single name: null - target_id: 164 + target_id: 167 target_name: null - !Single name: null - target_id: 168 + target_id: 171 target_name: null - !Single name: null - target_id: 172 + target_id: 175 target_name: null - !Single name: null - target_id: 176 + target_id: 179 target_name: null - !Single name: - q_ii - target_id: 180 + target_id: 183 target_name: null - !Single name: - q_if - target_id: 184 + target_id: 187 target_name: null - !Single name: - q_fi - target_id: 188 + target_id: 191 target_name: null - !Single name: - q_ff - target_id: 192 + target_id: 195 target_name: null - !Single name: - r_ii - target_id: 196 + target_id: 199 target_name: null - !Single name: - r_if - target_id: 200 + target_id: 203 target_name: null - !Single name: - r_fi - target_id: 204 + target_id: 207 target_name: null - !Single name: - r_ff - target_id: 208 + target_id: 211 target_name: null - !Single name: null - target_id: 212 + target_id: 215 target_name: null - !Single name: null - target_id: 223 + target_id: 226 target_name: null - !Single name: null - target_id: 234 + target_id: 237 target_name: null - !Single name: null - target_id: 245 + target_id: 248 target_name: null inputs: - - id: 121 - name: _literal_121 + - id: 124 + name: _literal_124 table: - default_db - - _literal_121 + - _literal_124 nodes: -- id: 121 +- id: 124 kind: Array span: 1:13-317 children: - - 122 - - 128 - - 138 - - 148 - parent: 257 -- id: 122 + - 125 + - 131 + - 141 + - 151 + parent: 260 +- id: 125 kind: Tuple span: 1:24-92 children: - - 123 - - 124 - - 125 - 126 - 127 - parent: 121 -- id: 123 + - 128 + - 129 + - 130 + parent: 124 +- id: 126 kind: Literal span: 1:31-32 alias: id - parent: 122 -- id: 124 + parent: 125 +- id: 127 kind: Literal span: 1:43-45 alias: x_int - parent: 122 -- id: 125 + parent: 125 +- id: 128 kind: Literal span: 1:58-62 alias: x_float - parent: 122 -- id: 126 + parent: 125 +- id: 129 kind: Literal span: 1:73-74 alias: k_int - parent: 122 -- id: 127 + parent: 125 +- id: 130 kind: Literal span: 1:87-90 alias: k_float - parent: 122 -- id: 128 + parent: 125 +- id: 131 kind: Tuple span: 1:98-166 children: - - 129 - - 130 + - 132 - 133 - 136 - - 137 - parent: 121 -- id: 129 + - 139 + - 140 + parent: 124 +- id: 132 kind: Literal span: 1:105-106 alias: id - parent: 128 -- id: 130 + parent: 131 +- id: 133 kind: Literal span: 1:116-119 alias: x_int - parent: 128 -- id: 133 + parent: 131 +- id: 136 kind: Literal span: 1:131-136 alias: x_float - parent: 128 -- id: 136 + parent: 131 +- id: 139 kind: Literal span: 1:147-148 alias: k_int - parent: 128 -- id: 137 + parent: 131 +- id: 140 kind: Literal span: 1:161-164 alias: k_float - parent: 128 -- id: 138 + parent: 131 +- id: 141 kind: Tuple span: 1:172-240 children: - - 139 - - 140 - - 141 - 142 + - 143 + - 144 - 145 - parent: 121 -- id: 139 + - 148 + parent: 124 +- id: 142 kind: Literal span: 1:179-180 alias: id - parent: 138 -- id: 140 + parent: 141 +- id: 143 kind: Literal span: 1:191-193 alias: x_int - parent: 138 -- id: 141 + parent: 141 +- id: 144 kind: Literal span: 1:206-210 alias: x_float - parent: 138 -- id: 142 + parent: 141 +- id: 145 kind: Literal span: 1:220-222 alias: k_int - parent: 138 -- id: 145 + parent: 141 +- id: 148 kind: Literal span: 1:234-238 alias: k_float - parent: 138 -- id: 148 + parent: 141 +- id: 151 kind: Tuple span: 1:246-314 children: - - 149 - - 150 + - 152 - 153 - 156 - 159 - parent: 121 -- id: 149 + - 162 + parent: 124 +- id: 152 kind: Literal span: 1:253-254 alias: id - parent: 148 -- id: 150 + parent: 151 +- id: 153 kind: Literal span: 1:264-267 alias: x_int - parent: 148 -- id: 153 + parent: 151 +- id: 156 kind: Literal span: 1:279-284 alias: x_float - parent: 148 -- id: 156 + parent: 151 +- id: 159 kind: Literal span: 1:294-296 alias: k_int - parent: 148 -- id: 159 + parent: 151 +- id: 162 kind: Literal span: 1:308-312 alias: k_float - parent: 148 -- id: 163 + parent: 151 +- id: 166 kind: Ident span: 1:331-333 ident: !Ident - this - - _literal_121 + - _literal_124 - id targets: - - 121 - parent: 256 -- id: 164 + - 124 + parent: 259 +- id: 167 kind: RqOperator span: 1:340-353 targets: - - 166 - - 167 - parent: 256 -- id: 166 + - 169 + - 170 + parent: 259 +- id: 169 kind: Ident span: 1:340-345 ident: !Ident - this - - _literal_121 + - _literal_124 - x_int targets: - - 121 -- id: 167 + - 124 +- id: 170 kind: Ident span: 1:348-353 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 168 + - 124 +- id: 171 kind: RqOperator span: 1:359-374 targets: - - 170 - - 171 - parent: 256 -- id: 170 + - 173 + - 174 + parent: 259 +- id: 173 kind: Ident span: 1:359-364 ident: !Ident - this - - _literal_121 + - _literal_124 - x_int targets: - - 121 -- id: 171 + - 124 +- id: 174 kind: Ident span: 1:367-374 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 172 + - 124 +- id: 175 kind: RqOperator span: 1:380-395 targets: - - 174 - - 175 - parent: 256 -- id: 174 + - 177 + - 178 + parent: 259 +- id: 177 kind: Ident span: 1:380-387 ident: !Ident - this - - _literal_121 + - _literal_124 - x_float targets: - - 121 -- id: 175 + - 124 +- id: 178 kind: Ident span: 1:390-395 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 176 + - 124 +- id: 179 kind: RqOperator span: 1:401-418 targets: - - 178 - - 179 - parent: 256 -- id: 178 + - 181 + - 182 + parent: 259 +- id: 181 kind: Ident span: 1:401-408 ident: !Ident - this - - _literal_121 + - _literal_124 - x_float targets: - - 121 -- id: 179 + - 124 +- id: 182 kind: Ident span: 1:411-418 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 180 + - 124 +- id: 183 kind: RqOperator span: 1:432-446 alias: q_ii targets: - - 182 - - 183 - parent: 256 -- id: 182 + - 185 + - 186 + parent: 259 +- id: 185 kind: Ident span: 1:432-437 ident: !Ident - this - - _literal_121 + - _literal_124 - x_int targets: - - 121 -- id: 183 + - 124 +- id: 186 kind: Ident span: 1:441-446 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 184 + - 124 +- id: 187 kind: RqOperator span: 1:459-475 alias: q_if targets: - - 186 - - 187 - parent: 256 -- id: 186 + - 189 + - 190 + parent: 259 +- id: 189 kind: Ident span: 1:459-464 ident: !Ident - this - - _literal_121 + - _literal_124 - x_int targets: - - 121 -- id: 187 + - 124 +- id: 190 kind: Ident span: 1:468-475 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 188 + - 124 +- id: 191 kind: RqOperator span: 1:488-504 alias: q_fi targets: - - 190 - - 191 - parent: 256 -- id: 190 + - 193 + - 194 + parent: 259 +- id: 193 kind: Ident span: 1:488-495 ident: !Ident - this - - _literal_121 + - _literal_124 - x_float targets: - - 121 -- id: 191 + - 124 +- id: 194 kind: Ident span: 1:499-504 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 192 + - 124 +- id: 195 kind: RqOperator span: 1:517-535 alias: q_ff targets: - - 194 - - 195 - parent: 256 -- id: 194 + - 197 + - 198 + parent: 259 +- id: 197 kind: Ident span: 1:517-524 ident: !Ident - this - - _literal_121 + - _literal_124 - x_float targets: - - 121 -- id: 195 + - 124 +- id: 198 kind: Ident span: 1:528-535 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 196 + - 124 +- id: 199 kind: RqOperator span: 1:549-562 alias: r_ii targets: - - 198 - - 199 - parent: 256 -- id: 198 + - 201 + - 202 + parent: 259 +- id: 201 kind: Ident span: 1:549-554 ident: !Ident - this - - _literal_121 + - _literal_124 - x_int targets: - - 121 -- id: 199 + - 124 +- id: 202 kind: Ident span: 1:557-562 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 200 + - 124 +- id: 203 kind: RqOperator span: 1:575-590 alias: r_if targets: - - 202 - - 203 - parent: 256 -- id: 202 + - 205 + - 206 + parent: 259 +- id: 205 kind: Ident span: 1:575-580 ident: !Ident - this - - _literal_121 + - _literal_124 - x_int targets: - - 121 -- id: 203 + - 124 +- id: 206 kind: Ident span: 1:583-590 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 204 + - 124 +- id: 207 kind: RqOperator span: 1:603-618 alias: r_fi targets: - - 206 - - 207 - parent: 256 -- id: 206 + - 209 + - 210 + parent: 259 +- id: 209 kind: Ident span: 1:603-610 ident: !Ident - this - - _literal_121 + - _literal_124 - x_float targets: - - 121 -- id: 207 + - 124 +- id: 210 kind: Ident span: 1:613-618 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 208 + - 124 +- id: 211 kind: RqOperator span: 1:631-648 alias: r_ff targets: - - 210 - - 211 - parent: 256 -- id: 210 + - 213 + - 214 + parent: 259 +- id: 213 kind: Ident span: 1:631-638 ident: !Ident - this - - _literal_121 + - _literal_124 - x_float targets: - - 121 -- id: 211 + - 124 +- id: 214 kind: Ident span: 1:641-648 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 212 + - 124 +- id: 215 kind: RqOperator span: 1:678-690 targets: - - 215 - - 216 - parent: 256 -- id: 215 + - 218 + - 219 + parent: 259 +- id: 218 kind: Literal span: 1:689-690 -- id: 216 +- id: 219 kind: RqOperator span: 1:656-675 targets: - - 218 - - 222 -- id: 218 + - 221 + - 225 +- id: 221 kind: RqOperator span: 1:656-668 targets: - - 220 - - 221 -- id: 220 + - 223 + - 224 +- id: 223 kind: Ident span: 1:656-660 ident: !Ident - this - q_ii targets: - - 180 -- id: 221 + - 183 +- id: 224 kind: Ident span: 1:663-668 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 222 + - 124 +- id: 225 kind: Ident span: 1:671-675 ident: !Ident - this - r_ii targets: - - 196 -- id: 223 + - 199 +- id: 226 kind: RqOperator span: 1:722-734 targets: - - 226 - - 227 - parent: 256 -- id: 226 + - 229 + - 230 + parent: 259 +- id: 229 kind: Literal span: 1:733-734 -- id: 227 +- id: 230 kind: RqOperator span: 1:698-719 targets: - - 229 - - 233 -- id: 229 + - 232 + - 236 +- id: 232 kind: RqOperator span: 1:698-712 targets: - - 231 - - 232 -- id: 231 + - 234 + - 235 +- id: 234 kind: Ident span: 1:698-702 ident: !Ident - this - q_if targets: - - 184 -- id: 232 + - 187 +- id: 235 kind: Ident span: 1:705-712 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 233 + - 124 +- id: 236 kind: Ident span: 1:715-719 ident: !Ident - this - r_if targets: - - 200 -- id: 234 + - 203 +- id: 237 kind: RqOperator span: 1:764-776 targets: - - 237 - - 238 - parent: 256 -- id: 237 + - 240 + - 241 + parent: 259 +- id: 240 kind: Literal span: 1:775-776 -- id: 238 +- id: 241 kind: RqOperator span: 1:742-761 targets: - - 240 - - 244 -- id: 240 + - 243 + - 247 +- id: 243 kind: RqOperator span: 1:742-754 targets: - - 242 - - 243 -- id: 242 + - 245 + - 246 +- id: 245 kind: Ident span: 1:742-746 ident: !Ident - this - q_fi targets: - - 188 -- id: 243 + - 191 +- id: 246 kind: Ident span: 1:749-754 ident: !Ident - this - - _literal_121 + - _literal_124 - k_int targets: - - 121 -- id: 244 + - 124 +- id: 247 kind: Ident span: 1:757-761 ident: !Ident - this - r_fi targets: - - 204 -- id: 245 + - 207 +- id: 248 kind: RqOperator span: 1:808-820 targets: - - 248 - - 249 - parent: 256 -- id: 248 + - 251 + - 252 + parent: 259 +- id: 251 kind: Literal span: 1:819-820 -- id: 249 +- id: 252 kind: RqOperator span: 1:784-805 targets: - - 251 - - 255 -- id: 251 + - 254 + - 258 +- id: 254 kind: RqOperator span: 1:784-798 targets: - - 253 - - 254 -- id: 253 + - 256 + - 257 +- id: 256 kind: Ident span: 1:784-788 ident: !Ident - this - q_ff targets: - - 192 -- id: 254 + - 195 +- id: 257 kind: Ident span: 1:791-798 ident: !Ident - this - - _literal_121 + - _literal_124 - k_float targets: - - 121 -- id: 255 + - 124 +- id: 258 kind: Ident span: 1:801-805 ident: !Ident - this - r_ff targets: - - 208 -- id: 256 + - 211 +- id: 259 kind: Tuple span: 1:325-824 children: - - 163 - - 164 - - 168 - - 172 - - 176 - - 180 - - 184 - - 188 - - 192 - - 196 - - 200 - - 204 - - 208 - - 212 - - 223 - - 234 - - 245 - parent: 257 -- id: 257 + - 166 + - 167 + - 171 + - 175 + - 179 + - 183 + - 187 + - 191 + - 195 + - 199 + - 203 + - 207 + - 211 + - 215 + - 226 + - 237 + - 248 + parent: 260 +- id: 260 kind: 'TransformCall: Select' span: 1:318-824 children: - - 121 - - 256 - parent: 260 -- id: 258 + - 124 + - 259 + parent: 263 +- id: 261 kind: Ident span: 1:830-832 ident: !Ident - this - - _literal_121 + - _literal_124 - id targets: - - 163 - parent: 260 -- id: 260 + - 166 + parent: 263 +- id: 263 kind: 'TransformCall: Sort' span: 1:825-832 children: - - 257 - - 258 + - 260 + - 261 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__cast.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__cast.snap index 4b4b7e6a1c67..b769dfa0f94b 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__cast.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__cast.snap @@ -7,10 +7,10 @@ frames: - - 1:25-38 - columns: - !All - input_id: 124 + input_id: 127 except: [] inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -21,15 +21,15 @@ frames: name: - tracks - name - target_id: 131 + target_id: 134 target_name: null - !Single name: - bin - target_id: 132 + target_id: 135 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -40,28 +40,28 @@ frames: name: - tracks - name - target_id: 131 + target_id: 134 target_name: null - !Single name: - bin - target_id: 132 + target_id: 135 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db - tracks nodes: -- id: 124 +- id: 127 kind: Ident span: 1:13-24 ident: !Ident - default_db - tracks - parent: 130 -- id: 128 + parent: 133 +- id: 131 kind: Ident span: 1:32-37 ident: !Ident @@ -69,16 +69,16 @@ nodes: - tracks - bytes targets: - - 124 - parent: 130 -- id: 130 + - 127 + parent: 133 +- id: 133 kind: 'TransformCall: Sort' span: 1:25-38 children: - - 124 - - 128 - parent: 140 -- id: 131 + - 127 + - 131 + parent: 143 +- id: 134 kind: Ident span: 1:52-56 ident: !Ident @@ -86,22 +86,22 @@ nodes: - tracks - name targets: - - 124 - parent: 139 -- id: 132 + - 127 + parent: 142 +- id: 135 kind: RqOperator span: 1:68-95 alias: bin targets: - - 134 - - 138 - parent: 139 -- id: 134 + - 137 + - 141 + parent: 142 +- id: 137 kind: RqOperator span: 1:81-88 targets: - - 137 -- id: 137 + - 140 +- id: 140 kind: Ident span: 1:70-78 ident: !Ident @@ -109,33 +109,33 @@ nodes: - tracks - album_id targets: - - 124 -- id: 138 + - 127 +- id: 141 kind: Literal span: 1:92-94 -- id: 139 +- id: 142 kind: Tuple span: 1:46-97 children: - - 131 - - 132 - parent: 140 -- id: 140 + - 134 + - 135 + parent: 143 +- id: 143 kind: 'TransformCall: Select' span: 1:39-97 children: - - 130 - - 139 - parent: 142 -- id: 142 + - 133 + - 142 + parent: 145 +- id: 145 kind: 'TransformCall: Take' span: 1:98-105 children: - - 140 - 143 -- id: 143 + - 146 +- id: 146 kind: Literal - parent: 142 + parent: 145 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__constants_only.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__constants_only.snap index 29b0129956ed..8b2edab69442 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__constants_only.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__constants_only.snap @@ -7,10 +7,10 @@ frames: - - 1:12-19 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: genres table: - default_db @@ -18,10 +18,10 @@ frames: - - 1:20-31 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: genres table: - default_db @@ -29,10 +29,10 @@ frames: - - 1:32-39 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: genres table: - default_db @@ -40,10 +40,10 @@ frames: - - 1:40-51 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: genres table: - default_db @@ -53,81 +53,81 @@ frames: - !Single name: - d - target_id: 142 + target_id: 145 target_name: null inputs: - - id: 130 + - id: 133 name: genres table: - default_db - genres nodes: -- id: 130 +- id: 133 kind: Ident span: 1:0-11 ident: !Ident - default_db - genres - parent: 133 -- id: 133 + parent: 136 +- id: 136 kind: 'TransformCall: Take' span: 1:12-19 children: - - 130 - - 134 - parent: 136 -- id: 134 + - 133 + - 137 + parent: 139 +- id: 137 kind: Literal - parent: 133 -- id: 135 + parent: 136 +- id: 138 kind: Literal span: 1:27-31 - parent: 136 -- id: 136 + parent: 139 +- id: 139 kind: 'TransformCall: Filter' span: 1:20-31 children: - - 133 - - 135 - parent: 138 -- id: 138 + - 136 + - 138 + parent: 141 +- id: 141 kind: 'TransformCall: Take' span: 1:32-39 children: - - 136 - 139 - parent: 141 -- id: 139 + - 142 + parent: 144 +- id: 142 kind: Literal - parent: 138 -- id: 140 + parent: 141 +- id: 143 kind: Literal span: 1:47-51 - parent: 141 -- id: 141 + parent: 144 +- id: 144 kind: 'TransformCall: Filter' span: 1:40-51 children: - - 138 - - 140 - parent: 144 -- id: 142 + - 141 + - 143 + parent: 147 +- id: 145 kind: Literal span: 1:63-65 alias: d - parent: 143 -- id: 143 + parent: 146 +- id: 146 kind: Tuple span: 1:63-65 children: - - 142 - parent: 144 -- id: 144 + - 145 + parent: 147 +- id: 147 kind: 'TransformCall: Select' span: 1:52-65 children: - - 141 - - 143 + - 144 + - 146 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__date_to_text.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__date_to_text.snap index 108921396c32..d8cfeb8a2bdf 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__date_to_text.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__date_to_text.snap @@ -7,10 +7,10 @@ frames: - - 1:71-78 - columns: - !All - input_id: 121 + input_id: 124 except: [] inputs: - - id: 121 + - id: 124 name: invoices table: - default_db @@ -20,99 +20,99 @@ frames: - !Single name: - d1 - target_id: 126 + target_id: 129 target_name: null - !Single name: - d2 - target_id: 131 + target_id: 134 target_name: null - !Single name: - d3 - target_id: 136 + target_id: 139 target_name: null - !Single name: - d4 - target_id: 141 + target_id: 144 target_name: null - !Single name: - d5 - target_id: 146 + target_id: 149 target_name: null - !Single name: - d6 - target_id: 151 + target_id: 154 target_name: null - !Single name: - d7 - target_id: 156 + target_id: 159 target_name: null - !Single name: - d8 - target_id: 161 + target_id: 164 target_name: null - !Single name: - d9 - target_id: 166 + target_id: 169 target_name: null - !Single name: - d10 - target_id: 171 + target_id: 174 target_name: null - !Single name: - d11 - target_id: 176 + target_id: 179 target_name: null - !Single name: - d12 - target_id: 181 + target_id: 184 target_name: null inputs: - - id: 121 + - id: 124 name: invoices table: - default_db - invoices nodes: -- id: 121 +- id: 124 kind: Ident span: 1:57-70 ident: !Ident - default_db - invoices - parent: 124 -- id: 124 + parent: 127 +- id: 127 kind: 'TransformCall: Take' span: 1:71-78 children: - - 121 - - 125 - parent: 187 -- id: 125 + - 124 + - 128 + parent: 190 +- id: 128 kind: Literal - parent: 124 -- id: 126 + parent: 127 +- id: 129 kind: RqOperator span: 1:113-136 alias: d1 targets: - - 129 - - 130 - parent: 186 -- id: 129 + - 132 + - 133 + parent: 189 +- id: 132 kind: Literal span: 1:126-136 -- id: 130 +- id: 133 kind: Ident span: 1:98-110 ident: !Ident @@ -120,19 +120,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 131 + - 124 +- id: 134 kind: RqOperator span: 1:164-181 alias: d2 targets: - - 134 - - 135 - parent: 186 -- id: 134 + - 137 + - 138 + parent: 189 +- id: 137 kind: Literal span: 1:177-181 -- id: 135 +- id: 138 kind: Ident span: 1:149-161 ident: !Ident @@ -140,19 +140,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 136 + - 124 +- id: 139 kind: RqOperator span: 1:209-226 alias: d3 targets: - - 139 - - 140 - parent: 186 -- id: 139 + - 142 + - 143 + parent: 189 +- id: 142 kind: Literal span: 1:222-226 -- id: 140 +- id: 143 kind: Ident span: 1:194-206 ident: !Ident @@ -160,19 +160,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 141 + - 124 +- id: 144 kind: RqOperator span: 1:254-280 alias: d4 targets: - - 144 - - 145 - parent: 186 -- id: 144 + - 147 + - 148 + parent: 189 +- id: 147 kind: Literal span: 1:267-280 -- id: 145 +- id: 148 kind: Ident span: 1:239-251 ident: !Ident @@ -180,19 +180,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 146 + - 124 +- id: 149 kind: RqOperator span: 1:308-325 alias: d5 targets: - - 149 - - 150 - parent: 186 -- id: 149 + - 152 + - 153 + parent: 189 +- id: 152 kind: Literal span: 1:321-325 -- id: 150 +- id: 153 kind: Ident span: 1:293-305 ident: !Ident @@ -200,19 +200,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 151 + - 124 +- id: 154 kind: RqOperator span: 1:353-380 alias: d6 targets: - - 154 - - 155 - parent: 186 -- id: 154 + - 157 + - 158 + parent: 189 +- id: 157 kind: Literal span: 1:366-380 -- id: 155 +- id: 158 kind: Ident span: 1:338-350 ident: !Ident @@ -220,19 +220,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 156 + - 124 +- id: 159 kind: RqOperator span: 1:408-451 alias: d7 targets: - - 159 - - 160 - parent: 186 -- id: 159 + - 162 + - 163 + parent: 189 +- id: 162 kind: Literal span: 1:421-451 -- id: 160 +- id: 163 kind: Ident span: 1:393-405 ident: !Ident @@ -240,19 +240,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 161 + - 124 +- id: 164 kind: RqOperator span: 1:479-496 alias: d8 targets: - - 164 - - 165 - parent: 186 -- id: 164 + - 167 + - 168 + parent: 189 +- id: 167 kind: Literal span: 1:492-496 -- id: 165 +- id: 168 kind: Ident span: 1:464-476 ident: !Ident @@ -260,19 +260,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 166 + - 124 +- id: 169 kind: RqOperator span: 1:524-549 alias: d9 targets: - - 169 - - 170 - parent: 186 -- id: 169 + - 172 + - 173 + parent: 189 +- id: 172 kind: Literal span: 1:537-549 -- id: 170 +- id: 173 kind: Ident span: 1:509-521 ident: !Ident @@ -280,19 +280,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 171 + - 124 +- id: 174 kind: RqOperator span: 1:578-603 alias: d10 targets: - - 174 - - 175 - parent: 186 -- id: 174 + - 177 + - 178 + parent: 189 +- id: 177 kind: Literal span: 1:591-603 -- id: 175 +- id: 178 kind: Ident span: 1:563-575 ident: !Ident @@ -300,19 +300,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 176 + - 124 +- id: 179 kind: RqOperator span: 1:632-654 alias: d11 targets: - - 179 - - 180 - parent: 186 -- id: 179 + - 182 + - 183 + parent: 189 +- id: 182 kind: Literal span: 1:645-654 -- id: 180 +- id: 183 kind: Ident span: 1:617-629 ident: !Ident @@ -320,19 +320,19 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 181 + - 124 +- id: 184 kind: RqOperator span: 1:683-714 alias: d12 targets: - - 184 - - 185 - parent: 186 -- id: 184 + - 187 + - 188 + parent: 189 +- id: 187 kind: Literal span: 1:696-714 -- id: 185 +- id: 188 kind: Ident span: 1:668-680 ident: !Ident @@ -340,30 +340,30 @@ nodes: - invoices - invoice_date targets: - - 121 -- id: 186 + - 124 +- id: 189 kind: Tuple span: 1:86-718 children: - - 126 - - 131 - - 136 - - 141 - - 146 - - 151 - - 156 - - 161 - - 166 - - 171 - - 176 - - 181 - parent: 187 -- id: 187 + - 129 + - 134 + - 139 + - 144 + - 149 + - 154 + - 159 + - 164 + - 169 + - 174 + - 179 + - 184 + parent: 190 +- id: 190 kind: 'TransformCall: Select' span: 1:79-718 children: - - 124 - - 186 + - 127 + - 189 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct.snap index 795c7558fc02..053307243c5e 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct.snap @@ -10,16 +10,16 @@ frames: name: - tracks - album_id - target_id: 126 + target_id: 129 target_name: null - !Single name: - tracks - genre_id - target_id: 127 + target_id: 130 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -30,16 +30,16 @@ frames: name: - tracks - album_id - target_id: 131 + target_id: 134 target_name: null - !Single name: - tracks - genre_id - target_id: 132 + target_id: 135 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -50,29 +50,29 @@ frames: name: - tracks - album_id - target_id: 131 + target_id: 134 target_name: null - !Single name: - tracks - genre_id - target_id: 132 + target_id: 135 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db - tracks nodes: -- id: 124 +- id: 127 kind: Ident span: 1:13-24 ident: !Ident - default_db - tracks - parent: 129 -- id: 126 + parent: 132 +- id: 129 kind: Ident span: 1:33-41 ident: !Ident @@ -80,9 +80,9 @@ nodes: - tracks - album_id targets: - - 124 - parent: 128 -- id: 127 + - 127 + parent: 131 +- id: 130 kind: Ident span: 1:43-51 ident: !Ident @@ -90,81 +90,81 @@ nodes: - tracks - genre_id targets: - - 124 - parent: 128 -- id: 128 + - 127 + parent: 131 +- id: 131 kind: Tuple span: 1:32-52 children: - - 126 - - 127 - parent: 129 -- id: 129 + - 129 + - 130 + parent: 132 +- id: 132 kind: 'TransformCall: Select' span: 1:25-52 children: - - 124 - - 128 - parent: 150 -- id: 131 + - 127 + - 131 + parent: 153 +- id: 134 kind: Ident ident: !Ident - this - tracks - album_id targets: - - 126 - parent: 133 -- id: 132 + - 129 + parent: 136 +- id: 135 kind: Ident ident: !Ident - this - tracks - genre_id targets: - - 127 - parent: 133 -- id: 133 + - 130 + parent: 136 +- id: 136 kind: Tuple span: 1:59-67 children: - - 131 - - 132 -- id: 150 + - 134 + - 135 +- id: 153 kind: 'TransformCall: Take' span: 1:69-75 children: - - 129 - - 151 - parent: 158 -- id: 151 + - 132 + - 154 + parent: 161 +- id: 154 kind: Literal - parent: 150 -- id: 155 + parent: 153 +- id: 158 kind: Ident ident: !Ident - this - tracks - album_id targets: - - 131 - parent: 158 -- id: 156 + - 134 + parent: 161 +- id: 159 kind: Ident ident: !Ident - this - tracks - genre_id targets: - - 132 - parent: 158 -- id: 158 + - 135 + parent: 161 +- id: 161 kind: 'TransformCall: Sort' span: 1:77-90 children: - - 150 - - 155 - - 156 + - 153 + - 158 + - 159 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct_on.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct_on.snap index 4d76751e4542..951acc1dc7e2 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct_on.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__distinct_on.snap @@ -10,22 +10,22 @@ frames: name: - tracks - genre_id - target_id: 126 + target_id: 129 target_name: null - !Single name: - tracks - media_type_id - target_id: 127 + target_id: 130 target_name: null - !Single name: - tracks - album_id - target_id: 128 + target_id: 131 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -36,22 +36,22 @@ frames: name: - tracks - genre_id - target_id: 131 + target_id: 134 target_name: null - !Single name: - tracks - media_type_id - target_id: 132 + target_id: 135 target_name: null - !Single name: - tracks - album_id - target_id: 128 + target_id: 131 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -62,35 +62,35 @@ frames: name: - tracks - genre_id - target_id: 131 + target_id: 134 target_name: null - !Single name: - tracks - media_type_id - target_id: 132 + target_id: 135 target_name: null - !Single name: - tracks - album_id - target_id: 128 + target_id: 131 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db - tracks nodes: -- id: 124 +- id: 127 kind: Ident span: 1:13-24 ident: !Ident - default_db - tracks - parent: 130 -- id: 126 + parent: 133 +- id: 129 kind: Ident span: 1:33-41 ident: !Ident @@ -98,9 +98,9 @@ nodes: - tracks - genre_id targets: - - 124 - parent: 129 -- id: 127 + - 127 + parent: 132 +- id: 130 kind: Ident span: 1:43-56 ident: !Ident @@ -108,9 +108,9 @@ nodes: - tracks - media_type_id targets: - - 124 - parent: 129 -- id: 128 + - 127 + parent: 132 +- id: 131 kind: Ident span: 1:58-66 ident: !Ident @@ -118,24 +118,24 @@ nodes: - tracks - album_id targets: - - 124 - parent: 129 -- id: 129 + - 127 + parent: 132 +- id: 132 kind: Tuple span: 1:32-67 children: - - 126 - - 127 - - 128 - parent: 130 -- id: 130 + - 129 + - 130 + - 131 + parent: 133 +- id: 133 kind: 'TransformCall: Select' span: 1:25-67 children: - - 124 - - 129 - parent: 162 -- id: 131 + - 127 + - 132 + parent: 165 +- id: 134 kind: Ident span: 1:75-83 ident: !Ident @@ -143,9 +143,9 @@ nodes: - tracks - genre_id targets: - - 126 - parent: 133 -- id: 132 + - 129 + parent: 136 +- id: 135 kind: Ident span: 1:85-98 ident: !Ident @@ -153,15 +153,15 @@ nodes: - tracks - media_type_id targets: - - 127 - parent: 133 -- id: 133 + - 130 + parent: 136 +- id: 136 kind: Tuple span: 1:74-99 children: - - 131 - - 132 -- id: 158 + - 134 + - 135 +- id: 161 kind: Ident span: 1:108-116 ident: !Ident @@ -169,18 +169,18 @@ nodes: - tracks - album_id targets: - - 128 -- id: 162 + - 131 +- id: 165 kind: 'TransformCall: Take' span: 1:120-126 children: - - 130 - - 163 - parent: 171 -- id: 163 + - 133 + - 166 + parent: 174 +- id: 166 kind: Literal - parent: 162 -- id: 168 + parent: 165 +- id: 171 kind: Ident span: 1:135-143 ident: !Ident @@ -188,9 +188,9 @@ nodes: - tracks - genre_id targets: - - 131 - parent: 171 -- id: 169 + - 134 + parent: 174 +- id: 172 kind: Ident span: 1:145-158 ident: !Ident @@ -198,15 +198,15 @@ nodes: - tracks - media_type_id targets: - - 132 - parent: 171 -- id: 171 + - 135 + parent: 174 +- id: 174 kind: 'TransformCall: Sort' span: 1:128-159 children: - - 162 - - 168 - - 169 + - 165 + - 171 + - 172 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__genre_counts.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__genre_counts.snap index 573296b35ce0..cb26500e1baf 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__genre_counts.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__genre_counts.snap @@ -10,10 +10,10 @@ frames: name: - genre_count - a - target_id: 136 + target_id: 139 target_name: a inputs: - - id: 136 + - id: 139 name: genre_count table: - default_db @@ -23,29 +23,29 @@ frames: - !Single name: - a - target_id: 143 + target_id: 146 target_name: null inputs: - - id: 136 + - id: 139 name: genre_count table: - default_db - genres nodes: -- id: 136 +- id: 139 kind: Ident span: 1:187-203 ident: !Ident - genre_count - parent: 142 -- id: 138 + parent: 145 +- id: 141 kind: RqOperator span: 1:211-216 targets: - - 140 - - 141 - parent: 142 -- id: 140 + - 143 + - 144 + parent: 145 +- id: 143 kind: Ident span: 1:211-212 ident: !Ident @@ -53,25 +53,25 @@ nodes: - genre_count - a targets: - - 136 -- id: 141 + - 139 +- id: 144 kind: Literal span: 1:215-216 -- id: 142 +- id: 145 kind: 'TransformCall: Filter' span: 1:204-216 children: - - 136 - - 138 - parent: 147 -- id: 143 + - 139 + - 141 + parent: 150 +- id: 146 kind: RqOperator span: 1:228-230 alias: a targets: - - 145 - parent: 146 -- id: 145 + - 148 + parent: 149 +- id: 148 kind: Ident span: 1:229-230 ident: !Ident @@ -79,19 +79,19 @@ nodes: - genre_count - a targets: - - 136 -- id: 146 + - 139 +- id: 149 kind: Tuple span: 1:228-230 children: - - 143 - parent: 147 -- id: 147 + - 146 + parent: 150 +- id: 150 kind: 'TransformCall: Select' span: 1:217-230 children: - - 142 - - 146 + - 145 + - 149 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_all.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_all.snap index 3f2cf5e44e75..1e4f971d35b7 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_all.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_all.snap @@ -7,10 +7,10 @@ frames: - - 1:27-34 - columns: - !All - input_id: 128 + input_id: 131 except: [] inputs: - - id: 128 + - id: 131 name: a table: - default_db @@ -18,18 +18,18 @@ frames: - - 1:35-59 - columns: - !All - input_id: 128 + input_id: 131 except: [] - !All - input_id: 122 + input_id: 125 except: [] inputs: - - id: 128 + - id: 131 name: a table: - default_db - albums - - id: 122 + - id: 125 name: tracks table: - default_db @@ -40,26 +40,26 @@ frames: name: - a - album_id - target_id: 138 + target_id: 141 target_name: null - !Single name: - a - title - target_id: 139 + target_id: 142 target_name: null - !Single name: - price - target_id: 157 + target_id: 160 target_name: null inputs: - - id: 128 + - id: 131 name: a table: - default_db - albums - - id: 122 + - id: 125 name: tracks table: - default_db @@ -70,63 +70,63 @@ frames: name: - a - album_id - target_id: 138 + target_id: 141 target_name: null - !Single name: - a - title - target_id: 139 + target_id: 142 target_name: null - !Single name: - price - target_id: 157 + target_id: 160 target_name: null inputs: - - id: 128 + - id: 131 name: a table: - default_db - albums - - id: 122 + - id: 125 name: tracks table: - default_db - tracks nodes: -- id: 122 +- id: 125 kind: Ident span: 1:40-46 ident: !Ident - default_db - tracks - parent: 137 -- id: 128 + parent: 140 +- id: 131 kind: Ident span: 1:13-26 ident: !Ident - default_db - albums - parent: 131 -- id: 131 + parent: 134 +- id: 134 kind: 'TransformCall: Take' span: 1:27-34 children: - - 128 - - 132 - parent: 137 -- id: 132 + - 131 + - 135 + parent: 140 +- id: 135 kind: Literal - parent: 131 -- id: 133 + parent: 134 +- id: 136 kind: RqOperator span: 1:48-58 targets: - - 135 - - 136 - parent: 137 -- id: 135 + - 138 + - 139 + parent: 140 +- id: 138 kind: Ident span: 1:50-58 ident: !Ident @@ -134,8 +134,8 @@ nodes: - a - album_id targets: - - 128 -- id: 136 + - 131 +- id: 139 kind: Ident span: 1:50-58 ident: !Ident @@ -143,16 +143,16 @@ nodes: - tracks - album_id targets: - - 122 -- id: 137 + - 125 +- id: 140 kind: 'TransformCall: Join' span: 1:35-59 children: - - 131 - - 122 - - 133 - parent: 165 -- id: 138 + - 134 + - 125 + - 136 + parent: 168 +- id: 141 kind: Ident span: 1:67-77 ident: !Ident @@ -160,9 +160,9 @@ nodes: - a - album_id targets: - - 128 - parent: 140 -- id: 139 + - 131 + parent: 143 +- id: 142 kind: Ident span: 1:79-86 ident: !Ident @@ -170,32 +170,32 @@ nodes: - a - title targets: - - 128 - parent: 140 -- id: 140 + - 131 + parent: 143 +- id: 143 kind: Tuple span: 1:66-87 children: - - 138 - - 139 - parent: 165 -- id: 157 + - 141 + - 142 + parent: 168 +- id: 160 kind: RqOperator span: 1:132-144 alias: price targets: - - 160 - - 161 - parent: 164 -- id: 160 + - 163 + - 164 + parent: 167 +- id: 163 kind: Literal span: 1:143-144 -- id: 161 +- id: 164 kind: RqOperator span: 1:108-129 targets: - - 163 -- id: 163 + - 166 +- id: 166 kind: Ident span: 1:112-129 ident: !Ident @@ -203,22 +203,22 @@ nodes: - tracks - unit_price targets: - - 122 -- id: 164 + - 125 +- id: 167 kind: Tuple span: 1:132-144 children: - - 157 - parent: 165 -- id: 165 + - 160 + parent: 168 +- id: 168 kind: 'TransformCall: Aggregate' span: 1:89-145 children: - - 137 - - 164 - 140 - parent: 170 -- id: 168 + - 167 + - 143 + parent: 173 +- id: 171 kind: Ident span: 1:152-160 ident: !Ident @@ -226,14 +226,14 @@ nodes: - a - album_id targets: - - 138 - parent: 170 -- id: 170 + - 141 + parent: 173 +- id: 173 kind: 'TransformCall: Sort' span: 1:147-160 children: - - 165 - 168 + - 171 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort.snap index 36318b3b7d14..07eca7dc2acb 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort.snap @@ -7,15 +7,15 @@ frames: - - 1:25-48 - columns: - !All - input_id: 130 + input_id: 133 except: [] - !Single name: - d - target_id: 132 + target_id: 135 target_name: null inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -25,15 +25,15 @@ frames: - !Single name: - d - target_id: 138 + target_id: 141 target_name: null - !Single name: - n1 - target_id: 155 + target_id: 158 target_name: null inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -43,15 +43,15 @@ frames: - !Single name: - d - target_id: 138 + target_id: 141 target_name: null - !Single name: - n1 - target_id: 155 + target_id: 158 target_name: null inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -61,15 +61,15 @@ frames: - !Single name: - d - target_id: 138 + target_id: 141 target_name: null - !Single name: - n1 - target_id: 155 + target_id: 158 target_name: null inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -79,36 +79,36 @@ frames: - !Single name: - d1 - target_id: 168 + target_id: 171 target_name: null - !Single name: - n1 - target_id: 169 + target_id: 172 target_name: null inputs: - - id: 130 + - id: 133 name: tracks table: - default_db - tracks nodes: -- id: 130 +- id: 133 kind: Ident span: 1:13-24 ident: !Ident - default_db - tracks - parent: 137 -- id: 132 + parent: 140 +- id: 135 kind: RqOperator span: 1:36-48 alias: d targets: - - 134 - - 135 - parent: 136 -- id: 134 + - 137 + - 138 + parent: 139 +- id: 137 kind: Ident span: 1:36-44 ident: !Ident @@ -116,46 +116,46 @@ nodes: - tracks - album_id targets: - - 130 -- id: 135 + - 133 +- id: 138 kind: Literal span: 1:47-48 -- id: 136 +- id: 139 kind: Tuple span: 1:36-48 children: - - 132 - parent: 137 -- id: 137 + - 135 + parent: 140 +- id: 140 kind: 'TransformCall: Derive' span: 1:25-48 children: - - 130 - - 136 - parent: 159 -- id: 138 + - 133 + - 139 + parent: 162 +- id: 141 kind: Ident span: 1:55-56 ident: !Ident - this - d targets: - - 132 - parent: 141 -- id: 141 + - 135 + parent: 144 +- id: 144 kind: Tuple span: 1:55-56 children: - - 138 - parent: 159 -- id: 155 + - 141 + parent: 162 +- id: 158 kind: RqOperator span: 1:100-103 alias: n1 targets: - - 157 - parent: 158 -- id: 157 + - 160 + parent: 161 +- id: 160 kind: Ident span: 1:89-97 ident: !Ident @@ -163,48 +163,48 @@ nodes: - tracks - track_id targets: - - 130 -- id: 158 + - 133 +- id: 161 kind: Tuple span: 1:73-111 children: - - 155 - parent: 159 -- id: 159 + - 158 + parent: 162 +- id: 162 kind: 'TransformCall: Aggregate' span: 1:63-111 children: - - 137 - - 158 - - 141 - parent: 164 -- id: 162 + - 140 + - 161 + - 144 + parent: 167 +- id: 165 kind: Ident span: 1:119-120 ident: !Ident - this - d targets: - - 138 - parent: 164 -- id: 164 + - 141 + parent: 167 +- id: 167 kind: 'TransformCall: Sort' span: 1:114-120 children: - - 159 - 162 - parent: 166 -- id: 166 + - 165 + parent: 169 +- id: 169 kind: 'TransformCall: Take' span: 1:121-128 children: - - 164 - 167 - parent: 171 -- id: 167 + - 170 + parent: 174 +- id: 170 kind: Literal - parent: 166 -- id: 168 + parent: 169 +- id: 171 kind: Ident span: 1:143-144 alias: d1 @@ -212,30 +212,30 @@ nodes: - this - d targets: - - 138 - parent: 170 -- id: 169 + - 141 + parent: 173 +- id: 172 kind: Ident span: 1:146-148 ident: !Ident - this - n1 targets: - - 155 - parent: 170 -- id: 170 + - 158 + parent: 173 +- id: 173 kind: Tuple span: 1:136-150 children: - - 168 - - 169 - parent: 171 -- id: 171 + - 171 + - 172 + parent: 174 +- id: 174 kind: 'TransformCall: Select' span: 1:129-150 children: - - 166 - - 170 + - 169 + - 173 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_derive_select_join.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_derive_select_join.snap index 3481618172d5..af05e95e1d4b 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_derive_select_join.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_derive_select_join.snap @@ -8,186 +8,186 @@ frames: - columns: - !Single name: - - _literal_129 + - _literal_132 - artist_id - target_id: 130 + target_id: 133 target_name: null - !Single name: - album_title_count - target_id: 149 + target_id: 152 target_name: null inputs: - - id: 129 - name: _literal_129 + - id: 132 + name: _literal_132 table: - default_db - - _literal_129 + - _literal_132 - - 1:119-164 - columns: - !Single name: - - _literal_129 + - _literal_132 - artist_id - target_id: 130 + target_id: 133 target_name: null - !Single name: - album_title_count - target_id: 149 + target_id: 152 target_name: null inputs: - - id: 129 - name: _literal_129 + - id: 132 + name: _literal_132 table: - default_db - - _literal_129 + - _literal_132 - - 1:165-214 - columns: - !Single name: - - _literal_129 + - _literal_132 - artist_id - target_id: 130 + target_id: 133 target_name: null - !Single name: - album_title_count - target_id: 149 + target_id: 152 target_name: null - !Single name: - new_album_count - target_id: 159 + target_id: 162 target_name: null inputs: - - id: 129 - name: _literal_129 + - id: 132 + name: _literal_132 table: - default_db - - _literal_129 + - _literal_132 - - 1:215-260 - columns: - !Single name: - - _literal_129 + - _literal_132 - artist_id - target_id: 162 + target_id: 165 target_name: null - !Single name: - new_album_count - target_id: 163 + target_id: 166 target_name: null inputs: - - id: 129 - name: _literal_129 + - id: 132 + name: _literal_132 table: - default_db - - _literal_129 + - _literal_132 - - 1:261-367 - columns: - !Single name: - - _literal_129 + - _literal_132 - artist_id - target_id: 162 + target_id: 165 target_name: null - !Single name: - new_album_count - target_id: 163 + target_id: 166 target_name: null - !All - input_id: 116 + input_id: 119 except: [] inputs: - - id: 129 - name: _literal_129 + - id: 132 + name: _literal_132 table: - default_db - - _literal_129 - - id: 116 - name: _literal_116 + - _literal_132 + - id: 119 + name: _literal_119 table: - default_db - - _literal_116 + - _literal_119 nodes: -- id: 116 +- id: 119 kind: SString span: 1:278-330 - parent: 170 -- id: 129 + parent: 173 +- id: 132 kind: SString span: 1:0-46 - parent: 152 -- id: 130 + parent: 155 +- id: 133 kind: Ident span: 1:54-63 ident: !Ident - this - - _literal_129 + - _literal_132 - artist_id targets: - - 129 - parent: 131 -- id: 131 + - 132 + parent: 134 +- id: 134 kind: Tuple span: 1:53-64 children: - - 130 - parent: 152 -- id: 149 + - 133 + parent: 155 +- id: 152 kind: RqOperator span: 1:98-116 alias: album_title_count targets: - - 150 - parent: 151 -- id: 150 + - 153 + parent: 154 +- id: 153 kind: Literal -- id: 151 +- id: 154 kind: Tuple span: 1:76-117 children: - - 149 - parent: 152 -- id: 152 + - 152 + parent: 155 +- id: 155 kind: 'TransformCall: Aggregate' span: 1:66-117 children: - - 129 - - 151 - - 131 - parent: 158 -- id: 155 + - 132 + - 154 + - 134 + parent: 161 +- id: 158 kind: Ident span: 1:125-139 ident: !Ident - this - - _literal_129 + - _literal_132 - artist_id targets: - - 130 - parent: 158 -- id: 156 + - 133 + parent: 161 +- id: 159 kind: Ident span: 1:141-163 ident: !Ident - this - album_title_count targets: - - 149 - parent: 158 -- id: 158 + - 152 + parent: 161 +- id: 161 kind: 'TransformCall: Sort' span: 1:119-164 children: - - 152 - 155 - - 156 - parent: 161 -- id: 159 + - 158 + - 159 + parent: 164 +- id: 162 kind: Ident span: 1:191-213 alias: new_album_count @@ -195,86 +195,86 @@ nodes: - this - album_title_count targets: - - 149 - parent: 160 -- id: 160 + - 152 + parent: 163 +- id: 163 kind: Tuple span: 1:172-214 children: - - 159 - parent: 161 -- id: 161 + - 162 + parent: 164 +- id: 164 kind: 'TransformCall: Derive' span: 1:165-214 children: - - 158 - - 160 - parent: 165 -- id: 162 + - 161 + - 163 + parent: 168 +- id: 165 kind: Ident span: 1:223-237 ident: !Ident - this - - _literal_129 + - _literal_132 - artist_id targets: - - 130 - parent: 164 -- id: 163 + - 133 + parent: 167 +- id: 166 kind: Ident span: 1:239-259 ident: !Ident - this - new_album_count targets: - - 159 - parent: 164 -- id: 164 + - 162 + parent: 167 +- id: 167 kind: Tuple span: 1:222-260 children: - - 162 - - 163 - parent: 165 -- id: 165 + - 165 + - 166 + parent: 168 +- id: 168 kind: 'TransformCall: Select' span: 1:215-260 children: - - 161 - 164 - parent: 170 -- id: 166 + - 167 + parent: 173 +- id: 169 kind: RqOperator span: 1:334-366 targets: - - 168 - - 169 - parent: 170 -- id: 168 + - 171 + - 172 + parent: 173 +- id: 171 kind: Ident span: 1:334-348 ident: !Ident - this - - _literal_129 + - _literal_132 - artist_id targets: - - 162 -- id: 169 + - 165 +- id: 172 kind: Ident span: 1:352-366 ident: !Ident - that - - _literal_116 + - _literal_119 - artist_id targets: - - 116 -- id: 170 + - 119 +- id: 173 kind: 'TransformCall: Join' span: 1:261-367 children: - - 165 - - 116 - - 166 + - 168 + - 119 + - 169 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_filter_derive_select_join.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_filter_derive_select_join.snap index 355d52efdba6..45f576380c48 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_filter_derive_select_join.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_filter_derive_select_join.snap @@ -8,230 +8,230 @@ frames: - columns: - !Single name: - - _literal_132 + - _literal_135 - artist_id - target_id: 133 + target_id: 136 target_name: null - !Single name: - album_title_count - target_id: 152 + target_id: 155 target_name: null inputs: - - id: 132 - name: _literal_132 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:119-164 - columns: - !Single name: - - _literal_132 + - _literal_135 - artist_id - target_id: 133 + target_id: 136 target_name: null - !Single name: - album_title_count - target_id: 152 + target_id: 155 target_name: null inputs: - - id: 132 - name: _literal_132 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:165-201 - columns: - !Single name: - - _literal_132 + - _literal_135 - artist_id - target_id: 133 + target_id: 136 target_name: null - !Single name: - album_title_count - target_id: 152 + target_id: 155 target_name: null inputs: - - id: 132 - name: _literal_132 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:202-251 - columns: - !Single name: - - _literal_132 + - _literal_135 - artist_id - target_id: 133 + target_id: 136 target_name: null - !Single name: - album_title_count - target_id: 152 + target_id: 155 target_name: null - !Single name: - new_album_count - target_id: 167 + target_id: 170 target_name: null inputs: - - id: 132 - name: _literal_132 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:252-297 - columns: - !Single name: - - _literal_132 + - _literal_135 - artist_id - target_id: 170 + target_id: 173 target_name: null - !Single name: - new_album_count - target_id: 171 + target_id: 174 target_name: null inputs: - - id: 132 - name: _literal_132 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:298-404 - columns: - !Single name: - - _literal_132 + - _literal_135 - artist_id - target_id: 170 + target_id: 173 target_name: null - !Single name: - new_album_count - target_id: 171 + target_id: 174 target_name: null - !All - input_id: 116 + input_id: 119 except: [] inputs: - - id: 132 - name: _literal_132 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 - - id: 116 - name: _literal_116 + - _literal_135 + - id: 119 + name: _literal_119 table: - default_db - - _literal_116 + - _literal_119 nodes: -- id: 116 +- id: 119 kind: SString span: 1:315-367 - parent: 178 -- id: 132 + parent: 181 +- id: 135 kind: SString span: 1:0-46 - parent: 155 -- id: 133 + parent: 158 +- id: 136 kind: Ident span: 1:54-63 ident: !Ident - this - - _literal_132 + - _literal_135 - artist_id targets: - - 132 - parent: 134 -- id: 134 + - 135 + parent: 137 +- id: 137 kind: Tuple span: 1:53-64 children: - - 133 - parent: 155 -- id: 152 + - 136 + parent: 158 +- id: 155 kind: RqOperator span: 1:98-116 alias: album_title_count targets: - - 153 - parent: 154 -- id: 153 + - 156 + parent: 157 +- id: 156 kind: Literal -- id: 154 +- id: 157 kind: Tuple span: 1:76-117 children: - - 152 - parent: 155 -- id: 155 + - 155 + parent: 158 +- id: 158 kind: 'TransformCall: Aggregate' span: 1:66-117 children: - - 132 - - 154 - - 134 - parent: 161 -- id: 158 + - 135 + - 157 + - 137 + parent: 164 +- id: 161 kind: Ident span: 1:125-139 ident: !Ident - this - - _literal_132 + - _literal_135 - artist_id targets: - - 133 - parent: 161 -- id: 159 + - 136 + parent: 164 +- id: 162 kind: Ident span: 1:141-163 ident: !Ident - this - album_title_count targets: - - 152 - parent: 161 -- id: 161 + - 155 + parent: 164 +- id: 164 kind: 'TransformCall: Sort' span: 1:119-164 children: - - 155 - 158 - - 159 - parent: 166 -- id: 162 + - 161 + - 162 + parent: 169 +- id: 165 kind: RqOperator span: 1:172-201 targets: - - 164 - - 165 - parent: 166 -- id: 164 + - 167 + - 168 + parent: 169 +- id: 167 kind: Ident span: 1:173-195 ident: !Ident - this - album_title_count targets: - - 152 -- id: 165 + - 155 +- id: 168 kind: Literal span: 1:199-201 -- id: 166 +- id: 169 kind: 'TransformCall: Filter' span: 1:165-201 children: - - 161 - - 162 - parent: 169 -- id: 167 + - 164 + - 165 + parent: 172 +- id: 170 kind: Ident span: 1:228-250 alias: new_album_count @@ -239,86 +239,86 @@ nodes: - this - album_title_count targets: - - 152 - parent: 168 -- id: 168 + - 155 + parent: 171 +- id: 171 kind: Tuple span: 1:209-251 children: - - 167 - parent: 169 -- id: 169 + - 170 + parent: 172 +- id: 172 kind: 'TransformCall: Derive' span: 1:202-251 children: - - 166 - - 168 - parent: 173 -- id: 170 + - 169 + - 171 + parent: 176 +- id: 173 kind: Ident span: 1:260-274 ident: !Ident - this - - _literal_132 + - _literal_135 - artist_id targets: - - 133 - parent: 172 -- id: 171 + - 136 + parent: 175 +- id: 174 kind: Ident span: 1:276-296 ident: !Ident - this - new_album_count targets: - - 167 - parent: 172 -- id: 172 + - 170 + parent: 175 +- id: 175 kind: Tuple span: 1:259-297 children: - - 170 - - 171 - parent: 173 -- id: 173 + - 173 + - 174 + parent: 176 +- id: 176 kind: 'TransformCall: Select' span: 1:252-297 children: - - 169 - 172 - parent: 178 -- id: 174 + - 175 + parent: 181 +- id: 177 kind: RqOperator span: 1:371-403 targets: - - 176 - - 177 - parent: 178 -- id: 176 + - 179 + - 180 + parent: 181 +- id: 179 kind: Ident span: 1:371-385 ident: !Ident - this - - _literal_132 + - _literal_135 - artist_id targets: - - 170 -- id: 177 + - 173 +- id: 180 kind: Ident span: 1:389-403 ident: !Ident - that - - _literal_116 + - _literal_119 - artist_id targets: - - 116 -- id: 178 + - 119 +- id: 181 kind: 'TransformCall: Join' span: 1:298-404 children: - - 173 - - 116 - - 174 + - 176 + - 119 + - 177 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_limit_take.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_limit_take.snap index 5214f60b559d..9ee27cfb978c 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_limit_take.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__group_sort_limit_take.snap @@ -10,16 +10,16 @@ frames: name: - tracks - genre_id - target_id: 133 + target_id: 136 target_name: null - !Single name: - tracks - milliseconds - target_id: 134 + target_id: 137 target_name: null inputs: - - id: 131 + - id: 134 name: tracks table: - default_db @@ -30,16 +30,16 @@ frames: name: - tracks - genre_id - target_id: 137 + target_id: 140 target_name: null - !Single name: - tracks - milliseconds - target_id: 134 + target_id: 137 target_name: null inputs: - - id: 131 + - id: 134 name: tracks table: - default_db @@ -50,24 +50,24 @@ frames: name: - tracks - genre_id - target_id: 137 + target_id: 140 target_name: null - !Single name: - tracks - milliseconds - target_id: 134 + target_id: 137 target_name: null - !All - input_id: 122 + input_id: 125 except: [] inputs: - - id: 131 + - id: 134 name: tracks table: - default_db - tracks - - id: 122 + - id: 125 name: genres table: - default_db @@ -78,21 +78,21 @@ frames: name: - genres - name - target_id: 175 + target_id: 178 target_name: null - !Single name: - tracks - milliseconds - target_id: 176 + target_id: 179 target_name: null inputs: - - id: 131 + - id: 134 name: tracks table: - default_db - tracks - - id: 122 + - id: 125 name: genres table: - default_db @@ -103,41 +103,41 @@ frames: name: - genres - name - target_id: 175 + target_id: 178 target_name: null - !Single name: - tracks - milliseconds - target_id: 176 + target_id: 179 target_name: null inputs: - - id: 131 + - id: 134 name: tracks table: - default_db - tracks - - id: 122 + - id: 125 name: genres table: - default_db - genres nodes: -- id: 122 +- id: 125 kind: Ident span: 1:177-183 ident: !Ident - default_db - genres - parent: 174 -- id: 131 + parent: 177 +- id: 134 kind: Ident span: 1:76-87 ident: !Ident - default_db - tracks - parent: 136 -- id: 133 + parent: 139 +- id: 136 kind: Ident span: 1:96-104 ident: !Ident @@ -145,9 +145,9 @@ nodes: - tracks - genre_id targets: - - 131 - parent: 135 -- id: 134 + - 134 + parent: 138 +- id: 137 kind: Ident span: 1:105-117 ident: !Ident @@ -155,23 +155,23 @@ nodes: - tracks - milliseconds targets: - - 131 - parent: 135 -- id: 135 + - 134 + parent: 138 +- id: 138 kind: Tuple span: 1:95-118 children: - - 133 - - 134 - parent: 136 -- id: 136 + - 136 + - 137 + parent: 139 +- id: 139 kind: 'TransformCall: Select' span: 1:88-118 children: - - 131 - - 135 - parent: 166 -- id: 137 + - 134 + - 138 + parent: 169 +- id: 140 kind: Ident span: 1:126-134 ident: !Ident @@ -179,14 +179,14 @@ nodes: - tracks - genre_id targets: - - 133 - parent: 138 -- id: 138 + - 136 + parent: 141 +- id: 141 kind: Tuple span: 1:125-135 children: - - 137 -- id: 162 + - 140 +- id: 165 kind: Ident span: 1:147-159 ident: !Ident @@ -194,25 +194,25 @@ nodes: - tracks - milliseconds targets: - - 134 -- id: 166 + - 137 +- id: 169 kind: 'TransformCall: Take' span: 1:163-169 children: - - 136 - - 167 - parent: 174 -- id: 167 - kind: Literal - parent: 166 + - 139 + - 170 + parent: 177 - id: 170 + kind: Literal + parent: 169 +- id: 173 kind: RqOperator span: 1:185-195 targets: - - 172 - - 173 - parent: 174 -- id: 172 + - 175 + - 176 + parent: 177 +- id: 175 kind: Ident span: 1:187-195 ident: !Ident @@ -220,8 +220,8 @@ nodes: - tracks - genre_id targets: - - 137 -- id: 173 + - 140 +- id: 176 kind: Ident span: 1:187-195 ident: !Ident @@ -229,16 +229,16 @@ nodes: - genres - genre_id targets: - - 122 -- id: 174 + - 125 +- id: 177 kind: 'TransformCall: Join' span: 1:172-196 children: - - 166 - - 122 - - 170 - parent: 178 -- id: 175 + - 169 + - 125 + - 173 + parent: 181 +- id: 178 kind: Ident span: 1:205-209 ident: !Ident @@ -246,9 +246,9 @@ nodes: - genres - name targets: - - 122 - parent: 177 -- id: 176 + - 125 + parent: 180 +- id: 179 kind: Ident span: 1:211-223 ident: !Ident @@ -256,23 +256,23 @@ nodes: - tracks - milliseconds targets: - - 134 - parent: 177 -- id: 177 + - 137 + parent: 180 +- id: 180 kind: Tuple span: 1:204-224 children: - - 175 - - 176 - parent: 178 -- id: 178 + - 178 + - 179 + parent: 181 +- id: 181 kind: 'TransformCall: Select' span: 1:197-224 children: - - 174 - 177 - parent: 184 -- id: 179 + - 180 + parent: 187 +- id: 182 kind: Ident span: 1:231-236 ident: !Ident @@ -280,9 +280,9 @@ nodes: - genres - name targets: - - 175 - parent: 184 -- id: 182 + - 178 + parent: 187 +- id: 185 kind: Ident span: 1:238-250 ident: !Ident @@ -290,15 +290,15 @@ nodes: - tracks - milliseconds targets: - - 176 - parent: 184 -- id: 184 + - 179 + parent: 187 +- id: 187 kind: 'TransformCall: Sort' span: 1:225-251 children: - - 178 - - 179 + - 181 - 182 + - 185 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__invoice_totals.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__invoice_totals.snap index ee23a13653bf..267cb962d637 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__invoice_totals.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__invoice_totals.snap @@ -7,18 +7,18 @@ frames: - - 1:147-183 - columns: - !All - input_id: 140 + input_id: 143 except: [] - !All - input_id: 137 + input_id: 140 except: [] inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -26,28 +26,28 @@ frames: - - 1:184-253 - columns: - !All - input_id: 140 + input_id: 143 except: [] - !All - input_id: 137 + input_id: 140 except: [] - !Single name: - city - target_id: 147 + target_id: 150 target_name: null - !Single name: - street - target_id: 148 + target_id: 151 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -55,23 +55,23 @@ frames: - - 1:281-323 - columns: - !All - input_id: 140 + input_id: 143 except: [] - !All - input_id: 137 + input_id: 140 except: [] - !Single name: - total - target_id: 178 + target_id: 181 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -81,35 +81,35 @@ frames: - !Single name: - city - target_id: 151 + target_id: 154 target_name: null - !Single name: - street - target_id: 152 + target_id: 155 target_name: null - !Single name: - num_orders - target_id: 184 + target_id: 187 target_name: null - !Single name: - num_tracks - target_id: 187 + target_id: 190 target_name: null - !Single name: - total_price - target_id: 190 + target_id: 193 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -119,40 +119,40 @@ frames: - !Single name: - city - target_id: 197 + target_id: 200 target_name: null - !Single name: - street - target_id: 152 + target_id: 155 target_name: null - !Single name: - num_orders - target_id: 184 + target_id: 187 target_name: null - !Single name: - num_tracks - target_id: 187 + target_id: 190 target_name: null - !Single name: - total_price - target_id: 190 + target_id: 193 target_name: null - !Single name: - running_total_num_tracks - target_id: 243 + target_id: 246 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -162,40 +162,40 @@ frames: - !Single name: - city - target_id: 197 + target_id: 200 target_name: null - !Single name: - street - target_id: 152 + target_id: 155 target_name: null - !Single name: - num_orders - target_id: 184 + target_id: 187 target_name: null - !Single name: - num_tracks - target_id: 187 + target_id: 190 target_name: null - !Single name: - total_price - target_id: 190 + target_id: 193 target_name: null - !Single name: - running_total_num_tracks - target_id: 243 + target_id: 246 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -205,45 +205,45 @@ frames: - !Single name: - city - target_id: 197 + target_id: 200 target_name: null - !Single name: - street - target_id: 152 + target_id: 155 target_name: null - !Single name: - num_orders - target_id: 184 + target_id: 187 target_name: null - !Single name: - num_tracks - target_id: 187 + target_id: 190 target_name: null - !Single name: - total_price - target_id: 190 + target_id: 193 target_name: null - !Single name: - running_total_num_tracks - target_id: 243 + target_id: 246 target_name: null - !Single name: - num_tracks_last_week - target_id: 257 + target_id: 260 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -253,40 +253,40 @@ frames: - !Single name: - city - target_id: 263 + target_id: 266 target_name: null - !Single name: - street - target_id: 264 + target_id: 267 target_name: null - !Single name: - num_orders - target_id: 265 + target_id: 268 target_name: null - !Single name: - num_tracks - target_id: 266 + target_id: 269 target_name: null - !Single name: - running_total_num_tracks - target_id: 267 + target_id: 270 target_name: null - !Single name: - num_tracks_last_week - target_id: 268 + target_id: 271 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db @@ -296,67 +296,67 @@ frames: - !Single name: - city - target_id: 263 + target_id: 266 target_name: null - !Single name: - street - target_id: 264 + target_id: 267 target_name: null - !Single name: - num_orders - target_id: 265 + target_id: 268 target_name: null - !Single name: - num_tracks - target_id: 266 + target_id: 269 target_name: null - !Single name: - running_total_num_tracks - target_id: 267 + target_id: 270 target_name: null - !Single name: - num_tracks_last_week - target_id: 268 + target_id: 271 target_name: null inputs: - - id: 140 + - id: 143 name: i table: - default_db - invoices - - id: 137 + - id: 140 name: ii table: - default_db - invoice_items nodes: -- id: 137 +- id: 140 kind: Ident span: 1:155-168 ident: !Ident - default_db - invoice_items - parent: 146 -- id: 140 + parent: 149 +- id: 143 kind: Ident span: 1:131-146 ident: !Ident - default_db - invoices - parent: 146 -- id: 142 + parent: 149 +- id: 145 kind: RqOperator span: 1:170-182 targets: - - 144 - - 145 - parent: 146 -- id: 144 + - 147 + - 148 + parent: 149 +- id: 147 kind: Ident span: 1:172-182 ident: !Ident @@ -364,8 +364,8 @@ nodes: - i - invoice_id targets: - - 140 -- id: 145 + - 143 +- id: 148 kind: Ident span: 1:172-182 ident: !Ident @@ -373,16 +373,16 @@ nodes: - ii - invoice_id targets: - - 137 -- id: 146 + - 140 +- id: 149 kind: 'TransformCall: Join' span: 1:147-183 children: + - 143 - 140 - - 137 - - 142 - parent: 150 -- id: 147 + - 145 + parent: 153 +- id: 150 kind: Ident span: 1:204-218 alias: city @@ -391,9 +391,9 @@ nodes: - i - billing_city targets: - - 140 - parent: 149 -- id: 148 + - 143 + parent: 152 +- id: 151 kind: Ident span: 1:233-250 alias: street @@ -402,56 +402,56 @@ nodes: - i - billing_address targets: - - 140 - parent: 149 -- id: 149 + - 143 + parent: 152 +- id: 152 kind: Tuple span: 1:191-253 children: - - 147 - - 148 - parent: 150 -- id: 150 + - 150 + - 151 + parent: 153 +- id: 153 kind: 'TransformCall: Derive' span: 1:184-253 children: - - 146 - 149 - parent: 183 -- id: 151 + - 152 + parent: 186 +- id: 154 kind: Ident span: 1:261-265 ident: !Ident - this - city targets: - - 147 - parent: 153 -- id: 152 + - 150 + parent: 156 +- id: 155 kind: Ident span: 1:267-273 ident: !Ident - this - street targets: - - 148 - parent: 153 -- id: 153 + - 151 + parent: 156 +- id: 156 kind: Tuple span: 1:260-274 children: - - 151 - - 152 - parent: 194 -- id: 178 + - 154 + - 155 + parent: 197 +- id: 181 kind: RqOperator span: 1:296-323 alias: total targets: - - 180 - - 181 - parent: 182 -- id: 180 + - 183 + - 184 + parent: 185 +- id: 183 kind: Ident span: 1:296-309 ident: !Ident @@ -459,8 +459,8 @@ nodes: - ii - unit_price targets: - - 137 -- id: 181 + - 140 +- id: 184 kind: Ident span: 1:312-323 ident: !Ident @@ -468,28 +468,28 @@ nodes: - ii - quantity targets: - - 137 -- id: 182 + - 140 +- id: 185 kind: Tuple span: 1:296-323 children: - - 178 - parent: 183 -- id: 183 + - 181 + parent: 186 +- id: 186 kind: 'TransformCall: Derive' span: 1:281-323 children: - - 150 - - 182 - parent: 194 -- id: 184 + - 153 + - 185 + parent: 197 +- id: 187 kind: RqOperator span: 1:361-388 alias: num_orders targets: - - 186 - parent: 193 -- id: 186 + - 189 + parent: 196 +- id: 189 kind: Ident span: 1:376-388 ident: !Ident @@ -497,15 +497,15 @@ nodes: - i - invoice_id targets: - - 140 -- id: 187 + - 143 +- id: 190 kind: RqOperator span: 1:411-426 alias: num_tracks targets: - - 189 - parent: 193 -- id: 189 + - 192 + parent: 196 +- id: 192 kind: Ident span: 1:415-426 ident: !Ident @@ -513,229 +513,229 @@ nodes: - ii - quantity targets: - - 137 -- id: 190 + - 140 +- id: 193 kind: RqOperator span: 1:450-459 alias: total_price targets: - - 192 - parent: 193 -- id: 192 + - 195 + parent: 196 +- id: 195 kind: Ident span: 1:454-459 ident: !Ident - this - total targets: - - 178 -- id: 193 + - 181 +- id: 196 kind: Tuple span: 1:338-466 children: - - 184 - 187 - 190 - parent: 194 -- id: 194 + - 193 + parent: 197 +- id: 197 kind: 'TransformCall: Aggregate' span: 1:328-466 children: - - 183 - - 193 - - 153 - parent: 247 -- id: 197 + - 186 + - 196 + - 156 + parent: 250 +- id: 200 kind: Ident span: 1:476-480 ident: !Ident - this - city targets: - - 151 - parent: 198 -- id: 198 + - 154 + parent: 201 +- id: 201 kind: Tuple span: 1:475-481 children: - - 197 -- id: 222 + - 200 +- id: 225 kind: Ident span: 1:493-499 ident: !Ident - this - street targets: - - 152 -- id: 243 + - 155 +- id: 246 kind: RqOperator span: 1:571-585 alias: running_total_num_tracks targets: - - 245 - parent: 246 -- id: 245 + - 248 + parent: 249 +- id: 248 kind: Ident span: 1:575-585 ident: !Ident - this - num_tracks targets: - - 187 -- id: 246 + - 190 +- id: 249 kind: Tuple span: 1:543-586 children: - - 243 - parent: 247 -- id: 247 + - 246 + parent: 250 +- id: 250 kind: 'TransformCall: Derive' span: 1:536-586 children: - - 194 - - 246 - parent: 256 -- id: 249 + - 197 + - 249 + parent: 259 +- id: 252 kind: Literal -- id: 253 +- id: 256 kind: Ident span: 1:601-605 ident: !Ident - this - city targets: - - 197 - parent: 256 -- id: 254 + - 200 + parent: 259 +- id: 257 kind: Ident span: 1:607-613 ident: !Ident - this - street targets: - - 152 - parent: 256 -- id: 256 + - 155 + parent: 259 +- id: 259 kind: 'TransformCall: Sort' span: 1:595-614 children: - - 247 - - 253 - - 254 - parent: 262 -- id: 257 + - 250 + - 256 + - 257 + parent: 265 +- id: 260 kind: RqOperator span: 1:646-662 alias: num_tracks_last_week targets: - - 259 - - 260 - parent: 261 -- id: 259 + - 262 + - 263 + parent: 264 +- id: 262 kind: Literal span: 1:650-651 -- id: 260 +- id: 263 kind: Ident span: 1:652-662 ident: !Ident - this - num_tracks targets: - - 187 -- id: 261 + - 190 +- id: 264 kind: Tuple span: 1:622-663 children: - - 257 - parent: 262 -- id: 262 + - 260 + parent: 265 +- id: 265 kind: 'TransformCall: Derive' span: 1:615-663 children: - - 256 - - 261 - parent: 270 -- id: 263 + - 259 + - 264 + parent: 273 +- id: 266 kind: Ident span: 1:677-681 ident: !Ident - this - city targets: - - 197 - parent: 269 -- id: 264 + - 200 + parent: 272 +- id: 267 kind: Ident span: 1:687-693 ident: !Ident - this - street targets: - - 152 - parent: 269 -- id: 265 + - 155 + parent: 272 +- id: 268 kind: Ident span: 1:699-709 ident: !Ident - this - num_orders targets: - - 184 - parent: 269 -- id: 266 + - 187 + parent: 272 +- id: 269 kind: Ident span: 1:715-725 ident: !Ident - this - num_tracks targets: - - 187 - parent: 269 -- id: 267 + - 190 + parent: 272 +- id: 270 kind: Ident span: 1:731-755 ident: !Ident - this - running_total_num_tracks targets: - - 243 - parent: 269 -- id: 268 + - 246 + parent: 272 +- id: 271 kind: Ident span: 1:761-781 ident: !Ident - this - num_tracks_last_week targets: - - 257 - parent: 269 -- id: 269 + - 260 + parent: 272 +- id: 272 kind: Tuple span: 1:671-783 children: - - 263 - - 264 - - 265 - 266 - 267 - 268 - parent: 270 -- id: 270 + - 269 + - 270 + - 271 + parent: 273 +- id: 273 kind: 'TransformCall: Select' span: 1:664-783 children: - - 262 - - 269 - parent: 272 -- id: 272 + - 265 + - 272 + parent: 275 +- id: 275 kind: 'TransformCall: Take' span: 1:784-791 children: - - 270 - 273 -- id: 273 + - 276 +- id: 276 kind: Literal - parent: 272 + parent: 275 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__loop_01.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__loop_01.snap index 36fedb6b3dfd..3aaf4102aa5f 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__loop_01.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__loop_01.snap @@ -9,252 +9,252 @@ frames: - !Single name: - n - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 127 - name: _literal_127 + - id: 130 + name: _literal_130 table: - default_db - - _literal_127 + - _literal_130 - - 1:200-212 - columns: - !Single name: - n - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 127 - name: _literal_127 + - id: 130 + name: _literal_130 table: - default_db - - _literal_127 + - _literal_130 - - 1:215-231 - columns: - !Single name: - n - target_id: 154 + target_id: 157 target_name: null inputs: - - id: 127 - name: _literal_127 + - id: 130 + name: _literal_130 table: - default_db - - _literal_127 + - _literal_130 - - 1:194-232 - columns: - !Single name: - n - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 127 - name: _literal_127 + - id: 130 + name: _literal_130 table: - default_db - - _literal_127 + - _literal_130 - - 1:233-249 - columns: - !Single name: - n - target_id: 162 + target_id: 165 target_name: null inputs: - - id: 127 - name: _literal_127 + - id: 130 + name: _literal_130 table: - default_db - - _literal_127 + - _literal_130 - - 1:250-256 - columns: - !Single name: - n - target_id: 162 + target_id: 165 target_name: null inputs: - - id: 127 - name: _literal_127 + - id: 130 + name: _literal_130 table: - default_db - - _literal_127 + - _literal_130 nodes: -- id: 127 +- id: 130 kind: Array span: 1:162-176 children: - - 128 - parent: 136 -- id: 128 + - 131 + parent: 139 +- id: 131 kind: Tuple span: 1:168-175 children: - - 129 - parent: 127 -- id: 129 + - 132 + parent: 130 +- id: 132 kind: Literal span: 1:173-174 alias: n - parent: 128 -- id: 131 + parent: 131 +- id: 134 kind: RqOperator span: 1:188-193 alias: n targets: - - 133 - - 134 - parent: 135 -- id: 133 + - 136 + - 137 + parent: 138 +- id: 136 kind: Ident span: 1:188-189 ident: !Ident - this - - _literal_127 + - _literal_130 - n targets: - - 127 -- id: 134 + - 130 +- id: 137 kind: Literal span: 1:192-193 -- id: 135 +- id: 138 kind: Tuple span: 1:188-193 children: - - 131 - parent: 136 -- id: 136 + - 134 + parent: 139 +- id: 139 kind: 'TransformCall: Select' span: 1:177-193 children: - - 127 - - 135 - parent: 160 -- id: 145 + - 130 + - 138 + parent: 163 +- id: 148 kind: Ident ident: !Ident - _param - _tbl targets: - - 142 - parent: 153 -- id: 149 + - 145 + parent: 156 +- id: 152 kind: RqOperator span: 1:207-212 targets: - - 151 - - 152 - parent: 153 -- id: 151 + - 154 + - 155 + parent: 156 +- id: 154 kind: Ident span: 1:207-208 ident: !Ident - this - n targets: - - 131 -- id: 152 + - 134 +- id: 155 kind: Literal span: 1:211-212 -- id: 153 +- id: 156 kind: 'TransformCall: Filter' span: 1:200-212 children: - - 145 - - 149 - parent: 159 -- id: 154 + - 148 + - 152 + parent: 162 +- id: 157 kind: RqOperator span: 1:226-231 alias: n targets: - - 156 - - 157 - parent: 158 -- id: 156 + - 159 + - 160 + parent: 161 +- id: 159 kind: Ident span: 1:226-227 ident: !Ident - this - n targets: - - 131 -- id: 157 + - 134 +- id: 160 kind: Literal span: 1:230-231 -- id: 158 +- id: 161 kind: Tuple span: 1:226-231 children: - - 154 - parent: 159 -- id: 159 + - 157 + parent: 162 +- id: 162 kind: 'TransformCall: Select' span: 1:215-231 children: - - 153 - - 158 -- id: 160 + - 156 + - 161 +- id: 163 kind: 'TransformCall: Loop' span: 1:194-232 children: - - 136 - - 161 - parent: 167 -- id: 161 + - 139 + - 164 + parent: 170 +- id: 164 kind: Func span: 1:215-231 - parent: 160 -- id: 162 + parent: 163 +- id: 165 kind: RqOperator span: 1:244-249 alias: n targets: - - 164 - - 165 - parent: 166 -- id: 164 + - 167 + - 168 + parent: 169 +- id: 167 kind: Ident span: 1:244-245 ident: !Ident - this - n targets: - - 131 -- id: 165 + - 134 +- id: 168 kind: Literal span: 1:248-249 -- id: 166 +- id: 169 kind: Tuple span: 1:244-249 children: - - 162 - parent: 167 -- id: 167 + - 165 + parent: 170 +- id: 170 kind: 'TransformCall: Select' span: 1:233-249 children: - - 160 - - 166 - parent: 170 -- id: 168 + - 163 + - 169 + parent: 173 +- id: 171 kind: Ident span: 1:255-256 ident: !Ident - this - n targets: - - 162 - parent: 170 -- id: 170 + - 165 + parent: 173 +- id: 173 kind: 'TransformCall: Sort' span: 1:250-256 children: - - 167 - - 168 + - 170 + - 171 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__math_module.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__math_module.snap index cf552c40ab7b..1f1010d8fe2c 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__math_module.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__math_module.snap @@ -7,10 +7,10 @@ frames: - - 1:96-102 - columns: - !All - input_id: 121 + input_id: 124 except: [] inputs: - - id: 121 + - id: 124 name: invoices table: - default_db @@ -20,109 +20,109 @@ frames: - !Single name: - total_original - target_id: 126 + target_id: 129 target_name: null - !Single name: - total_x - target_id: 131 + target_id: 134 target_name: null - !Single name: - total_floor - target_id: 142 + target_id: 145 target_name: null - !Single name: - total_ceil - target_id: 145 + target_id: 148 target_name: null - !Single name: - total_log10 - target_id: 148 + target_id: 151 target_name: null - !Single name: - total_log2 - target_id: 155 + target_id: 158 target_name: null - !Single name: - total_sqrt - target_id: 163 + target_id: 166 target_name: null - !Single name: - total_ln - target_id: 170 + target_id: 173 target_name: null - !Single name: - total_cos - target_id: 179 + target_id: 182 target_name: null - !Single name: - total_sin - target_id: 188 + target_id: 191 target_name: null - !Single name: - total_tan - target_id: 197 + target_id: 200 target_name: null - !Single name: - total_deg - target_id: 206 + target_id: 209 target_name: null - !Single name: - total_square - target_id: 215 + target_id: 218 target_name: null - !Single name: - total_square_op - target_id: 224 + target_id: 227 target_name: null inputs: - - id: 121 + - id: 124 name: invoices table: - default_db - invoices nodes: -- id: 121 +- id: 124 kind: Ident span: 1:82-95 ident: !Ident - default_db - invoices - parent: 124 -- id: 124 + parent: 127 +- id: 127 kind: 'TransformCall: Take' span: 1:96-102 children: - - 121 - - 125 - parent: 233 -- id: 125 + - 124 + - 128 + parent: 236 +- id: 128 kind: Literal - parent: 124 -- id: 126 + parent: 127 +- id: 129 kind: RqOperator span: 1:142-154 alias: total_original targets: - - 129 - - 130 - parent: 232 -- id: 129 + - 132 + - 133 + parent: 235 +- id: 132 kind: Literal span: 1:153-154 -- id: 130 +- id: 133 kind: Ident span: 1:134-139 ident: !Ident @@ -130,33 +130,33 @@ nodes: - invoices - total targets: - - 121 -- id: 131 + - 124 +- id: 134 kind: RqOperator span: 1:205-213 alias: total_x targets: - - 133 - parent: 232 -- id: 133 + - 136 + parent: 235 +- id: 136 kind: RqOperator span: 1:190-202 targets: - - 136 - - 137 -- id: 136 + - 139 + - 140 +- id: 139 kind: Literal span: 1:201-202 -- id: 137 +- id: 140 kind: RqOperator span: 1:172-187 targets: - - 140 - - 141 -- id: 140 + - 143 + - 144 +- id: 143 kind: RqOperator span: 1:172-179 -- id: 141 +- id: 144 kind: Ident span: 1:182-187 ident: !Ident @@ -164,15 +164,15 @@ nodes: - invoices - total targets: - - 121 -- id: 142 + - 124 +- id: 145 kind: RqOperator span: 1:234-252 alias: total_floor targets: - - 144 - parent: 232 -- id: 144 + - 147 + parent: 235 +- id: 147 kind: Ident span: 1:246-251 ident: !Ident @@ -180,15 +180,15 @@ nodes: - invoices - total targets: - - 121 -- id: 145 + - 124 +- id: 148 kind: RqOperator span: 1:271-288 alias: total_ceil targets: - - 147 - parent: 232 -- id: 147 + - 150 + parent: 235 +- id: 150 kind: Ident span: 1:282-287 ident: !Ident @@ -196,24 +196,24 @@ nodes: - invoices - total targets: - - 121 -- id: 148 + - 124 +- id: 151 kind: RqOperator span: 1:328-340 alias: total_log10 targets: - - 151 - - 152 - parent: 232 -- id: 151 + - 154 + - 155 + parent: 235 +- id: 154 kind: Literal span: 1:339-340 -- id: 152 +- id: 155 kind: RqOperator span: 1:309-325 targets: - - 154 -- id: 154 + - 157 +- id: 157 kind: Ident span: 1:320-325 ident: !Ident @@ -221,28 +221,28 @@ nodes: - invoices - total targets: - - 121 -- id: 155 + - 124 +- id: 158 kind: RqOperator span: 1:380-392 alias: total_log2 targets: - - 158 - - 159 - parent: 232 -- id: 158 + - 161 + - 162 + parent: 235 +- id: 161 kind: Literal span: 1:391-392 -- id: 159 +- id: 162 kind: RqOperator span: 1:361-377 targets: - - 161 - - 162 -- id: 161 + - 164 + - 165 +- id: 164 kind: Literal span: 1:370-371 -- id: 162 +- id: 165 kind: Ident span: 1:372-377 ident: !Ident @@ -250,24 +250,24 @@ nodes: - invoices - total targets: - - 121 -- id: 163 + - 124 +- id: 166 kind: RqOperator span: 1:431-443 alias: total_sqrt targets: - - 166 - - 167 - parent: 232 -- id: 166 + - 169 + - 170 + parent: 235 +- id: 169 kind: Literal span: 1:442-443 -- id: 167 +- id: 170 kind: RqOperator span: 1:413-428 targets: - - 169 -- id: 169 + - 172 +- id: 172 kind: Ident span: 1:423-428 ident: !Ident @@ -275,29 +275,29 @@ nodes: - invoices - total targets: - - 121 -- id: 170 + - 124 +- id: 173 kind: RqOperator span: 1:489-501 alias: total_ln targets: - - 173 - - 174 - parent: 232 -- id: 173 + - 176 + - 177 + parent: 235 +- id: 176 kind: Literal span: 1:500-501 -- id: 174 +- id: 177 kind: RqOperator span: 1:478-486 targets: - - 176 -- id: 176 + - 179 +- id: 179 kind: RqOperator span: 1:462-475 targets: - - 178 -- id: 178 + - 181 +- id: 181 kind: Ident span: 1:470-475 ident: !Ident @@ -305,29 +305,29 @@ nodes: - invoices - total targets: - - 121 -- id: 179 + - 124 +- id: 182 kind: RqOperator span: 1:550-562 alias: total_cos targets: - - 182 - - 183 - parent: 232 -- id: 182 + - 185 + - 186 + parent: 235 +- id: 185 kind: Literal span: 1:561-562 -- id: 183 +- id: 186 kind: RqOperator span: 1:538-547 targets: - - 185 -- id: 185 + - 188 +- id: 188 kind: RqOperator span: 1:521-535 targets: - - 187 -- id: 187 + - 190 +- id: 190 kind: Ident span: 1:530-535 ident: !Ident @@ -335,29 +335,29 @@ nodes: - invoices - total targets: - - 121 -- id: 188 + - 124 +- id: 191 kind: RqOperator span: 1:611-623 alias: total_sin targets: - - 191 - - 192 - parent: 232 -- id: 191 + - 194 + - 195 + parent: 235 +- id: 194 kind: Literal span: 1:622-623 -- id: 192 +- id: 195 kind: RqOperator span: 1:599-608 targets: - - 194 -- id: 194 + - 197 +- id: 197 kind: RqOperator span: 1:582-596 targets: - - 196 -- id: 196 + - 199 +- id: 199 kind: Ident span: 1:591-596 ident: !Ident @@ -365,29 +365,29 @@ nodes: - invoices - total targets: - - 121 -- id: 197 + - 124 +- id: 200 kind: RqOperator span: 1:672-684 alias: total_tan targets: - - 200 - - 201 - parent: 232 -- id: 200 + - 203 + - 204 + parent: 235 +- id: 203 kind: Literal span: 1:683-684 -- id: 201 +- id: 204 kind: RqOperator span: 1:660-669 targets: - - 203 -- id: 203 + - 206 +- id: 206 kind: RqOperator span: 1:643-657 targets: - - 205 -- id: 205 + - 208 +- id: 208 kind: Ident span: 1:652-657 ident: !Ident @@ -395,29 +395,29 @@ nodes: - invoices - total targets: - - 121 -- id: 206 + - 124 +- id: 209 kind: RqOperator span: 1:742-754 alias: total_deg targets: - - 209 - - 210 - parent: 232 -- id: 209 + - 212 + - 213 + parent: 235 +- id: 212 kind: Literal span: 1:753-754 -- id: 210 +- id: 213 kind: RqOperator span: 1:727-739 targets: - - 212 -- id: 212 + - 215 +- id: 215 kind: RqOperator span: 1:712-724 targets: - - 214 -- id: 214 + - 217 +- id: 217 kind: Ident span: 1:704-709 ident: !Ident @@ -425,28 +425,28 @@ nodes: - invoices - total targets: - - 121 -- id: 215 + - 124 +- id: 218 kind: RqOperator span: 1:798-810 alias: total_square targets: - - 218 - - 219 - parent: 232 -- id: 218 + - 221 + - 222 + parent: 235 +- id: 221 kind: Literal span: 1:809-810 -- id: 219 +- id: 222 kind: RqOperator span: 1:785-795 targets: - - 222 - - 223 -- id: 222 + - 225 + - 226 +- id: 225 kind: Literal span: 1:794-795 -- id: 223 +- id: 226 kind: Ident span: 1:777-782 ident: !Ident @@ -454,28 +454,28 @@ nodes: - invoices - total targets: - - 121 -- id: 224 + - 124 +- id: 227 kind: RqOperator span: 1:851-863 alias: total_square_op targets: - - 227 - - 228 - parent: 232 -- id: 227 + - 230 + - 231 + parent: 235 +- id: 230 kind: Literal span: 1:862-863 -- id: 228 +- id: 231 kind: RqOperator span: 1:836-848 targets: - - 230 - - 231 -- id: 230 + - 233 + - 234 +- id: 233 kind: Literal span: 1:846-847 -- id: 231 +- id: 234 kind: Ident span: 1:837-842 ident: !Ident @@ -483,32 +483,32 @@ nodes: - invoices - total targets: - - 121 -- id: 232 + - 124 +- id: 235 kind: Tuple span: 1:110-867 children: - - 126 - - 131 - - 142 + - 129 + - 134 - 145 - 148 - - 155 - - 163 - - 170 - - 179 - - 188 - - 197 - - 206 - - 215 - - 224 - parent: 233 -- id: 233 + - 151 + - 158 + - 166 + - 173 + - 182 + - 191 + - 200 + - 209 + - 218 + - 227 + parent: 236 +- id: 236 kind: 'TransformCall: Select' span: 1:103-867 children: - - 124 - - 232 + - 127 + - 235 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__pipelines.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__pipelines.snap index e76b2258b509..c4b0275e5ce3 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__pipelines.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__pipelines.snap @@ -7,10 +7,10 @@ frames: - - 1:179-202 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -18,10 +18,10 @@ frames: - - 1:203-248 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -29,10 +29,10 @@ frames: - - 1:249-262 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -40,10 +40,10 @@ frames: - - 1:263-273 - columns: - !All - input_id: 130 + input_id: 133 except: [] inputs: - - id: 130 + - id: 133 name: tracks table: - default_db @@ -54,36 +54,36 @@ frames: name: - tracks - name - target_id: 164 + target_id: 167 target_name: null - !Single name: - tracks - composer - target_id: 165 + target_id: 168 target_name: null inputs: - - id: 130 + - id: 133 name: tracks table: - default_db - tracks nodes: -- id: 130 +- id: 133 kind: Ident span: 1:166-177 ident: !Ident - default_db - tracks - parent: 136 -- id: 132 + parent: 139 +- id: 135 kind: RqOperator span: 1:187-201 targets: - - 134 - - 135 - parent: 136 -- id: 134 + - 137 + - 138 + parent: 139 +- id: 137 kind: Ident span: 1:187-191 ident: !Ident @@ -91,38 +91,38 @@ nodes: - tracks - name targets: - - 130 -- id: 135 + - 133 +- id: 138 kind: Literal span: 1:195-201 -- id: 136 +- id: 139 kind: 'TransformCall: Filter' span: 1:179-202 children: - - 130 - - 132 - parent: 156 -- id: 140 + - 133 + - 135 + parent: 159 +- id: 143 kind: Literal span: 1:243-244 alias: start -- id: 141 +- id: 144 kind: Literal span: 1:246-247 alias: end -- id: 143 +- id: 146 kind: RqOperator span: 1:211-237 targets: - - 145 - - 149 -- id: 145 + - 148 + - 152 +- id: 148 kind: RqOperator span: 1:212-231 targets: - - 147 - - 148 -- id: 147 + - 150 + - 151 +- id: 150 kind: Ident span: 1:212-224 ident: !Ident @@ -130,38 +130,38 @@ nodes: - tracks - milliseconds targets: - - 130 -- id: 148 + - 133 +- id: 151 kind: Literal span: 1:227-231 -- id: 149 +- id: 152 kind: Literal span: 1:234-236 -- id: 150 +- id: 153 kind: RqOperator span: 1:240-247 targets: - - 152 - - 154 - parent: 156 -- id: 152 + - 155 + - 157 + parent: 159 +- id: 155 kind: RqOperator targets: + - 146 - 143 - - 140 -- id: 154 +- id: 157 kind: RqOperator targets: - - 143 - - 141 -- id: 156 + - 146 + - 144 +- id: 159 kind: 'TransformCall: Filter' span: 1:203-248 children: - - 136 - - 150 - parent: 159 -- id: 157 + - 139 + - 153 + parent: 162 +- id: 160 kind: Ident span: 1:254-262 ident: !Ident @@ -169,34 +169,34 @@ nodes: - tracks - track_id targets: - - 130 - parent: 159 -- id: 159 + - 133 + parent: 162 +- id: 162 kind: 'TransformCall: Sort' span: 1:249-262 children: - - 156 - - 157 - parent: 163 -- id: 160 + - 159 + - 160 + parent: 166 +- id: 163 kind: Literal span: 1:268-269 alias: start - parent: 163 -- id: 161 + parent: 166 +- id: 164 kind: Literal span: 1:271-273 alias: end - parent: 163 -- id: 163 + parent: 166 +- id: 166 kind: 'TransformCall: Take' span: 1:263-273 children: - - 159 - - 160 - - 161 - parent: 167 -- id: 164 + - 162 + - 163 + - 164 + parent: 170 +- id: 167 kind: Ident span: 1:282-286 ident: !Ident @@ -204,9 +204,9 @@ nodes: - tracks - name targets: - - 130 - parent: 166 -- id: 165 + - 133 + parent: 169 +- id: 168 kind: Ident span: 1:288-296 ident: !Ident @@ -214,21 +214,21 @@ nodes: - tracks - composer targets: - - 130 - parent: 166 -- id: 166 + - 133 + parent: 169 +- id: 169 kind: Tuple span: 1:281-297 children: - - 164 - - 165 - parent: 167 -- id: 167 + - 167 + - 168 + parent: 170 +- id: 170 kind: 'TransformCall: Select' span: 1:274-297 children: - - 163 - 166 + - 169 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__read_csv.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__read_csv.snap index d5fc9bfbbde7..a717ad73a345 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__read_csv.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__read_csv.snap @@ -7,77 +7,77 @@ frames: - - 1:92-144 - columns: - !All - input_id: 124 + input_id: 127 except: [] inputs: - - id: 124 - name: _literal_124 + - id: 127 + name: _literal_127 table: - default_db - - _literal_124 - - id: 119 - name: _literal_119 + - _literal_127 + - id: 122 + name: _literal_122 table: - default_db - - _literal_119 + - _literal_122 - - 1:145-163 - columns: - !All - input_id: 124 + input_id: 127 except: [] inputs: - - id: 124 - name: _literal_124 + - id: 127 + name: _literal_127 table: - default_db - - _literal_124 - - id: 119 - name: _literal_119 + - _literal_127 + - id: 122 + name: _literal_122 table: - default_db - - _literal_119 + - _literal_122 nodes: -- id: 119 +- id: 122 kind: RqOperator span: 1:100-143 targets: - - 121 - parent: 128 -- id: 121 + - 124 + parent: 131 +- id: 124 kind: Literal span: 1:110-143 -- id: 124 +- id: 127 kind: RqOperator span: 1:43-91 targets: - - 126 - parent: 128 -- id: 126 + - 129 + parent: 131 +- id: 129 kind: Literal span: 1:58-90 -- id: 128 +- id: 131 kind: 'TransformCall: Append' span: 1:92-144 children: - - 124 - - 119 - parent: 131 -- id: 129 + - 127 + - 122 + parent: 134 +- id: 132 kind: Ident span: 1:150-163 ident: !Ident - this - - _literal_124 + - _literal_127 - media_type_id targets: - - 124 - parent: 131 -- id: 131 + - 127 + parent: 134 +- id: 134 kind: 'TransformCall: Sort' span: 1:145-163 children: - - 128 - - 129 + - 131 + - 132 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__set_ops_remove.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__set_ops_remove.snap index cd69dacc93d0..d9550152e177 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__set_ops_remove.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__set_ops_remove.snap @@ -10,215 +10,215 @@ frames: name: - t - a - target_id: 136 + target_id: 139 target_name: null inputs: - - id: 127 + - id: 130 name: t table: - default_db - - _literal_127 -- - 0:3172-3258 + - _literal_130 +- - 0:3522-3608 - columns: - !Single name: - t - a - target_id: 136 + target_id: 139 target_name: null - !Single name: - b - a - target_id: 122 + target_id: 125 target_name: a inputs: - - id: 127 + - id: 130 name: t table: - default_db - - _literal_127 - - id: 122 + - _literal_130 + - id: 125 name: b table: - default_db - - _literal_122 -- - 0:3261-3315 + - _literal_125 +- - 0:3611-3665 - columns: - !Single name: - t - a - target_id: 136 + target_id: 139 target_name: null - !Single name: - b - a - target_id: 122 + target_id: 125 target_name: a inputs: - - id: 127 + - id: 130 name: t table: - default_db - - _literal_127 - - id: 122 + - _literal_130 + - id: 125 name: b table: - default_db - - _literal_122 + - _literal_125 - - 1:165-238 - columns: - !Single name: - t - a - target_id: 213 + target_id: 216 target_name: null inputs: - - id: 127 + - id: 130 name: t table: - default_db - - _literal_127 - - id: 122 + - _literal_130 + - id: 125 name: b table: - default_db - - _literal_122 + - _literal_125 - - 1:239-245 - columns: - !Single name: - t - a - target_id: 213 + target_id: 216 target_name: null inputs: - - id: 127 + - id: 130 name: t table: - default_db - - _literal_127 - - id: 122 + - _literal_130 + - id: 125 name: b table: - default_db - - _literal_122 + - _literal_125 nodes: -- id: 122 +- id: 125 kind: Array span: 1:173-237 - parent: 192 -- id: 127 + parent: 195 +- id: 130 kind: Array span: 1:36-55 - parent: 154 -- id: 136 + parent: 157 +- id: 139 kind: Ident ident: !Ident - this - t - a targets: - - 127 - parent: 138 -- id: 138 + - 130 + parent: 141 +- id: 141 kind: Tuple span: 1:64-69 children: - - 136 -- id: 154 + - 139 +- id: 157 kind: 'TransformCall: Take' span: 1:71-77 children: - - 127 - - 155 - parent: 192 -- id: 155 + - 130 + - 158 + parent: 195 +- id: 158 kind: Literal - parent: 154 -- id: 181 + parent: 157 +- id: 184 kind: Ident ident: !Ident - this - t - a targets: - - 136 -- id: 184 + - 139 +- id: 187 kind: Ident ident: !Ident - that - b - a targets: - - 122 -- id: 190 + - 125 +- id: 193 kind: RqOperator - span: 0:3201-3257 + span: 0:3551-3607 targets: - - 181 - 184 - parent: 192 -- id: 192 + - 187 + parent: 195 +- id: 195 kind: 'TransformCall: Join' - span: 0:3172-3258 + span: 0:3522-3608 children: - - 154 - - 122 - - 190 - parent: 211 -- id: 203 + - 157 + - 125 + - 193 + parent: 214 +- id: 206 kind: Ident - span: 0:6033-6041 + span: 0:6512-6520 ident: !Ident - this - b - a targets: - - 122 -- id: 207 + - 125 +- id: 210 kind: RqOperator - span: 0:3269-3314 + span: 0:3619-3664 targets: - - 203 - - 210 - parent: 211 -- id: 210 + - 206 + - 213 + parent: 214 +- id: 213 kind: Literal - span: 0:6045-6049 -- id: 211 + span: 0:6524-6528 +- id: 214 kind: 'TransformCall: Filter' - span: 0:3261-3315 + span: 0:3611-3665 children: - - 192 - - 207 - parent: 215 -- id: 213 + - 195 + - 210 + parent: 218 +- id: 216 kind: Ident ident: !Ident - this - t - a targets: - - 136 - parent: 214 -- id: 214 + - 139 + parent: 217 +- id: 217 kind: Tuple - span: 0:3325-3328 + span: 0:3675-3678 children: - - 213 - parent: 215 -- id: 215 + - 216 + parent: 218 +- id: 218 kind: 'TransformCall: Select' span: 1:165-238 children: - - 211 - 214 - parent: 218 -- id: 216 + - 217 + parent: 221 +- id: 219 kind: Ident span: 1:244-245 ident: !Ident @@ -226,14 +226,14 @@ nodes: - t - a targets: - - 213 - parent: 218 -- id: 218 + - 216 + parent: 221 +- id: 221 kind: 'TransformCall: Sort' span: 1:239-245 children: - - 215 - - 216 + - 218 + - 219 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort.snap index db7de1ae6789..3ed926464cb7 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort.snap @@ -7,10 +7,10 @@ frames: - - 1:30-61 - columns: - !All - input_id: 128 + input_id: 131 except: [] inputs: - - id: 128 + - id: 131 name: e table: - default_db @@ -18,10 +18,10 @@ frames: - - 1:62-90 - columns: - !All - input_id: 128 + input_id: 131 except: [] inputs: - - id: 128 + - id: 131 name: e table: - default_db @@ -29,18 +29,18 @@ frames: - - 1:145-215 - columns: - !All - input_id: 128 + input_id: 131 except: [] - !All - input_id: 119 + input_id: 122 except: [] inputs: - - id: 128 + - id: 131 name: e table: - default_db - employees - - id: 119 + - id: 122 name: manager table: - default_db @@ -49,54 +49,54 @@ frames: - columns: - !Single name: null - target_id: 144 + target_id: 147 target_name: null - !Single name: - e - last_name - target_id: 145 + target_id: 148 target_name: null - !Single name: - manager - first_name - target_id: 146 + target_id: 149 target_name: null inputs: - - id: 128 + - id: 131 name: e table: - default_db - employees - - id: 119 + - id: 122 name: manager table: - default_db - employees nodes: -- id: 119 +- id: 122 kind: Ident span: 1:158-167 ident: !Ident - default_db - employees - parent: 143 -- id: 128 + parent: 146 +- id: 131 kind: Ident span: 1:13-29 ident: !Ident - default_db - employees - parent: 134 -- id: 130 + parent: 137 +- id: 133 kind: RqOperator span: 1:37-61 targets: - - 132 - - 133 - parent: 134 -- id: 132 + - 135 + - 136 + parent: 137 +- id: 135 kind: Ident span: 1:37-47 ident: !Ident @@ -104,18 +104,18 @@ nodes: - e - first_name targets: - - 128 -- id: 133 + - 131 +- id: 136 kind: Literal span: 1:51-61 -- id: 134 +- id: 137 kind: 'TransformCall: Filter' span: 1:30-61 children: - - 128 - - 130 - parent: 138 -- id: 135 + - 131 + - 133 + parent: 141 +- id: 138 kind: Ident span: 1:68-78 ident: !Ident @@ -123,9 +123,9 @@ nodes: - e - first_name targets: - - 128 - parent: 138 -- id: 136 + - 131 + parent: 141 +- id: 139 kind: Ident span: 1:80-89 ident: !Ident @@ -133,24 +133,24 @@ nodes: - e - last_name targets: - - 128 - parent: 138 -- id: 138 + - 131 + parent: 141 +- id: 141 kind: 'TransformCall: Sort' span: 1:62-90 children: - - 134 - - 135 - - 136 - parent: 143 -- id: 139 + - 137 + - 138 + - 139 + parent: 146 +- id: 142 kind: RqOperator span: 1:179-214 targets: - - 141 - - 142 - parent: 143 -- id: 141 + - 144 + - 145 + parent: 146 +- id: 144 kind: Ident span: 1:179-191 ident: !Ident @@ -158,8 +158,8 @@ nodes: - e - reports_to targets: - - 128 -- id: 142 + - 131 +- id: 145 kind: Ident span: 1:195-214 ident: !Ident @@ -167,16 +167,16 @@ nodes: - manager - employee_id targets: - - 119 -- id: 143 + - 122 +- id: 146 kind: 'TransformCall: Join' span: 1:145-215 children: - - 138 - - 119 - - 139 - parent: 148 -- id: 144 + - 141 + - 122 + - 142 + parent: 151 +- id: 147 kind: Ident span: 1:225-237 ident: !Ident @@ -184,9 +184,9 @@ nodes: - e - first_name targets: - - 128 - parent: 147 -- id: 145 + - 131 + parent: 150 +- id: 148 kind: Ident span: 1:239-250 ident: !Ident @@ -194,9 +194,9 @@ nodes: - e - last_name targets: - - 128 - parent: 147 -- id: 146 + - 131 + parent: 150 +- id: 149 kind: Ident span: 1:252-270 ident: !Ident @@ -204,22 +204,22 @@ nodes: - manager - first_name targets: - - 119 - parent: 147 -- id: 147 + - 122 + parent: 150 +- id: 150 kind: Tuple span: 1:224-271 children: - - 144 - - 145 - - 146 - parent: 148 -- id: 148 + - 147 + - 148 + - 149 + parent: 151 +- id: 151 kind: 'TransformCall: Select' span: 1:217-271 children: - - 143 - - 147 + - 146 + - 150 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_2.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_2.snap index b49dc06cb375..103d179f5d1c 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_2.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_2.snap @@ -9,16 +9,16 @@ frames: - !Single name: - AA - target_id: 130 + target_id: 133 target_name: null - !Single name: - albums - artist_id - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 128 + - id: 131 name: albums table: - default_db @@ -28,16 +28,16 @@ frames: - !Single name: - AA - target_id: 130 + target_id: 133 target_name: null - !Single name: - albums - artist_id - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 128 + - id: 131 name: albums table: - default_db @@ -47,16 +47,16 @@ frames: - !Single name: - AA - target_id: 130 + target_id: 133 target_name: null - !Single name: - albums - artist_id - target_id: 131 + target_id: 134 target_name: null inputs: - - id: 128 + - id: 131 name: albums table: - default_db @@ -66,44 +66,44 @@ frames: - !Single name: - AA - target_id: 130 + target_id: 133 target_name: null - !Single name: - albums - artist_id - target_id: 131 + target_id: 134 target_name: null - !All - input_id: 116 + input_id: 119 except: [] inputs: - - id: 128 + - id: 131 name: albums table: - default_db - albums - - id: 116 + - id: 119 name: artists table: - default_db - artists nodes: -- id: 116 +- id: 119 kind: Ident span: 1:75-82 ident: !Ident - default_db - artists - parent: 146 -- id: 128 + parent: 149 +- id: 131 kind: Ident span: 1:0-11 ident: !Ident - default_db - albums - parent: 133 -- id: 130 + parent: 136 +- id: 133 kind: Ident span: 1:24-32 alias: AA @@ -112,9 +112,9 @@ nodes: - albums - album_id targets: - - 128 - parent: 132 -- id: 131 + - 131 + parent: 135 +- id: 134 kind: Ident span: 1:34-43 ident: !Ident @@ -122,71 +122,71 @@ nodes: - albums - artist_id targets: - - 128 - parent: 132 -- id: 132 + - 131 + parent: 135 +- id: 135 kind: Tuple span: 1:19-45 children: - - 130 - - 131 - parent: 133 -- id: 133 + - 133 + - 134 + parent: 136 +- id: 136 kind: 'TransformCall: Select' span: 1:12-45 children: - - 128 - - 132 - parent: 136 -- id: 134 + - 131 + - 135 + parent: 139 +- id: 137 kind: Ident span: 1:51-53 ident: !Ident - this - AA targets: - - 130 - parent: 136 -- id: 136 + - 133 + parent: 139 +- id: 139 kind: 'TransformCall: Sort' span: 1:46-53 children: - - 133 - - 134 - parent: 141 -- id: 137 + - 136 + - 137 + parent: 144 +- id: 140 kind: RqOperator span: 1:61-69 targets: - - 139 - - 140 - parent: 141 -- id: 139 + - 142 + - 143 + parent: 144 +- id: 142 kind: Ident span: 1:61-63 ident: !Ident - this - AA targets: - - 130 -- id: 140 + - 133 +- id: 143 kind: Literal span: 1:67-69 -- id: 141 +- id: 144 kind: 'TransformCall: Filter' span: 1:54-69 children: - - 136 - - 137 - parent: 146 -- id: 142 + - 139 + - 140 + parent: 149 +- id: 145 kind: RqOperator span: 1:84-95 targets: - - 144 - - 145 - parent: 146 -- id: 144 + - 147 + - 148 + parent: 149 +- id: 147 kind: Ident span: 1:86-95 ident: !Ident @@ -194,8 +194,8 @@ nodes: - albums - artist_id targets: - - 131 -- id: 145 + - 134 +- id: 148 kind: Ident span: 1:86-95 ident: !Ident @@ -203,14 +203,14 @@ nodes: - artists - artist_id targets: - - 116 -- id: 146 + - 119 +- id: 149 kind: 'TransformCall: Join' span: 1:70-96 children: - - 141 - - 116 - - 142 + - 144 + - 119 + - 145 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_3.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_3.snap index 3b4465152e42..b8661cd51586 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_3.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sort_3.snap @@ -9,565 +9,565 @@ frames: - !Single name: - AA - target_id: 150 + target_id: 153 target_name: null - !Single name: - - _literal_144 + - _literal_147 - album_id - target_id: 151 + target_id: 154 target_name: null - !Single name: - - _literal_144 + - _literal_147 - genre_id - target_id: 152 + target_id: 155 target_name: null inputs: - - id: 144 - name: _literal_144 + - id: 147 + name: _literal_147 table: - default_db - - _literal_144 + - _literal_147 - - 1:87-94 - columns: - !Single name: - AA - target_id: 150 + target_id: 153 target_name: null - !Single name: - - _literal_144 + - _literal_147 - album_id - target_id: 151 + target_id: 154 target_name: null - !Single name: - - _literal_144 + - _literal_147 - genre_id - target_id: 152 + target_id: 155 target_name: null inputs: - - id: 144 - name: _literal_144 + - id: 147 + name: _literal_147 table: - default_db - - _literal_144 + - _literal_147 - - 1:95-158 - columns: - !Single name: - AA - target_id: 150 + target_id: 153 target_name: null - !Single name: - - _literal_144 + - _literal_147 - album_id - target_id: 151 + target_id: 154 target_name: null - !Single name: - - _literal_144 + - _literal_147 - genre_id - target_id: 152 + target_id: 155 target_name: null - !Single name: - - _literal_132 + - _literal_135 - album_id - target_id: 132 + target_id: 135 target_name: album_id - !Single name: - - _literal_132 + - _literal_135 - album_title - target_id: 132 + target_id: 135 target_name: album_title inputs: - - id: 144 - name: _literal_144 + - id: 147 + name: _literal_147 table: - default_db - - _literal_144 - - id: 132 - name: _literal_132 + - _literal_147 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:159-213 - columns: - !Single name: - AA - target_id: 163 + target_id: 166 target_name: null - !Single name: - AT - target_id: 164 + target_id: 167 target_name: null - !Single name: - - _literal_144 + - _literal_147 - genre_id - target_id: 168 + target_id: 171 target_name: null inputs: - - id: 144 - name: _literal_144 + - id: 147 + name: _literal_147 table: - default_db - - _literal_144 - - id: 132 - name: _literal_132 + - _literal_147 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:214-228 - columns: - !Single name: - AA - target_id: 163 + target_id: 166 target_name: null - !Single name: - AT - target_id: 164 + target_id: 167 target_name: null - !Single name: - - _literal_144 + - _literal_147 - genre_id - target_id: 168 + target_id: 171 target_name: null inputs: - - id: 144 - name: _literal_144 + - id: 147 + name: _literal_147 table: - default_db - - _literal_144 - - id: 132 - name: _literal_132 + - _literal_147 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 + - _literal_135 - - 1:229-291 - columns: - !Single name: - AA - target_id: 163 + target_id: 166 target_name: null - !Single name: - AT - target_id: 164 + target_id: 167 target_name: null - !Single name: - - _literal_144 + - _literal_147 - genre_id - target_id: 168 + target_id: 171 target_name: null - !Single name: - - _literal_119 + - _literal_122 - genre_id - target_id: 119 + target_id: 122 target_name: genre_id - !Single name: - - _literal_119 + - _literal_122 - genre_title - target_id: 119 + target_id: 122 target_name: genre_title inputs: - - id: 144 - name: _literal_144 + - id: 147 + name: _literal_147 table: - default_db - - _literal_144 - - id: 132 - name: _literal_132 + - _literal_147 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 - - id: 119 - name: _literal_119 + - _literal_135 + - id: 122 + name: _literal_122 table: - default_db - - _literal_119 + - _literal_122 - - 1:292-340 - columns: - !Single name: - AA - target_id: 181 + target_id: 184 target_name: null - !Single name: - AT - target_id: 182 + target_id: 185 target_name: null - !Single name: - GT - target_id: 183 + target_id: 186 target_name: null inputs: - - id: 144 - name: _literal_144 + - id: 147 + name: _literal_147 table: - default_db - - _literal_144 - - id: 132 - name: _literal_132 + - _literal_147 + - id: 135 + name: _literal_135 table: - default_db - - _literal_132 - - id: 119 - name: _literal_119 + - _literal_135 + - id: 122 + name: _literal_122 table: - default_db - - _literal_119 + - _literal_122 nodes: -- id: 119 +- id: 122 kind: Array span: 1:244-278 children: - - 120 - parent: 180 -- id: 120 + - 123 + parent: 183 +- id: 123 kind: Tuple span: 1:245-277 children: - - 121 - - 122 - parent: 119 -- id: 121 + - 124 + - 125 + parent: 122 +- id: 124 kind: Literal span: 1:255-256 alias: genre_id - parent: 120 -- id: 122 + parent: 123 +- id: 125 kind: Literal span: 1:270-276 alias: genre_title - parent: 120 -- id: 132 + parent: 123 +- id: 135 kind: Array span: 1:110-145 children: - - 133 - parent: 162 -- id: 133 + - 136 + parent: 165 +- id: 136 kind: Tuple span: 1:111-144 children: - - 134 - - 135 - parent: 132 -- id: 134 + - 137 + - 138 + parent: 135 +- id: 137 kind: Literal span: 1:121-122 alias: album_id - parent: 133 -- id: 135 + parent: 136 +- id: 138 kind: Literal span: 1:136-143 alias: album_title - parent: 133 -- id: 144 + parent: 136 +- id: 147 kind: Array span: 1:0-43 children: - - 145 - parent: 154 -- id: 145 + - 148 + parent: 157 +- id: 148 kind: Tuple span: 1:6-42 children: - - 146 - - 147 - - 148 - parent: 144 -- id: 146 + - 149 + - 150 + - 151 + parent: 147 +- id: 149 kind: Literal span: 1:16-17 alias: track_id - parent: 145 -- id: 147 + parent: 148 +- id: 150 kind: Literal span: 1:28-29 alias: album_id - parent: 145 -- id: 148 + parent: 148 +- id: 151 kind: Literal span: 1:40-41 alias: genre_id - parent: 145 -- id: 150 + parent: 148 +- id: 153 kind: Ident span: 1:56-64 alias: AA ident: !Ident - this - - _literal_144 + - _literal_147 - track_id targets: - - 144 - parent: 153 -- id: 151 + - 147 + parent: 156 +- id: 154 kind: Ident span: 1:66-74 ident: !Ident - this - - _literal_144 + - _literal_147 - album_id targets: - - 144 - parent: 153 -- id: 152 + - 147 + parent: 156 +- id: 155 kind: Ident span: 1:76-84 ident: !Ident - this - - _literal_144 + - _literal_147 - genre_id targets: - - 144 - parent: 153 -- id: 153 + - 147 + parent: 156 +- id: 156 kind: Tuple span: 1:51-86 children: - - 150 - - 151 - - 152 - parent: 154 -- id: 154 + - 153 + - 154 + - 155 + parent: 157 +- id: 157 kind: 'TransformCall: Select' span: 1:44-86 children: - - 144 - - 153 - parent: 157 -- id: 155 + - 147 + - 156 + parent: 160 +- id: 158 kind: Ident span: 1:92-94 ident: !Ident - this - AA targets: - - 150 - parent: 157 -- id: 157 + - 153 + parent: 160 +- id: 160 kind: 'TransformCall: Sort' span: 1:87-94 children: - - 154 - - 155 - parent: 162 -- id: 158 + - 157 + - 158 + parent: 165 +- id: 161 kind: RqOperator span: 1:147-157 targets: - - 160 - - 161 - parent: 162 -- id: 160 + - 163 + - 164 + parent: 165 +- id: 163 kind: Ident span: 1:149-157 ident: !Ident - this - - _literal_144 + - _literal_147 - album_id targets: - - 151 -- id: 161 + - 154 +- id: 164 kind: Ident span: 1:149-157 ident: !Ident - that - - _literal_132 + - _literal_135 - album_id targets: - - 132 -- id: 162 + - 135 +- id: 165 kind: 'TransformCall: Join' span: 1:95-158 children: - - 157 - - 132 - - 158 - parent: 170 -- id: 163 + - 160 + - 135 + - 161 + parent: 173 +- id: 166 kind: Ident span: 1:168-170 ident: !Ident - this - AA targets: - - 150 - parent: 169 -- id: 164 + - 153 + parent: 172 +- id: 167 kind: RqOperator span: 1:177-201 alias: AT targets: - - 166 - - 167 - parent: 169 -- id: 166 + - 169 + - 170 + parent: 172 +- id: 169 kind: Ident span: 1:177-188 ident: !Ident - this - - _literal_132 + - _literal_135 - album_title targets: - - 132 -- id: 167 + - 135 +- id: 170 kind: Literal span: 1:192-201 -- id: 168 +- id: 171 kind: Ident span: 1:203-211 ident: !Ident - this - - _literal_144 + - _literal_147 - genre_id targets: - - 152 - parent: 169 -- id: 169 + - 155 + parent: 172 +- id: 172 kind: Tuple span: 1:166-213 children: - - 163 - - 164 - - 168 - parent: 170 -- id: 170 + - 166 + - 167 + - 171 + parent: 173 +- id: 173 kind: 'TransformCall: Select' span: 1:159-213 children: - - 162 - - 169 - parent: 175 -- id: 171 + - 165 + - 172 + parent: 178 +- id: 174 kind: RqOperator span: 1:221-228 targets: - - 173 - - 174 - parent: 175 -- id: 173 + - 176 + - 177 + parent: 178 +- id: 176 kind: Ident span: 1:221-223 ident: !Ident - this - AA targets: - - 163 -- id: 174 + - 166 +- id: 177 kind: Literal span: 1:226-228 -- id: 175 +- id: 178 kind: 'TransformCall: Filter' span: 1:214-228 children: - - 170 - - 171 - parent: 180 -- id: 176 + - 173 + - 174 + parent: 183 +- id: 179 kind: RqOperator span: 1:280-290 targets: - - 178 - - 179 - parent: 180 -- id: 178 + - 181 + - 182 + parent: 183 +- id: 181 kind: Ident span: 1:282-290 ident: !Ident - this - - _literal_144 + - _literal_147 - genre_id targets: - - 168 -- id: 179 + - 171 +- id: 182 kind: Ident span: 1:282-290 ident: !Ident - that - - _literal_119 + - _literal_122 - genre_id targets: - - 119 -- id: 180 + - 122 +- id: 183 kind: 'TransformCall: Join' span: 1:229-291 children: - - 175 - - 119 - - 176 - parent: 188 -- id: 181 + - 178 + - 122 + - 179 + parent: 191 +- id: 184 kind: Ident span: 1:301-303 ident: !Ident - this - AA targets: - - 163 - parent: 187 -- id: 182 + - 166 + parent: 190 +- id: 185 kind: Ident span: 1:305-307 ident: !Ident - this - AT targets: - - 164 - parent: 187 -- id: 183 + - 167 + parent: 190 +- id: 186 kind: RqOperator span: 1:314-338 alias: GT targets: - - 185 - - 186 - parent: 187 -- id: 185 + - 188 + - 189 + parent: 190 +- id: 188 kind: Ident span: 1:314-325 ident: !Ident - this - - _literal_119 + - _literal_122 - genre_title targets: - - 119 -- id: 186 + - 122 +- id: 189 kind: Literal span: 1:329-338 -- id: 187 +- id: 190 kind: Tuple span: 1:299-340 children: - - 181 - - 182 - - 183 - parent: 188 -- id: 188 + - 184 + - 185 + - 186 + parent: 191 +- id: 191 kind: 'TransformCall: Select' span: 1:292-340 children: - - 180 - - 187 + - 183 + - 190 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__switch.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__switch.snap index 45387d65e704..e5bc59900684 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__switch.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__switch.snap @@ -7,10 +7,10 @@ frames: - - 1:101-118 - columns: - !All - input_id: 124 + input_id: 127 except: [] inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -20,10 +20,10 @@ frames: - !Single name: - display - target_id: 129 + target_id: 132 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db @@ -33,23 +33,23 @@ frames: - !Single name: - display - target_id: 129 + target_id: 132 target_name: null inputs: - - id: 124 + - id: 127 name: tracks table: - default_db - tracks nodes: -- id: 124 +- id: 127 kind: Ident span: 1:89-100 ident: !Ident - default_db - tracks - parent: 128 -- id: 126 + parent: 131 +- id: 129 kind: Ident span: 1:106-118 ident: !Ident @@ -57,34 +57,34 @@ nodes: - tracks - milliseconds targets: - - 124 - parent: 128 -- id: 128 + - 127 + parent: 131 +- id: 131 kind: 'TransformCall: Sort' span: 1:101-118 children: - - 124 - - 126 - parent: 143 -- id: 129 + - 127 + - 129 + parent: 146 +- id: 132 kind: Case span: 1:136-246 alias: display targets: - - 130 - - 134 - - 135 - - 139 - - 140 - - 141 - parent: 142 -- id: 130 + - 133 + - 137 + - 138 + - 142 + - 143 + - 144 + parent: 145 +- id: 133 kind: RqOperator span: 1:147-163 targets: - - 132 - - 133 -- id: 132 + - 135 + - 136 +- id: 135 kind: Ident span: 1:147-155 ident: !Ident @@ -92,11 +92,11 @@ nodes: - tracks - composer targets: - - 124 -- id: 133 + - 127 +- id: 136 kind: Literal span: 1:159-163 -- id: 134 +- id: 137 kind: Ident span: 1:167-175 ident: !Ident @@ -104,14 +104,14 @@ nodes: - tracks - composer targets: - - 124 -- id: 135 + - 127 +- id: 138 kind: RqOperator span: 1:181-194 targets: - - 137 - - 138 -- id: 137 + - 140 + - 141 +- id: 140 kind: Ident span: 1:181-189 ident: !Ident @@ -119,41 +119,41 @@ nodes: - tracks - genre_id targets: - - 124 -- id: 138 + - 127 +- id: 141 kind: Literal span: 1:192-194 -- id: 139 +- id: 142 kind: Literal span: 1:198-211 -- id: 140 +- id: 143 kind: Literal span: 1:217-221 -- id: 141 +- id: 144 kind: FString span: 1:225-244 -- id: 142 +- id: 145 kind: Tuple span: 1:136-246 children: - - 129 - parent: 143 -- id: 143 + - 132 + parent: 146 +- id: 146 kind: 'TransformCall: Select' span: 1:119-246 children: - - 128 - - 142 - parent: 145 -- id: 145 + - 131 + - 145 + parent: 148 +- id: 148 kind: 'TransformCall: Take' span: 1:247-254 children: - - 143 - 146 -- id: 146 + - 149 +- id: 149 kind: Literal - parent: 145 + parent: 148 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__take.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__take.snap index 3155ca37ba1b..e5af1a1029d8 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__take.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__take.snap @@ -7,10 +7,10 @@ frames: - - 1:25-41 - columns: - !All - input_id: 121 + input_id: 124 except: [] inputs: - - id: 121 + - id: 124 name: tracks table: - default_db @@ -18,23 +18,23 @@ frames: - - 1:42-51 - columns: - !All - input_id: 121 + input_id: 124 except: [] inputs: - - id: 121 + - id: 124 name: tracks table: - default_db - tracks nodes: -- id: 121 +- id: 124 kind: Ident span: 1:13-24 ident: !Ident - default_db - tracks - parent: 125 -- id: 123 + parent: 128 +- id: 126 kind: Ident span: 1:31-40 ident: !Ident @@ -42,32 +42,32 @@ nodes: - tracks - track_id targets: - - 121 - parent: 125 -- id: 125 + - 124 + parent: 128 +- id: 128 kind: 'TransformCall: Sort' span: 1:25-41 children: - - 121 - - 123 - parent: 129 -- id: 126 + - 124 + - 126 + parent: 132 +- id: 129 kind: Literal span: 1:47-48 alias: start - parent: 129 -- id: 127 + parent: 132 +- id: 130 kind: Literal span: 1:50-51 alias: end - parent: 129 -- id: 129 + parent: 132 +- id: 132 kind: 'TransformCall: Take' span: 1:42-51 children: - - 125 - - 126 - - 127 + - 128 + - 129 + - 130 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__text_module.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__text_module.snap index d9a041d7f748..c85ee9e4f07d 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__text_module.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__text_module.snap @@ -10,55 +10,55 @@ frames: name: - albums - title - target_id: 126 + target_id: 129 target_name: null - !Single name: - title_and_spaces - target_id: 127 + target_id: 130 target_name: null - !Single name: - low - target_id: 129 + target_id: 132 target_name: null - !Single name: - up - target_id: 132 + target_id: 135 target_name: null - !Single name: - ltrimmed - target_id: 135 + target_id: 138 target_name: null - !Single name: - rtrimmed - target_id: 138 + target_id: 141 target_name: null - !Single name: - trimmed - target_id: 141 + target_id: 144 target_name: null - !Single name: - len - target_id: 144 + target_id: 147 target_name: null - !Single name: - subs - target_id: 147 + target_id: 150 target_name: null - !Single name: - replace - target_id: 153 + target_id: 156 target_name: null inputs: - - id: 124 + - id: 127 name: albums table: - default_db @@ -69,55 +69,55 @@ frames: name: - albums - title - target_id: 126 + target_id: 129 target_name: null - !Single name: - title_and_spaces - target_id: 127 + target_id: 130 target_name: null - !Single name: - low - target_id: 129 + target_id: 132 target_name: null - !Single name: - up - target_id: 132 + target_id: 135 target_name: null - !Single name: - ltrimmed - target_id: 135 + target_id: 138 target_name: null - !Single name: - rtrimmed - target_id: 138 + target_id: 141 target_name: null - !Single name: - trimmed - target_id: 141 + target_id: 144 target_name: null - !Single name: - len - target_id: 144 + target_id: 147 target_name: null - !Single name: - subs - target_id: 147 + target_id: 150 target_name: null - !Single name: - replace - target_id: 153 + target_id: 156 target_name: null inputs: - - id: 124 + - id: 127 name: albums table: - default_db @@ -128,68 +128,68 @@ frames: name: - albums - title - target_id: 126 + target_id: 129 target_name: null - !Single name: - title_and_spaces - target_id: 127 + target_id: 130 target_name: null - !Single name: - low - target_id: 129 + target_id: 132 target_name: null - !Single name: - up - target_id: 132 + target_id: 135 target_name: null - !Single name: - ltrimmed - target_id: 135 + target_id: 138 target_name: null - !Single name: - rtrimmed - target_id: 138 + target_id: 141 target_name: null - !Single name: - trimmed - target_id: 141 + target_id: 144 target_name: null - !Single name: - len - target_id: 144 + target_id: 147 target_name: null - !Single name: - subs - target_id: 147 + target_id: 150 target_name: null - !Single name: - replace - target_id: 153 + target_id: 156 target_name: null inputs: - - id: 124 + - id: 127 name: albums table: - default_db - albums nodes: -- id: 124 +- id: 127 kind: Ident span: 1:115-126 ident: !Ident - default_db - albums - parent: 160 -- id: 126 + parent: 163 +- id: 129 kind: Ident span: 1:140-145 ident: !Ident @@ -197,16 +197,16 @@ nodes: - albums - title targets: - - 124 - parent: 159 -- id: 127 + - 127 + parent: 162 +- id: 130 kind: FString span: 1:170-184 alias: title_and_spaces targets: - - 128 - parent: 159 -- id: 128 + - 131 + parent: 162 +- id: 131 kind: Ident span: 1:175-180 ident: !Ident @@ -214,15 +214,15 @@ nodes: - albums - title targets: - - 124 -- id: 129 + - 127 +- id: 132 kind: RqOperator span: 1:205-215 alias: low targets: - - 131 - parent: 159 -- id: 131 + - 134 + parent: 162 +- id: 134 kind: Ident span: 1:197-202 ident: !Ident @@ -230,15 +230,15 @@ nodes: - albums - title targets: - - 124 -- id: 132 + - 127 +- id: 135 kind: RqOperator span: 1:236-246 alias: up targets: - - 134 - parent: 159 -- id: 134 + - 137 + parent: 162 +- id: 137 kind: Ident span: 1:228-233 ident: !Ident @@ -246,15 +246,15 @@ nodes: - albums - title targets: - - 124 -- id: 135 + - 127 +- id: 138 kind: RqOperator span: 1:273-283 alias: ltrimmed targets: - - 137 - parent: 159 -- id: 137 + - 140 + parent: 162 +- id: 140 kind: Ident span: 1:265-270 ident: !Ident @@ -262,15 +262,15 @@ nodes: - albums - title targets: - - 124 -- id: 138 + - 127 +- id: 141 kind: RqOperator span: 1:310-320 alias: rtrimmed targets: - - 140 - parent: 159 -- id: 140 + - 143 + parent: 162 +- id: 143 kind: Ident span: 1:302-307 ident: !Ident @@ -278,15 +278,15 @@ nodes: - albums - title targets: - - 124 -- id: 141 + - 127 +- id: 144 kind: RqOperator span: 1:346-355 alias: trimmed targets: - - 143 - parent: 159 -- id: 143 + - 146 + parent: 162 +- id: 146 kind: Ident span: 1:338-343 ident: !Ident @@ -294,15 +294,15 @@ nodes: - albums - title targets: - - 124 -- id: 144 + - 127 +- id: 147 kind: RqOperator span: 1:377-388 alias: len targets: - - 146 - parent: 159 -- id: 146 + - 149 + parent: 162 +- id: 149 kind: Ident span: 1:369-374 ident: !Ident @@ -310,23 +310,23 @@ nodes: - albums - title targets: - - 124 -- id: 147 + - 127 +- id: 150 kind: RqOperator span: 1:411-427 alias: subs targets: - - 150 - - 151 - - 152 - parent: 159 -- id: 150 + - 153 + - 154 + - 155 + parent: 162 +- id: 153 kind: Literal span: 1:424-425 -- id: 151 +- id: 154 kind: Literal span: 1:426-427 -- id: 152 +- id: 155 kind: Ident span: 1:403-408 ident: !Ident @@ -334,23 +334,23 @@ nodes: - albums - title targets: - - 124 -- id: 153 + - 127 +- id: 156 kind: RqOperator span: 1:453-477 alias: replace targets: - - 156 - - 157 - - 158 - parent: 159 -- id: 156 + - 159 + - 160 + - 161 + parent: 162 +- id: 159 kind: Literal span: 1:466-470 -- id: 157 +- id: 160 kind: Literal span: 1:471-477 -- id: 158 +- id: 161 kind: Ident span: 1:445-450 ident: !Ident @@ -358,30 +358,30 @@ nodes: - albums - title targets: - - 124 -- id: 159 + - 127 +- id: 162 kind: Tuple span: 1:134-481 children: - - 126 - - 127 - 129 + - 130 - 132 - 135 - 138 - 141 - 144 - 147 - - 153 - parent: 160 -- id: 160 + - 150 + - 156 + parent: 163 +- id: 163 kind: 'TransformCall: Select' span: 1:127-481 children: - - 124 - - 159 - parent: 163 -- id: 161 + - 127 + - 162 + parent: 166 +- id: 164 kind: Ident span: 1:488-493 ident: !Ident @@ -389,38 +389,38 @@ nodes: - albums - title targets: - - 126 - parent: 163 -- id: 163 + - 129 + parent: 166 +- id: 166 kind: 'TransformCall: Sort' span: 1:482-494 children: - - 160 - - 161 - parent: 183 -- id: 164 + - 163 + - 164 + parent: 186 +- id: 167 kind: RqOperator span: 1:502-606 targets: - - 166 - - 178 - parent: 183 -- id: 166 + - 169 + - 181 + parent: 186 +- id: 169 kind: RqOperator span: 1:502-573 targets: - - 168 - - 173 -- id: 168 + - 171 + - 176 +- id: 171 kind: RqOperator span: 1:511-535 targets: - - 171 - - 172 -- id: 171 + - 174 + - 175 +- id: 174 kind: Literal span: 1:528-535 -- id: 172 +- id: 175 kind: Ident span: 1:503-508 ident: !Ident @@ -428,17 +428,17 @@ nodes: - albums - title targets: - - 126 -- id: 173 + - 129 +- id: 176 kind: RqOperator span: 1:549-572 targets: - - 176 - - 177 -- id: 176 + - 179 + - 180 +- id: 179 kind: Literal span: 1:563-572 -- id: 177 +- id: 180 kind: Ident span: 1:541-546 ident: !Ident @@ -446,17 +446,17 @@ nodes: - albums - title targets: - - 126 -- id: 178 + - 129 +- id: 181 kind: RqOperator span: 1:586-605 targets: - - 181 - - 182 -- id: 181 + - 184 + - 185 +- id: 184 kind: Literal span: 1:601-605 -- id: 182 +- id: 185 kind: Ident span: 1:578-583 ident: !Ident @@ -464,13 +464,13 @@ nodes: - albums - title targets: - - 126 -- id: 183 + - 129 +- id: 186 kind: 'TransformCall: Filter' span: 1:495-606 children: - - 163 - - 164 + - 166 + - 167 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__window.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__window.snap index fe50146de194..ea8c1ebc519f 100644 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__window.snap +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__window.snap @@ -7,26 +7,26 @@ frames: - - 1:521-614 - columns: - !All - input_id: 127 + input_id: 130 except: - genre_id - !Single name: - num - target_id: 165 + target_id: 168 target_name: null - !Single name: - total - target_id: 173 + target_id: 176 target_name: null - !Single name: - last_val - target_id: 175 + target_id: 178 target_name: null inputs: - - id: 127 + - id: 130 name: tracks table: - default_db @@ -37,29 +37,29 @@ frames: name: - tracks - genre_id - target_id: 129 + target_id: 132 target_name: null - !All - input_id: 127 + input_id: 130 except: - genre_id - !Single name: - num - target_id: 165 + target_id: 168 target_name: null - !Single name: - total - target_id: 173 + target_id: 176 target_name: null - !Single name: - last_val - target_id: 175 + target_id: 178 target_name: null inputs: - - id: 127 + - id: 130 name: tracks table: - default_db @@ -70,29 +70,29 @@ frames: name: - tracks - genre_id - target_id: 129 + target_id: 132 target_name: null - !All - input_id: 127 + input_id: 130 except: - genre_id - !Single name: - num - target_id: 165 + target_id: 168 target_name: null - !Single name: - total - target_id: 173 + target_id: 176 target_name: null - !Single name: - last_val - target_id: 175 + target_id: 178 target_name: null inputs: - - id: 127 + - id: 130 name: tracks table: - default_db @@ -103,31 +103,31 @@ frames: name: - tracks - track_id - target_id: 189 + target_id: 192 target_name: null - !Single name: - tracks - genre_id - target_id: 190 + target_id: 193 target_name: null - !Single name: - num - target_id: 191 + target_id: 194 target_name: null - !Single name: - total - target_id: 192 + target_id: 195 target_name: null - !Single name: - last_val - target_id: 193 + target_id: 196 target_name: null inputs: - - id: 127 + - id: 130 name: tracks table: - default_db @@ -138,44 +138,44 @@ frames: name: - tracks - track_id - target_id: 189 + target_id: 192 target_name: null - !Single name: - tracks - genre_id - target_id: 190 + target_id: 193 target_name: null - !Single name: - num - target_id: 191 + target_id: 194 target_name: null - !Single name: - total - target_id: 192 + target_id: 195 target_name: null - !Single name: - last_val - target_id: 193 + target_id: 196 target_name: null inputs: - - id: 127 + - id: 130 name: tracks table: - default_db - tracks nodes: -- id: 127 +- id: 130 kind: Ident span: 1:470-481 ident: !Ident - default_db - tracks - parent: 179 -- id: 129 + parent: 182 +- id: 132 kind: Ident span: 1:488-496 ident: !Ident @@ -183,14 +183,14 @@ nodes: - tracks - genre_id targets: - - 127 - parent: 138 -- id: 138 + - 130 + parent: 141 +- id: 141 kind: Tuple span: 1:488-496 children: - - 129 -- id: 157 + - 132 +- id: 160 kind: Ident span: 1:506-518 ident: !Ident @@ -198,33 +198,33 @@ nodes: - tracks - milliseconds targets: - - 127 -- id: 165 + - 130 +- id: 168 kind: RqOperator span: 1:540-555 alias: num targets: - - 166 - parent: 178 -- id: 166 + - 169 + parent: 181 +- id: 169 kind: Literal -- id: 173 +- id: 176 kind: RqOperator span: 1:569-579 alias: total targets: - - 174 - parent: 178 -- id: 174 + - 177 + parent: 181 +- id: 177 kind: Literal -- id: 175 +- id: 178 kind: RqOperator span: 1:596-609 alias: last_val targets: - - 177 - parent: 178 -- id: 177 + - 180 + parent: 181 +- id: 180 kind: Ident span: 1:601-609 ident: !Ident @@ -232,33 +232,33 @@ nodes: - tracks - track_id targets: - - 127 -- id: 178 + - 130 +- id: 181 kind: Tuple span: 1:528-614 children: - - 165 - - 173 - - 175 - parent: 179 -- id: 179 + - 168 + - 176 + - 178 + parent: 182 +- id: 182 kind: 'TransformCall: Derive' span: 1:521-614 children: - - 127 - - 178 - parent: 181 -- id: 181 + - 130 + - 181 + parent: 184 +- id: 184 kind: 'TransformCall: Take' span: 1:617-624 children: - - 179 - 182 - parent: 188 -- id: 182 - kind: Literal - parent: 181 + - 185 + parent: 191 - id: 185 + kind: Literal + parent: 184 +- id: 188 kind: Ident span: 1:633-641 ident: !Ident @@ -266,9 +266,9 @@ nodes: - tracks - genre_id targets: - - 129 - parent: 188 -- id: 186 + - 132 + parent: 191 +- id: 189 kind: Ident span: 1:643-655 ident: !Ident @@ -276,17 +276,17 @@ nodes: - tracks - milliseconds targets: - - 127 - parent: 188 -- id: 188 + - 130 + parent: 191 +- id: 191 kind: 'TransformCall: Sort' span: 1:627-656 children: - - 181 - - 185 - - 186 - parent: 195 -- id: 189 + - 184 + - 188 + - 189 + parent: 198 +- id: 192 kind: Ident span: 1:665-673 ident: !Ident @@ -294,9 +294,9 @@ nodes: - tracks - track_id targets: - - 127 - parent: 194 -- id: 190 + - 130 + parent: 197 +- id: 193 kind: Ident span: 1:675-683 ident: !Ident @@ -304,60 +304,60 @@ nodes: - tracks - genre_id targets: - - 129 - parent: 194 -- id: 191 + - 132 + parent: 197 +- id: 194 kind: Ident span: 1:685-688 ident: !Ident - this - num targets: - - 165 - parent: 194 -- id: 192 + - 168 + parent: 197 +- id: 195 kind: Ident span: 1:690-695 ident: !Ident - this - total targets: - - 173 - parent: 194 -- id: 193 + - 176 + parent: 197 +- id: 196 kind: Ident span: 1:697-705 ident: !Ident - this - last_val targets: - - 175 - parent: 194 -- id: 194 + - 178 + parent: 197 +- id: 197 kind: Tuple span: 1:664-706 children: - - 189 - - 190 - - 191 - 192 - 193 - parent: 195 -- id: 195 + - 194 + - 195 + - 196 + parent: 198 +- id: 198 kind: 'TransformCall: Select' span: 1:657-706 children: - - 188 - - 194 - parent: 200 -- id: 196 + - 191 + - 197 + parent: 203 +- id: 199 kind: RqOperator span: 1:714-728 targets: - - 198 - - 199 - parent: 200 -- id: 198 + - 201 + - 202 + parent: 203 +- id: 201 kind: Ident span: 1:714-722 ident: !Ident @@ -365,16 +365,16 @@ nodes: - tracks - genre_id targets: - - 190 -- id: 199 + - 193 +- id: 202 kind: Literal span: 1:726-728 -- id: 200 +- id: 203 kind: 'TransformCall: Filter' span: 1:707-728 children: - - 195 - - 196 + - 198 + - 199 ast: name: Project stmts: diff --git a/prqlc/prqlc/tests/integration/sql.rs b/prqlc/prqlc/tests/integration/sql.rs index 0f2cc0ebecc1..e15a72fda382 100644 --- a/prqlc/prqlc/tests/integration/sql.rs +++ b/prqlc/prqlc/tests/integration/sql.rs @@ -7449,3 +7449,107 @@ fn test_tuple_map_aliases() { foo "###); } + +#[test] +fn test_tuple_reverse() { + assert_snapshot!(compile(r###" + from foo + select {x, y, z} + select (tuple_reverse this.*) + "###).unwrap(), @r###" + SELECT + z, + y, + x + FROM + foo + "###); +} + +#[test] +fn test_tuple_uniq() { + assert_snapshot!(compile(r###" + from foo + select {x, y, z} + select (tuple_uniq {z = 5, this.*}) + "###).unwrap(), @r###" + SELECT + 5 AS z, + x, + y + FROM + foo + "###); + + assert_snapshot!(compile(r###" + from foo + select {x, y, z} + select (tuple_uniq take:late {z = 5, this.*}) + "###).unwrap(), @r###" + SELECT + z, + x, + y + FROM + foo + "###); +} + +#[test] +fn test_tuple_uniq_no_alias() { + assert_snapshot!(compile(r###" + from foo + select (tuple_uniq {x, 4, 5}) + "###).unwrap(), @r###" + SELECT + x + FROM + foo + "###); +} + +#[test] +fn test_wildcard_func_param() { + assert_snapshot!(compile(r###" + let _my_func = func top -> select {top.*, b = 4} top + + from foo + select {x, y} + _my_func + "###).unwrap(), @r###" + SELECT + x, + y, + 4 AS b + FROM + foo + "###); +} + +#[test] +fn test_append_by_name() { + assert_snapshot!(compile(r###" + from foo + select {x, y, b = 4} + append by:name (from bar | select {y, z, b = 5, c = 7}) + "###).unwrap(), @r###" + SELECT + x, + y, + 4 AS b, + NULL AS z, + NULL AS c + FROM + foo + UNION + ALL + SELECT + NULL AS x, + y, + 5 AS b, + z, + 7 AS c + FROM + bar + "###); +} diff --git a/web/book/src/SUMMARY.md b/web/book/src/SUMMARY.md index aba75086b8d7..dffa070a40fc 100644 --- a/web/book/src/SUMMARY.md +++ b/web/book/src/SUMMARY.md @@ -68,6 +68,7 @@ language design decisions and formal specifications for parts of the language. - [Date functions](./reference/stdlib/date.md) - [Mathematical functions](./reference/stdlib/math.md) - [Text functions](./reference/stdlib/text.md) + - [Tuple functions](./reference/stdlib/tuple.md) - [Removing duplicates](./reference/stdlib/distinct.md) - [Specification](./reference/spec/README.md) diff --git a/web/book/src/reference/stdlib/transforms/append.md b/web/book/src/reference/stdlib/transforms/append.md index fdee962c8dc6..e9e25e93cc0d 100644 --- a/web/book/src/reference/stdlib/transforms/append.md +++ b/web/book/src/reference/stdlib/transforms/append.md @@ -2,15 +2,39 @@ Concatenates two tables together. +```prql no-eval +append by:{position|name} rel +``` + Equivalent to `UNION ALL` in SQL. The number of rows is always the sum of the -number of rows from the two input tables. To replicate `UNION DISTINCT`, see -[set operations](#set-operations). +number of rows from the two input tables. The number of columns in each input +table must be the same, and the columns will align by position by default. ```prql from employees_1 append employees_2 ``` +To replicate `UNION DISTINCT`, see [set operations](#set-operations). + +Tables can also be combined by column name rather than column position by adding +the `by:name` argument to `append`. When appending by name, the number of +columns in each table does not need to be the same; columns present in one +relation but missing from the other will have NULL values added. This mode +currently only works if the set of columns on both sides is fully defined. + +```prql +from employees_1 +select {id, name, dob, zip} +append by:name ( + from employees_2 + select {id, name, email, zip} +) +``` + +> Support for generating dialect-specific `UNION ALL BY NAME` queries is +> pending. + ## Remove > _experimental_ diff --git a/web/book/src/reference/stdlib/tuple.md b/web/book/src/reference/stdlib/tuple.md new file mode 100644 index 000000000000..61e0962fa7f5 --- /dev/null +++ b/web/book/src/reference/stdlib/tuple.md @@ -0,0 +1,119 @@ +# Tuple functions + +The standard library defines the following functions for manipulating tuples: + +### `tuple_reduce` + +Applies a two-parameter function cumulatively across a tuple, in order to reduce +the tuple to a single value. + +```prql +from invoices +derive { + cleared = tuple_reduce std.and { + received, processed, packed, shipped + } +} +``` + +When the `initial:` named parameter is provided, its value will be used to +initialize the reduction operation, and will be the default value if the tuple +is empty. + +```prql +from test +derive { + mysum = tuple_reduce initial:0 add {1, 2, 3} +} +``` + +If `initial` is not provided, when the tuple has exactly one entry, its value +will be returned; when the tuple is empty, an error will be raised. + +### `tuple_map` + +Applies a function to each entry in a tuple, returning a tuple. Aliases defined +in the tuple will be passed through to the output. + +```prql +prql target:sql.duckdb + +from invoices +select ( + tuple_map (date.to_text "%d/%m/%Y") { + rcv_txt = received_on, + prc_txt = processed_on, + } +) +``` + +### `tuple_zip` + +Combines two tuples into one tuple by aligning them in parallel and creating +tuples out of each aligned pair. This can be used in conjunction with +`tuple_map` and `tuple_reduce` in various ways: + +```prql +from invoices +derive ( + tuple_zip {x, y} {u, v} + tuple_map (tuple_reduce (func a b -> a + b)) +) +``` + +### `tuple_uniq` + +Iteratively deduplicates a tuple by alias (or, when an alias is not defined, by +its referenced column name). This can help to have more control over situations +when a column may be being overwritten. + +For example, the following includes all columns from both `invoices` and +`shipments` in the final result, even those that have overlapping names: + +```prql +let shipments = (from shipments | select {id, invoice_id, date_of, shipped_on}) + +from invoices +select {id, date_of, processed} +join shipments (this.id == that.invoice_id) +``` + +Adding `select (tuple_uniq take:late {invoices.*, shipments.*})` will allow the +columns from `shipments` to appear in the output taking precedence over those +from `invoices`. + +```prql +let shipments = (from shipments | select {id, invoice_id, date_of, shipped_on}) + +from invoices +select {id, date_of, processed} +join shipments (this.id == that.invoice_id) +select (tuple_uniq take:late {invoices.*, shipments.*}) +``` + +Using `take:early` rather than `take:late` flips the priority. + +```prql +let shipments = (from shipments | select {id, invoice_id, date_of, shipped_on}) + +from invoices +select {id, date_of, processed} +join shipments (this.id == that.invoice_id) +select (tuple_uniq take:early {invoices.*, shipments.*}) +``` + +Items in a tuple without a name or an alias will be dropped. + +```prql +from test +select (tuple_uniq {x, 5, y}) +``` + +### `tuple_reverse` + +Reverses the order of a tuple. + +```prql +from test +select (tuple_reverse {x, y, z}) +``` diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__transforms__append__1.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__transforms__append__1.snap new file mode 100644 index 000000000000..3218b598dc95 --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__transforms__append__1.snap @@ -0,0 +1,22 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "from employees_1\nselect {id, name, dob, zip}\nappend by:name (\n from employees_2\n select {id, name, email, zip}\n)\n" +--- +SELECT + id, + name, + dob, + zip, + NULL AS email +FROM + employees_1 +UNION +ALL +SELECT + id, + name, + NULL AS dob, + zip, + email +FROM + employees_2 diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__0.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__0.snap new file mode 100644 index 000000000000..a3df3362ae4e --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__0.snap @@ -0,0 +1,12 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "from invoices\nderive {\n cleared = tuple_reduce std.and {\n received, processed, packed, shipped\n }\n}\n" +--- +SELECT + *, + received + AND processed + AND packed + AND shipped AS cleared +FROM + invoices diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__1.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__1.snap new file mode 100644 index 000000000000..6d9812a7c890 --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__1.snap @@ -0,0 +1,9 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "from test\nderive {\n mysum = tuple_reduce initial:0 add {1, 2, 3}\n}\n" +--- +SELECT + *, + 0 + 1 + 2 + 3 AS mysum +FROM + test diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__2.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__2.snap new file mode 100644 index 000000000000..26c40ca2a089 --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__2.snap @@ -0,0 +1,9 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "prql target:sql.duckdb\n\nfrom invoices\nselect (\n tuple_map (date.to_text \"%d/%m/%Y\") {\n rcv_txt = received_on,\n prc_txt = processed_on,\n }\n)\n" +--- +SELECT + strftime(received_on, '%d/%m/%Y') AS rcv_txt, + strftime(processed_on, '%d/%m/%Y') AS prc_txt +FROM + invoices diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__3.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__3.snap new file mode 100644 index 000000000000..601bc9deb2bf --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__3.snap @@ -0,0 +1,10 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "from invoices\nderive (\n tuple_zip {x, y} {u, v}\n tuple_map (tuple_reduce (func a b -> a + b))\n)\n" +--- +SELECT + *, + x + u, + y + v +FROM + invoices diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__4.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__4.snap new file mode 100644 index 000000000000..c0cc4296a999 --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__4.snap @@ -0,0 +1,23 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "let shipments = (from shipments | select {id, invoice_id, date_of, shipped_on})\n\nfrom invoices\nselect {id, date_of, processed}\njoin shipments (this.id == that.invoice_id)\n" +--- +WITH table_0 AS ( + SELECT + id, + invoice_id, + date_of, + shipped_on + FROM + shipments +) +SELECT + invoices.id, + invoices.date_of, + invoices.processed, + shipments.id, + shipments.invoice_id, + shipments.shipped_on +FROM + invoices + INNER JOIN table_0 AS shipments ON invoices.id = shipments.invoice_id diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__5.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__5.snap new file mode 100644 index 000000000000..ba0b239b63ba --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__5.snap @@ -0,0 +1,22 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "let shipments = (from shipments | select {id, invoice_id, date_of, shipped_on})\n\nfrom invoices\nselect {id, date_of, processed}\njoin shipments (this.id == that.invoice_id)\nselect (tuple_uniq take:late {invoices.*, shipments.*})\n" +--- +WITH table_0 AS ( + SELECT + id, + invoice_id, + date_of, + shipped_on + FROM + shipments +) +SELECT + shipments.id, + shipments.date_of, + invoices.processed, + shipments.invoice_id, + shipments.shipped_on +FROM + invoices + INNER JOIN table_0 AS shipments ON invoices.id = shipments.invoice_id diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__6.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__6.snap new file mode 100644 index 000000000000..f19ac7bc68f2 --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__6.snap @@ -0,0 +1,22 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "let shipments = (from shipments | select {id, invoice_id, date_of, shipped_on})\n\nfrom invoices\nselect {id, date_of, processed}\njoin shipments (this.id == that.invoice_id)\nselect (tuple_uniq take:early {invoices.*, shipments.*})\n" +--- +WITH table_0 AS ( + SELECT + id, + invoice_id, + date_of, + shipped_on + FROM + shipments +) +SELECT + invoices.id, + invoices.date_of, + invoices.processed, + shipments.invoice_id, + shipments.shipped_on +FROM + invoices + INNER JOIN table_0 AS shipments ON invoices.id = shipments.invoice_id diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__7.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__7.snap new file mode 100644 index 000000000000..c5c9423d7685 --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__7.snap @@ -0,0 +1,9 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "from test\nselect (tuple_uniq {x, 5, y})\n" +--- +SELECT + x, + y +FROM + test diff --git a/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__8.snap b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__8.snap new file mode 100644 index 000000000000..8c32de79c1eb --- /dev/null +++ b/web/book/tests/documentation/snapshots/documentation__book__reference__stdlib__tuple__tuple-functions__8.snap @@ -0,0 +1,10 @@ +--- +source: web/book/tests/documentation/book.rs +expression: "from test\nselect (tuple_reverse {x, y, z})\n" +--- +SELECT + z, + y, + x +FROM + test