Skip to content

Commit a3d8719

Browse files
committed
Add additional female_count filter for IDs greater than 10 in SQL queries
1 parent 554ab4e commit a3d8719

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

src/test/testData/sql/formatter/OrderByGroup.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ORDER BY e.id ASC, e.manager_id ASC, created_at DESC)
1515
, LAST_VALUE() OVER(ORDER BY e.manager_id ASC
1616
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS bottom_salary
1717
, COUNT(*) FILTER(WHERE gender = 'F') AS female_count
18+
, COUNT(*) FILTER(WHERE gender = 'F' AND id > 10) AS female_count
1819
, LISTAGG(e.name
1920
, ', ') WITHIN GROUP(ORDER BY name DESC)
2021
FROM employees e

src/test/testData/sql/formatter/OrderByGroupWithConditionDirective.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING/*%end */) AS dense_rank
1212
, SUM(amount)/*%if filter */ FILTER(WHERE status = 'active')/*%end*/ AS dept_salary_avg
1313
, COUNT(*) OVER(ORDER BY e.id, e.manager_id, created_at
1414
/*%if rows */
15-
ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING/*%end*/)
15+
ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING/*%end*/
16+
, COUNT(*) FILTER(WHERE gender = 'F'
17+
AND id > 10) AS female_count
1618
, FIRST_VALUE(salary) IGNORE NULLS OVER(PARTITION BY department_id
1719
ORDER BY e.id ASC, e.manager_id ASC, created_at DESC)
1820
, LAST_VALUE() OVER(ORDER BY e.manager_id ASC

src/test/testData/sql/formatter/OrderByGroupWithConditionDirective_format.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ SELECT e.id
2525
/*%if rows */
2626
ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
2727
/*%end*/)
28+
, COUNT(*) FILTER(WHERE gender = 'F'
29+
AND id > 10) AS female_count
2830
, FIRST_VALUE(salary) IGNORE NULLS OVER(PARTITION BY department_id
2931
ORDER BY e.id ASC, e.manager_id ASC, created_at DESC)
3032
, LAST_VALUE() OVER(ORDER BY e.manager_id ASC

src/test/testData/sql/formatter/OrderByGroup_format.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ SELECT e.id
1515
, LAST_VALUE() OVER(ORDER BY e.manager_id ASC
1616
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS bottom_salary
1717
, COUNT(*) FILTER(WHERE gender = 'F') AS female_count
18+
, COUNT(*) FILTER(WHERE gender = 'F' AND id > 10) AS female_count
1819
, LISTAGG(e.name
1920
, ', ') WITHIN GROUP (ORDER BY name DESC)
2021
FROM employees e

0 commit comments

Comments
 (0)