You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add additional window function tests for better coverage
Add 4 new test cases covering different window function scenarios:
- DENSE_RANK() for dense ranking functionality
- Multiple window functions in single query (ROW_NUMBER, RANK, COUNT)
- COUNT(*) and AVG() OVER () for aggregate window functions
- CTE combined with window functions
These tests complement the existing window function tests and ensure
comprehensive coverage of window function behavior.
Copy file name to clipboardExpand all lines: internal/test/testobjects/input.go
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,14 @@ const (
61
61
SelectGoogleComputeDisksWindowRankstring=`select name, sizeGb, RANK() OVER (ORDER BY sizeGb) as size_rank from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
62
62
SelectGoogleComputeDisksWindowSumstring=`select name, sizeGb, SUM(cast(sizeGb as unsigned)) OVER (ORDER BY name) as running_total from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
63
63
64
+
// Additional window function test queries.
65
+
SelectGoogleComputeDisksWindowDenseRankstring=`select name, sizeGb, DENSE_RANK() OVER (ORDER BY sizeGb) as dense_rank from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
66
+
SelectGoogleComputeDisksWindowMultiplestring=`select name, sizeGb, ROW_NUMBER() OVER (ORDER BY name) as row_num, RANK() OVER (ORDER BY sizeGb DESC) as size_rank, COUNT(*) OVER () as total_count from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
67
+
SelectGoogleComputeDisksWindowCountstring=`select name, sizeGb, COUNT(*) OVER () as total, AVG(cast(sizeGb as unsigned)) OVER () as avg_size from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
68
+
69
+
// CTE with window function test query.
70
+
SelectGoogleComputeDisksCTEWithWindowstring=`WITH disk_cte AS (SELECT name, sizeGb FROM google.compute.disks WHERE zone = 'australia-southeast1-b' AND project = 'testing-project') SELECT name, sizeGb, ROW_NUMBER() OVER (ORDER BY name) as row_num FROM disk_cte ORDER BY name;`
71
+
64
72
// CTE test queries.
65
73
SelectGoogleComputeDisksCTESimplestring=`WITH disk_cte AS (SELECT name, sizeGb FROM google.compute.disks WHERE zone = 'australia-southeast1-b' AND project = 'testing-project') SELECT name, sizeGb FROM disk_cte ORDER BY name;`
66
74
SelectGoogleComputeDisksCTEWithAggstring=`WITH disk_cte AS (SELECT name, sizeGb FROM google.compute.disks WHERE zone = 'australia-southeast1-b' AND project = 'testing-project') SELECT COUNT(*) as disk_count FROM disk_cte;`
0 commit comments