Skip to content

Commit

Permalink
fix: generalize col names1
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilender-bongirwar committed Oct 20, 2024
1 parent e0ee44c commit e8dd3ea
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions crates/proof-of-sql/src/sql/parse/query_expr_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,15 +1109,15 @@ fn we_can_group_by_without_using_aggregate_functions() {
#[test]
fn group_by_expressions_are_parsed_before_an_order_by_referencing_an_aggregate_alias_result() {
let query_text =
"select max(i) max_sal, i0 d, count(i0) from sxt.t group by i0, i1 order by max_sal";
"select max(salary) max_sal, department_budget d, count(department_budget) from sxt.employees group by department_budget, project_budget order by max_sal";

let t = "sxt.t".parse().unwrap();
let t = "sxt.employees".parse().unwrap();
let accessor = schema_accessor_from_table_ref_with_schema(
t,
indexmap! {
"i".parse().unwrap() => ColumnType::BigInt,
"i0".parse().unwrap() => ColumnType::BigInt,
"i1".parse().unwrap() => ColumnType::BigInt,
"salary".parse().unwrap() => ColumnType::BigInt,
"department_budget".parse().unwrap() => ColumnType::BigInt,
"project_budget".parse().unwrap() => ColumnType::BigInt,
},
);

Expand All @@ -1128,20 +1128,20 @@ fn group_by_expressions_are_parsed_before_an_order_by_referencing_an_aggregate_a
let expected_query = QueryExpr::new(
filter(
vec![
col_expr_plan(t, "i", &accessor),
col_expr_plan(t, "i0", &accessor),
col_expr_plan(t, "i1", &accessor),
col_expr_plan(t, "salary", &accessor),
col_expr_plan(t, "department_budget", &accessor),
col_expr_plan(t, "project_budget", &accessor),
],
tab(t),
const_bool(true),
),
vec![
group_by_postprocessing(
&["i0", "i1"],
&["department_budget", "project_budget"],
&[
aliased_expr(max(col("i")), "max_sal"),
aliased_expr(col("i0"), "d"),
aliased_expr(count(col("i0")), "__count__"),
aliased_expr(max(col("salary")), "max_sal"),
aliased_expr(col("department_budget"), "d"),
aliased_expr(count(col("department_budget")), "__count__"),
],
),
orders(&["max_sal"], &[Asc]),
Expand Down

0 comments on commit e8dd3ea

Please sign in to comment.