Skip to content

Commit

Permalink
fix(cubesql): Rollup don't work over subquery with asterisk projection (
Browse files Browse the repository at this point in the history
  • Loading branch information
waralexrom authored Jun 13, 2024
1 parent 90a6050 commit 0bc0306
Show file tree
Hide file tree
Showing 9 changed files with 1,331 additions and 8 deletions.
4 changes: 3 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/athena.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
"SQL API: Nested Rollup",
"SQL API: Rollup with aliases",
"SQL API: Rollup over exprs",
"SQL API: Nested Rollup with aliases"
"SQL API: Nested Rollup with aliases",
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk"
]
}
4 changes: 3 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/bigquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@
"---------------------------------------",
"SQL API: reuse params",
"SQL API: Complex Rollup",
"SQL API: Rollup with aliases"
"SQL API: Rollup with aliases",
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@
"SKIPPED SQL API (Need work)",
"---------------------------------------",
"SQL API: Nested Rollup",
"SQL API: Nested Rollup with aliases"
"SQL API: Nested Rollup with aliases",
"SQL API: Nested Rollup over asteriks",
"SQL API: Extended nested Rollup over asterisk"
]
}
4 changes: 3 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/mssql.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
"SQL API: Nested Rollup",
"SQL API: Rollup with aliases",
"SQL API: Rollup over exprs",
"SQL API: Nested Rollup with aliases"
"SQL API: Nested Rollup with aliases",
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk"
]
}
4 changes: 3 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/mysql.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
"SQL API: Nested Rollup",
"SQL API: Rollup with aliases",
"SQL API: Rollup over exprs",
"SQL API: Nested Rollup with aliases"
"SQL API: Nested Rollup with aliases",
"SQL API: Nested Rollup over asterisk",
"SQL API: Extended nested Rollup over asterisk"
]
}
34 changes: 34 additions & 0 deletions packages/cubejs-testing-drivers/src/tests/testQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1771,5 +1771,39 @@ from
`);
expect(res.rows).toMatchSnapshot('nested_rollup_with_aliases');
});
executePg('SQL API: Nested Rollup over asterisk', async (connection) => {
const res = await connection.query(`
select rowId as "row", orderId as "order", orderDate as "date", sum(count)
from (
select *
from
"ECommerce" as "ECommerce"
) a
group by
ROLLUP(1, 2, 3)
order by 1, 2, 3
`);
expect(res.rows).toMatchSnapshot('nested_rollup_over_asterisk');
});
executePg('SQL API: Extended nested Rollup over asterisk', async (connection) => {
const res = await connection.query(`
select * from (
select * from (
select rowId as "row", orderId as "order", sum(count)
from (
select *
from
"ECommerce" as "ECommerce"
) a
group by
ROLLUP(row, order)
ORDER BY "rowId" ASC NULLS FIRST, "orderId" ASC NULLS FIRST OFFSET 0 ROWS FETCH FIRST 100 ROWS ONLY
) q1
) q2 limit 100
`);
expect(res.rows).toMatchSnapshot('extended_nested_rollup_over_asterisk');
});
});
}
Loading

0 comments on commit 0bc0306

Please sign in to comment.