From 63b00236730f16a2064ca8a7072533033a9198b9 Mon Sep 17 00:00:00 2001 From: Josh Pschorr Date: Wed, 31 Jul 2024 10:31:49 -0700 Subject: [PATCH] Clean-up and some more minor improvements --- partiql-ast/src/pretty.rs | 122 ++++++++++-------- partiql/tests/snapshots/pretty__pretty.snap | 39 ++++-- partiql/tests/snapshots/pretty__pretty2.snap | 14 +- .../snapshots/pretty__pretty_case_1.snap | 15 ++- .../snapshots/pretty__pretty_case_2.snap | 80 +++++++----- .../snapshots/pretty__pretty_case_2.snap.new | 91 ------------- .../snapshots/pretty__pretty_exclude_1.snap | 6 +- .../snapshots/pretty__pretty_exclude_2.snap | 6 +- .../snapshots/pretty__pretty_exclude_3.snap | 12 +- .../snapshots/pretty__pretty_exclude_4.snap | 15 ++- .../snapshots/pretty__pretty_expr_in.snap | 10 +- ...retty__pretty_select_value_tuple_ctor.snap | 19 ++- 12 files changed, 206 insertions(+), 223 deletions(-) delete mode 100644 partiql/tests/snapshots/pretty__pretty_case_2.snap.new diff --git a/partiql-ast/src/pretty.rs b/partiql-ast/src/pretty.rs index 6bfbbc39..9e780c4b 100644 --- a/partiql-ast/src/pretty.rs +++ b/partiql-ast/src/pretty.rs @@ -213,6 +213,16 @@ impl PrettyDoc for Select { D::Doc: Clone, A: Clone, { + fn format<'b, C, D, A>(child: &'b C, arena: &'b D) -> DocBuilder<'b, D, A> + where + D: DocAllocator<'b, A>, + D::Doc: Clone, + A: Clone, + C: PrettyDoc, + { + child.pretty_doc(arena).group() + } + fn delegate<'b, C, D, A>(child: &'b Option, arena: &'b D) -> Option> where D: DocAllocator<'b, A>, @@ -220,7 +230,7 @@ impl PrettyDoc for Select { A: Clone, C: PrettyDoc, { - child.as_ref().map(|inner| inner.pretty_doc(arena).group()) + child.as_ref().map(|inner| format(inner, arena)) } let Select { @@ -232,25 +242,32 @@ impl PrettyDoc for Select { group_by, having, } = self; - let clauses = [ - Some(project.pretty_doc(arena).group()), + let mut clauses = [ + Some(format(project, arena)), delegate(exclude, arena), - from.as_ref().map(|inner| inner.pretty_doc(arena).group()), - from_let - .as_ref() - .map(|inner| inner.pretty_doc(arena).group()), - where_clause - .as_ref() - .map(|inner| inner.pretty_doc(arena).group()), - group_by - .as_ref() - .map(|inner| inner.pretty_doc(arena).group()), - having.as_ref().map(|inner| inner.pretty_doc(arena).group()), + delegate(from, arena), + delegate(from_let, arena), + delegate(where_clause, arena), + delegate(group_by, arena), + delegate(having, arena), ] .into_iter() .flatten(); - arena.intersperse(clauses, arena.softline()).group() + let mut result = arena.nil(); + let separator = arena.line(); + if let Some(first) = clauses.next() { + let mut curr = first; + + for clause in clauses { + result = result.append(curr.append(separator.clone()).group()); + curr = clause; + } + + result = result.append(curr); + } + + result } } @@ -401,6 +418,7 @@ impl PrettyDoc for Expr { unreachable!(); } } + .group() } } @@ -576,8 +594,6 @@ impl PrettyDoc for BinOp { arena.softline() }; let expr = arena.intersperse([lhs, op, rhs], sep).group(); - //let paren_expr = [arena.text("("), expr, arena.text(")")]; - //arena.concat(paren_expr).group() pretty_parenthesized_doc(expr, arena).group() } } @@ -704,24 +720,7 @@ impl PrettyDoc for SimpleCase { } = self; let search = expr.pretty_doc(arena); - - let branches = cases - .iter() - .map(|ExprPair { first, second }| { - let kw_when = arena.text("WHEN"); - let test = first.pretty_doc(arena); - let kw_then = arena.text("THEN"); - let then = second.pretty_doc(arena); - arena - .intersperse([kw_when, test, kw_then, then], arena.space()) - .group() - }) - .chain( - default - .iter() - .map(|d| arena.text("ELSE ").append(d.pretty_doc(arena)).group()), - ); - + let branches = case_branches(arena, cases, default); pretty_seq_doc(branches, "CASE", Some(search), "END", " ", arena) } } @@ -735,27 +734,39 @@ impl PrettyDoc for SearchedCase { { let SearchedCase { cases, default } = self; - let branches = cases - .iter() - .map(|ExprPair { first, second }| { - let kw_when = arena.text("WHEN"); - let test = first.pretty_doc(arena); - let kw_then = arena.text("THEN"); - let then = second.pretty_doc(arena); - arena - .intersperse([kw_when, test, kw_then, then], arena.space()) - .group() - }) - .chain( - default - .iter() - .map(|d| arena.text("ELSE ").append(d.pretty_doc(arena)).group()), - ); - + let branches = case_branches(arena, cases, default); pretty_seq_doc(branches, "CASE", None, "END", " ", arena) } } +fn case_branches<'b, D, A>( + arena: &'b D, + cases: &'b Vec, + default: &'b Option>, +) -> impl Iterator> +where + D: DocAllocator<'b, A>, + D::Doc: Clone, + A: Clone + 'b, +{ + cases + .iter() + .map(|ExprPair { first, second }| { + let kw_when = arena.text("WHEN"); + let test = first.pretty_doc(arena); + let kw_then = arena.text("THEN"); + let then = second.pretty_doc(arena); + arena + .intersperse([kw_when, test, kw_then, then], arena.space()) + .group() + }) + .chain( + default + .iter() + .map(|d| arena.text("ELSE ").append(d.pretty_doc(arena)).group()), + ) +} + impl PrettyDoc for Struct { fn pretty_doc<'b, D, A>(&'b self, arena: &'b D) -> DocBuilder<'b, D, A> where @@ -1280,10 +1291,13 @@ where } else { start }; - let body = arena.line().append(arena.intersperse(seq, sep)).group(); + let body = arena + .line() + .append(arena.intersperse(seq, sep)) + .append(arena.line()) + .group(); start .append(body.nest(MINOR_NEST_INDENT)) - .append(arena.line()) .append(end) .group() } diff --git a/partiql/tests/snapshots/pretty__pretty.snap b/partiql/tests/snapshots/pretty__pretty.snap index 20a40166..d8f729d5 100644 --- a/partiql/tests/snapshots/pretty__pretty.snap +++ b/partiql/tests/snapshots/pretty__pretty.snap @@ -1,5 +1,5 @@ --- -source: partiql-ast/tests/pretty.rs +source: partiql/tests/pretty.rs expression: doc --- ======================================================================================================================================================================================================== @@ -24,7 +24,8 @@ SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << { 'foo': 'baz' }, { 'foo': 'bar' }, { 'foo': 'baz' } - >> GROUP BY foo ORDER BY n DESC + >> +GROUP BY foo ORDER BY n DESC ------------------------------------------------------------------------------------------------------------------------ SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << @@ -35,7 +36,8 @@ SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << { 'foo': 'baz' }, { 'foo': 'bar' }, { 'foo': 'baz' } - >> GROUP BY foo ORDER BY n DESC + >> +GROUP BY foo ORDER BY n DESC -------------------------------------------------------------------------------- SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << @@ -46,7 +48,8 @@ SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, count(1) AS n FROM << { 'foo': 'baz' }, { 'foo': 'bar' }, { 'foo': 'baz' } - >> GROUP BY foo ORDER BY n DESC + >> +GROUP BY foo ORDER BY n DESC ---------------------------------------- SELECT foo, bar, baz, thud.*, @@ -64,12 +67,14 @@ FROM << { 'foo': 'baz' }, { 'foo': 'bar' }, { 'foo': 'baz' } - >> GROUP BY foo ORDER BY n DESC + >> +GROUP BY foo ORDER BY n DESC ------------------------------ SELECT foo, bar, baz, thud.*, grunt.a[*].b[2].*, - count(1) AS n FROM << + count(1) AS n +FROM << { 'foo': 'foo', 'x': 9, @@ -82,8 +87,8 @@ SELECT foo, bar, baz, thud.*, { 'foo': 'baz' }, { 'foo': 'bar' }, { 'foo': 'baz' } - >> GROUP BY foo -ORDER BY n DESC + >> +GROUP BY foo ORDER BY n DESC -------------------- SELECT foo, bar, @@ -97,18 +102,24 @@ FROM << 'y': 5, z: -11 }, - { 'foo': 'bar' + { + 'foo': 'bar' }, - { 'foo': 'qux' + { + 'foo': 'qux' }, - { 'foo': 'bar' + { + 'foo': 'bar' }, - { 'foo': 'baz' + { + 'foo': 'baz' }, - { 'foo': 'bar' + { + 'foo': 'bar' }, { 'foo': 'baz' } - >> GROUP BY foo + >> +GROUP BY foo ORDER BY n DESC ---------- diff --git a/partiql/tests/snapshots/pretty__pretty2.snap b/partiql/tests/snapshots/pretty__pretty2.snap index c8a11e41..c5c97d41 100644 --- a/partiql/tests/snapshots/pretty__pretty2.snap +++ b/partiql/tests/snapshots/pretty__pretty2.snap @@ -16,21 +16,23 @@ ORDER BY n DESC ------------------------------------------------------------------------------------------------------------------------ SELECT foo, bar, baz, thud, grunt, count(1) AS n FROM (SELECT * FROM table1) WHERE ((bar BETWEEN 3 AND 25 AND - NOT (baz LIKE 'example%')) OR (foo.a.b[*] IS MISSING)) GROUP BY foo ORDER BY n DESC + NOT (baz LIKE 'example%')) OR (foo.a.b[*] IS MISSING)) +GROUP BY foo ORDER BY n DESC -------------------------------------------------------------------------------- SELECT foo, bar, baz, thud, grunt, count(1) AS n FROM (SELECT * FROM table1) WHERE ((bar BETWEEN 3 AND 25 AND NOT (baz LIKE 'example%')) OR - (foo.a.b[*] IS MISSING)) GROUP BY foo ORDER BY n DESC + (foo.a.b[*] IS MISSING)) +GROUP BY foo ORDER BY n DESC ---------------------------------------- SELECT foo, bar, baz, thud, grunt, - count(1) AS n FROM (SELECT * - FROM table1) + count(1) AS n +FROM (SELECT * FROM table1) WHERE ((bar BETWEEN 3 AND 25 AND NOT (baz LIKE 'example%')) OR - (foo.a.b[*] IS MISSING)) GROUP BY foo -ORDER BY n DESC + (foo.a.b[*] IS MISSING)) +GROUP BY foo ORDER BY n DESC ------------------------------ SELECT foo, bar, baz, thud, diff --git a/partiql/tests/snapshots/pretty__pretty_case_1.snap b/partiql/tests/snapshots/pretty__pretty_case_1.snap index ad3e99bf..384dd7f8 100644 --- a/partiql/tests/snapshots/pretty__pretty_case_1.snap +++ b/partiql/tests/snapshots/pretty__pretty_case_1.snap @@ -23,7 +23,8 @@ SELECT VALUE CASE WHEN ((x + 1) = f) THEN 'TWO' WHEN (((x + 1) > d) AND ((x + 1) < 100)) THEN '>= THREE < 100' ELSE '?' - END FROM << -1.0000, i, f, d, 100, NULL, MISSING >> AS x + END +FROM << -1.0000, i, f, d, 100, NULL, MISSING >> AS x -------------------------------------------------------------------------------- SELECT VALUE CASE @@ -31,7 +32,8 @@ SELECT VALUE CASE WHEN ((x + 1) = f) THEN 'TWO' WHEN (((x + 1) > d) AND ((x + 1) < 100)) THEN '>= THREE < 100' ELSE '?' - END FROM << -1.0000, i, f, d, 100, NULL, MISSING >> AS x + END +FROM << -1.0000, i, f, d, 100, NULL, MISSING >> AS x ---------------------------------------- SELECT VALUE CASE @@ -40,7 +42,8 @@ SELECT VALUE CASE WHEN (((x + 1) > d) AND ((x + 1) < 100)) THEN '>= THREE < 100' ELSE '?' - END FROM << + END +FROM << -1.0000, i, f, @@ -57,7 +60,8 @@ SELECT VALUE CASE WHEN (((x + 1) > d) AND ((x + 1) < 100)) THEN '>= THREE < 100' ELSE '?' - END FROM << + END +FROM << -1.0000, i, f, @@ -75,7 +79,8 @@ SELECT VALUE CASE AND ((x + 1) < 100)) THEN '>= THREE < 100' ELSE '?' - END FROM << + END +FROM << -1.0000, i, f, diff --git a/partiql/tests/snapshots/pretty__pretty_case_2.snap b/partiql/tests/snapshots/pretty__pretty_case_2.snap index ed115ee4..93585213 100644 --- a/partiql/tests/snapshots/pretty__pretty_case_2.snap +++ b/partiql/tests/snapshots/pretty__pretty_case_2.snap @@ -1,5 +1,5 @@ --- -source: partiql-ast/tests/pretty.rs +source: partiql/tests/pretty.rs expression: doc --- ======================================================================================================================================================================================================== @@ -7,7 +7,7 @@ SELECT VALUE CASE x + 1 WHEN NULL THEN 'shouldnt be null' WHEN MISSING THEN 'sho ======================================================================================================================================================================================================== ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -SELECT VALUE CASE (x + 1) WHEN NULL THEN 'shouldnt be null' WHEN MISSING THEN 'shouldnt be missing' WHEN i THEN 'ONE' WHEN f THEN 'TWO' WHEN d THEN 'THREE' FROM << +SELECT VALUE CASE (x + 1) WHEN NULL THEN 'shouldnt be null' WHEN MISSING THEN 'shouldnt be missing' WHEN i THEN 'ONE' WHEN f THEN 'TWO' WHEN d THEN 'THREE' END FROM << i, f, d, @@ -16,20 +16,44 @@ SELECT VALUE CASE (x + 1) WHEN NULL THEN 'shouldnt be null' WHEN MISSING THEN 's >> AS x ------------------------------------------------------------------------------------------------------------------------ -SELECT VALUE CASE (x + 1) WHEN NULL THEN 'shouldnt be null' WHEN MISSING THEN 'shouldnt be missing' WHEN i THEN 'ONE' - WHEN f THEN 'TWO' WHEN d THEN 'THREE' FROM << i, f, d, NULL, MISSING >> AS x +SELECT VALUE CASE (x + 1) + WHEN NULL THEN 'shouldnt be null' + WHEN MISSING THEN 'shouldnt be missing' + WHEN i THEN 'ONE' + WHEN f THEN 'TWO' + WHEN d THEN 'THREE' + END +FROM << i, f, d, NULL, MISSING >> AS x -------------------------------------------------------------------------------- -SELECT VALUE CASE (x + 1) WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' WHEN i THEN 'ONE' WHEN f THEN 'TWO' - WHEN d THEN 'THREE' FROM << i, f, d, NULL, MISSING >> AS x +SELECT VALUE CASE (x + 1) + WHEN NULL THEN 'shouldnt be null' + WHEN MISSING THEN 'shouldnt be missing' + WHEN i THEN 'ONE' + WHEN f THEN 'TWO' + WHEN d THEN 'THREE' + END +FROM << i, f, d, NULL, MISSING >> AS x ---------------------------------------- SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' WHEN f THEN 'TWO' - WHEN d THEN 'THREE' FROM << + WHEN NULL THEN 'shouldnt be null' + WHEN MISSING THEN 'shouldnt be missing' + WHEN i THEN 'ONE' + WHEN f THEN 'TWO' + WHEN d THEN 'THREE' + END +FROM << i, f, d, NULL, MISSING >> AS x + +------------------------------ +SELECT VALUE CASE (x + 1) + WHEN NULL THEN 'shouldnt be null' + WHEN MISSING THEN 'shouldnt be missing' + WHEN i THEN 'ONE' + WHEN f THEN 'TWO' + WHEN d THEN 'THREE' + END +FROM << i, f, d, @@ -37,24 +61,14 @@ SELECT VALUE CASE (x + 1) MISSING >> AS x ------------------------------- -SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' - WHEN d THEN 'THREE' -FROM << i, f, d, NULL, MISSING - >> AS x - -------------------- -SELECT VALUE CASE - (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' +SELECT VALUE CASE (x + 1) + WHEN NULL THEN 'shouldnt be null' + WHEN MISSING THEN 'shouldnt be missing' + WHEN i THEN 'ONE' + WHEN f THEN 'TWO' WHEN d THEN 'THREE' + END FROM << i, f, @@ -64,13 +78,13 @@ FROM << >> AS x ---------- -SELECT VALUE CASE - (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' +SELECT VALUE CASE (x + 1) + WHEN NULL THEN 'shouldnt be null' + WHEN MISSING THEN 'shouldnt be missing' + WHEN i THEN 'ONE' + WHEN f THEN 'TWO' WHEN d THEN 'THREE' + END FROM << i, f, diff --git a/partiql/tests/snapshots/pretty__pretty_case_2.snap.new b/partiql/tests/snapshots/pretty__pretty_case_2.snap.new deleted file mode 100644 index 4183738c..00000000 --- a/partiql/tests/snapshots/pretty__pretty_case_2.snap.new +++ /dev/null @@ -1,91 +0,0 @@ ---- -source: partiql/tests/pretty.rs -assertion_line: 33 -expression: doc ---- -======================================================================================================================================================================================================== -SELECT VALUE CASE x + 1 WHEN NULL THEN 'shouldnt be null' WHEN MISSING THEN 'shouldnt be missing' WHEN i THEN 'ONE' WHEN f THEN 'TWO' WHEN d THEN 'THREE' END FROM << i, f, d, null, missing >> AS x -======================================================================================================================================================================================================== - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -SELECT VALUE CASE (x + 1) WHEN NULL THEN 'shouldnt be null' WHEN MISSING THEN 'shouldnt be missing' WHEN i THEN 'ONE' WHEN f THEN 'TWO' WHEN d THEN 'THREE' END FROM << - i, - f, - d, - NULL, - MISSING - >> AS x - ------------------------------------------------------------------------------------------------------------------------- -SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' - WHEN d THEN 'THREE' - END FROM << i, f, d, NULL, MISSING >> AS x - --------------------------------------------------------------------------------- -SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' - WHEN d THEN 'THREE' - END FROM << i, f, d, NULL, MISSING >> AS x - ----------------------------------------- -SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' - WHEN d THEN 'THREE' - END FROM << i, f, d, NULL, MISSING - >> AS x - ------------------------------- -SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' - WHEN d THEN 'THREE' - END FROM << - i, - f, - d, - NULL, - MISSING - >> AS x - --------------------- -SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' - WHEN d THEN 'THREE' - END FROM << - i, - f, - d, - NULL, - MISSING - >> AS x - ----------- -SELECT VALUE CASE (x + 1) - WHEN NULL THEN 'shouldnt be null' - WHEN MISSING THEN 'shouldnt be missing' - WHEN i THEN 'ONE' - WHEN f THEN 'TWO' - WHEN d THEN 'THREE' - END -FROM << - i, - f, - d, - NULL, - MISSING - >> AS x diff --git a/partiql/tests/snapshots/pretty__pretty_exclude_1.snap b/partiql/tests/snapshots/pretty__pretty_exclude_1.snap index 561fda27..f34b4e27 100644 --- a/partiql/tests/snapshots/pretty__pretty_exclude_1.snap +++ b/partiql/tests/snapshots/pretty__pretty_exclude_1.snap @@ -18,7 +18,8 @@ expression: doc ======================================================================================================================================================================================================== ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -SELECT * EXCLUDE c.ssn, c.address.street FROM [ { 'name': 'Alan', 'custId': 1, 'address': { 'city': 'Seattle', 'zipcode': 98109, 'street': '123 Seaplane Dr.' }, 'ssn': 123456789 } +SELECT * EXCLUDE c.ssn, c.address.street FROM [ + { 'name': 'Alan', 'custId': 1, 'address': { 'city': 'Seattle', 'zipcode': 98109, 'street': '123 Seaplane Dr.' }, 'ssn': 123456789 } ] AS c ------------------------------------------------------------------------------------------------------------------------ @@ -62,7 +63,8 @@ FROM [ ------------------------------ SELECT * EXCLUDE c.ssn, - c.address.street FROM [ + c.address.street +FROM [ { 'name': 'Alan', 'custId': 1, diff --git a/partiql/tests/snapshots/pretty__pretty_exclude_2.snap b/partiql/tests/snapshots/pretty__pretty_exclude_2.snap index 22641bcc..c7aa78dd 100644 --- a/partiql/tests/snapshots/pretty__pretty_exclude_2.snap +++ b/partiql/tests/snapshots/pretty__pretty_exclude_2.snap @@ -44,7 +44,8 @@ SELECT * EXCLUDE t.a.b.c[0], t.a.b.c[1].field FROM [ ---------------------------------------- SELECT * EXCLUDE t.a.b.c[0], - t.a.b.c[1].field FROM [ + t.a.b.c[1].field +FROM [ { 'a': { 'b': { @@ -61,7 +62,8 @@ SELECT * EXCLUDE t.a.b.c[0], ------------------------------ SELECT * EXCLUDE t.a.b.c[0], - t.a.b.c[1].field FROM [ + t.a.b.c[1].field +FROM [ { 'a': { 'b': { diff --git a/partiql/tests/snapshots/pretty__pretty_exclude_3.snap b/partiql/tests/snapshots/pretty__pretty_exclude_3.snap index c0ff4c88..a2fbe9e8 100644 --- a/partiql/tests/snapshots/pretty__pretty_exclude_3.snap +++ b/partiql/tests/snapshots/pretty__pretty_exclude_3.snap @@ -69,11 +69,17 @@ FROM [ 'a': { 'b': { 'c': [ - { 'field_x': 0, 'field_y': 0 + { + 'field_x': 0, + 'field_y': 0 }, - { 'field_x': 1, 'field_y': 1 + { + 'field_x': 1, + 'field_y': 1 }, - { 'field_x': 2, 'field_y': 2 + { + 'field_x': 2, + 'field_y': 2 } ] } diff --git a/partiql/tests/snapshots/pretty__pretty_exclude_4.snap b/partiql/tests/snapshots/pretty__pretty_exclude_4.snap index 729de7f2..6f895cc6 100644 --- a/partiql/tests/snapshots/pretty__pretty_exclude_4.snap +++ b/partiql/tests/snapshots/pretty__pretty_exclude_4.snap @@ -32,7 +32,8 @@ expression: doc ======================================================================================================================================================================================================== ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -SELECT * EXCLUDE t.a.b.c[*].* FROM [ { 'a': { 'b': { 'c': [ { 'field_x': 0, 'field_y': 0 }, { 'field_x': 1, 'field_y': 1 }, { 'field_x': 2, 'field_y': 2 } ] } }, 'foo': 'bar' } +SELECT * EXCLUDE t.a.b.c[*].* FROM [ + { 'a': { 'b': { 'c': [ { 'field_x': 0, 'field_y': 0 }, { 'field_x': 1, 'field_y': 1 }, { 'field_x': 2, 'field_y': 2 } ] } }, 'foo': 'bar' } ] AS t ------------------------------------------------------------------------------------------------------------------------ @@ -67,11 +68,17 @@ SELECT * EXCLUDE t.a.b.c[*].* FROM [ 'a': { 'b': { 'c': [ - { 'field_x': 0, 'field_y': 0 + { + 'field_x': 0, + 'field_y': 0 }, - { 'field_x': 1, 'field_y': 1 + { + 'field_x': 1, + 'field_y': 1 }, - { 'field_x': 2, 'field_y': 2 + { + 'field_x': 2, + 'field_y': 2 } ] } diff --git a/partiql/tests/snapshots/pretty__pretty_expr_in.snap b/partiql/tests/snapshots/pretty__pretty_expr_in.snap index cb931e4f..51d10a09 100644 --- a/partiql/tests/snapshots/pretty__pretty_expr_in.snap +++ b/partiql/tests/snapshots/pretty__pretty_expr_in.snap @@ -1,5 +1,5 @@ --- -source: partiql-ast/tests/pretty.rs +source: partiql/tests/pretty.rs expression: doc --- ======================================================================================================================================================================================================== @@ -31,9 +31,13 @@ expression: doc ] ---------- -[ a, b +[ + a, + b ] IN [ - [ 1, 2 + [ + 1, + 2 ], [ 3, 4 ] ] diff --git a/partiql/tests/snapshots/pretty__pretty_select_value_tuple_ctor.snap b/partiql/tests/snapshots/pretty__pretty_select_value_tuple_ctor.snap index 3a00243a..cbcce367 100644 --- a/partiql/tests/snapshots/pretty__pretty_select_value_tuple_ctor.snap +++ b/partiql/tests/snapshots/pretty__pretty_select_value_tuple_ctor.snap @@ -1,5 +1,5 @@ --- -source: partiql-ast/tests/pretty.rs +source: partiql/tests/pretty.rs expression: doc --- ======================================================================================================================================================================================================== @@ -29,7 +29,8 @@ FROM [ SELECT VALUE { 'a': v.a, 'b': v.b - } FROM [ + } +FROM [ { 'a': 1, 'b': 1 }, { 'a': 2, 'b': 2 } ] AS v @@ -38,10 +39,15 @@ SELECT VALUE { SELECT VALUE { 'a': v.a, 'b': v.b - } FROM [ - { 'a': 1, 'b': 1 + } +FROM [ + { + 'a': 1, + 'b': 1 }, - { 'a': 2, 'b': 2 + { + 'a': 2, + 'b': 2 } ] AS v @@ -49,7 +55,8 @@ SELECT VALUE { SELECT VALUE { 'a': v.a, 'b': v.b - } FROM [ + } +FROM [ { 'a': 1, 'b': 1