Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51d4c3c

Browse files
committed
Fix CTE handling in dependency planner and CAST type in test queries
- Add CTE check in dependencyplanner.go to skip provider resolution for CTE table references (similar to existing view/subquery handling)- Change CAST type from 'INTEGER' to 'unsigned' in test queries to match StackQL parser requirements
1 parent6b03be8 commit51d4c3c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎internal/stackql/dependencyplanner/dependencyplanner.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ func (dp *standardDependencyPlanner) Plan() error {
164164
annotation:=unit.GetAnnotation()
165165
_,isView:=annotation.GetView()
166166
_,isSubquery:=annotation.GetSubquery()
167-
ifisView||isSubquery {
167+
// Check if this is a CTE reference.
168+
indirect,hasIndirect:=annotation.GetTableMeta().GetIndirect()
169+
isCTE:=hasIndirect&&indirect!=nil&&indirect.GetType()==astindirect.CTEType
170+
ifisView||isSubquery||isCTE {
168171
dp.annMap[tableExpr]=annotation
169172
continue
170173
}

‎internal/test/testobjects/input.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ const (
5959
// Window function test queries.
6060
SelectGoogleComputeDisksWindowRowNumberstring=`select name, sizeGb, ROW_NUMBER() OVER (ORDER BY name) as row_num from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
6161
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-
SelectGoogleComputeDisksWindowSumstring=`select name, sizeGb, SUM(cast(sizeGb asINTEGER)) OVER (ORDER BY name) as running_total from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
62+
SelectGoogleComputeDisksWindowSumstring=`select name, sizeGb, SUM(cast(sizeGb asunsigned)) OVER (ORDER BY name) as running_total from google.compute.disks where zone = 'australia-southeast1-b' AND project = 'testing-project' ORDER BY name;`
6363

6464
// CTE test queries.
6565
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;`
6666
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;`
67-
SelectGoogleComputeDisksCTEMultiplestring=`WITH small_disks AS (SELECT name, sizeGb FROM google.compute.disks WHERE zone = 'australia-southeast1-b' AND project = 'testing-project' AND cast(sizeGb asINTEGER) <= 10), large_disks AS (SELECT name, sizeGb FROM google.compute.disks WHERE zone = 'australia-southeast1-b' AND project = 'testing-project' AND cast(sizeGb asINTEGER) > 10) SELECT 'small' as category, COUNT(*) as cnt FROM small_disks UNION ALL SELECT 'large' as category, COUNT(*) as cnt FROM large_disks;`
67+
SelectGoogleComputeDisksCTEMultiplestring=`WITH small_disks AS (SELECT name, sizeGb FROM google.compute.disks WHERE zone = 'australia-southeast1-b' AND project = 'testing-project' AND cast(sizeGb asunsigned) <= 10), large_disks AS (SELECT name, sizeGb FROM google.compute.disks WHERE zone = 'australia-southeast1-b' AND project = 'testing-project' AND cast(sizeGb asunsigned) > 10) SELECT 'small' as category, COUNT(*) as cnt FROM small_disks UNION ALL SELECT 'large' as category, COUNT(*) as cnt FROM large_disks;`
6868
)
6969

7070
funcGetGoogleProviderString()string {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp