Skip to content

Commit 196efb0

Browse files
authored
Merge pull request #116 from stackql/claude/fix-cte-window-functions-01WbDt4A6kMPzL5KJmLWAHBU
fix: mark window functions as aggregate expressions for CTE compatibi…
2 parents a6bcfc3 + 2a03b97 commit 196efb0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/stackql/parserutil/parser_util.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,11 @@ func inferColNameFromExpr(
638638
retVal.IsAggregateExpr = true
639639
retVal.Type = aggCol.getReturnType()
640640
}
641+
// Window functions (with OVER clause) are computed expressions
642+
// that don't need to be resolved from underlying tables/CTEs
643+
if expr.Over != nil {
644+
retVal.IsAggregateExpr = true
645+
}
641646
if len(funcNameLowered) >= 4 && funcNameLowered[0:4] == "json" {
642647
decoratedColumn := strings.ReplaceAll(retVal.Name, `\"`, `"`)
643648
retVal.DecoratedColumn = getDecoratedColRendition(decoratedColumn, alias)

0 commit comments

Comments
 (0)