Skip to content

Commit

Permalink
adds optional over clause to aggregate functions in sqlparser (#13444)
Browse files Browse the repository at this point in the history
Signed-off-by: Corey Winkelmann <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Co-authored-by: Manan Gupta <[email protected]>
  • Loading branch information
CoreyWinkelmannPP and GuptaManan100 authored Mar 6, 2024
1 parent a65b90d commit a19b90b
Show file tree
Hide file tree
Showing 15 changed files with 8,643 additions and 8,150 deletions.
56 changes: 36 additions & 20 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -2882,8 +2882,9 @@ type (
}

Count struct {
Args Exprs
Distinct bool
Args Exprs
Distinct bool
OverClause *OverClause
}

CountStar struct {
Expand Down Expand Up @@ -2914,66 +2915,81 @@ type (
// The solution we employed was to add a dummy field `_ bool` to the otherwise empty struct `CountStar`.
// This ensures that each instance of `CountStar` is treated as a separate object,
// even in the context of out semantic state which uses these objects as map keys.
OverClause *OverClause
}

Avg struct {
Arg Expr
Distinct bool
Arg Expr
Distinct bool
OverClause *OverClause
}

Max struct {
Arg Expr
Distinct bool
Arg Expr
Distinct bool
OverClause *OverClause
}

Min struct {
Arg Expr
Distinct bool
Arg Expr
Distinct bool
OverClause *OverClause
}

Sum struct {
Arg Expr
Distinct bool
Arg Expr
Distinct bool
OverClause *OverClause
}

BitAnd struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

BitOr struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

BitXor struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

Std struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

StdDev struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

StdPop struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

StdSamp struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

VarPop struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

VarSamp struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

Variance struct {
Arg Expr
Arg Expr
OverClause *OverClause
}

// GroupConcatExpr represents a call to GROUP_CONCAT
Expand Down
16 changes: 16 additions & 0 deletions go/vt/sqlparser/ast_clone.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a19b90b

Please sign in to comment.