Skip to content

Commit 85abf36

Browse files
committed
Some missing docs and simplifications
1 parent 5bfa72a commit 85abf36

File tree

3 files changed

+8
-29
lines changed

3 files changed

+8
-29
lines changed

server/functions/framework/catalog.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ func RegisterAggregateFunction(f AggregateFunctionInterface) {
7575
case Func1Aggregate:
7676
name := strings.ToLower(f.Name)
7777
AggregateCatalog[name] = append(AggregateCatalog[name], f)
78-
case Func2Aggregate:
79-
name := strings.ToLower(f.Name)
80-
AggregateCatalog[name] = append(AggregateCatalog[name], f)
81-
case Func3Aggregate:
82-
name := strings.ToLower(f.Name)
83-
AggregateCatalog[name] = append(AggregateCatalog[name], f)
8478
default:
8579
panic(fmt.Sprintf("unhandled function type %T", f))
8680
}

server/functions/framework/compiled_aggregate_function.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func NewCompiledAggregateFunction(name string, args []sql.Expression, functions
4444
return newCompiledAggregateFunctionInternal(name, args, functions, functions.overloadsForParams(len(args)), newBuffer)
4545
}
4646

47-
// newCompiledFunctionInternal is called internally, which skips steps that may have already been processed.
47+
// newCompiledAggregateFunctionInternal is called internally, which skips steps that may have already been processed.
4848
func newCompiledAggregateFunctionInternal(name string, args []sql.Expression, overloads *Overloads, fnOverloads []Overload, newBuffer func() (sql.AggregationBuffer, error)) *CompiledAggregateFunction {
4949
cf := newCompiledFunctionInternal(name, args, overloads, fnOverloads, false, nil)
5050
c := &CompiledAggregateFunction{
@@ -97,28 +97,35 @@ func (c *CompiledAggregateFunction) DebugString() string {
9797
sb.WriteString(")")
9898
return sb.String()
9999
}
100+
101+
// NewBuffer implements the interface sql.Aggregation.
100102
func (c *CompiledAggregateFunction) NewBuffer() (sql.AggregationBuffer, error) {
101103
return c.newBuffer()
102104
}
103105

106+
// Id implements the interface sql.Aggregation.
104107
func (c *CompiledAggregateFunction) Id() sql.ColumnId {
105108
return c.aggId
106109
}
107110

111+
// WithId implements the interface sql.Aggregation.
108112
func (c *CompiledAggregateFunction) WithId(id sql.ColumnId) sql.IdExpression {
109113
nc := *c
110114
nc.aggId = id
111115
return &nc
112116
}
113117

118+
// NewWindowFunction implements the interface sql.WindowAdaptableExpression.
114119
func (c *CompiledAggregateFunction) NewWindowFunction() (sql.WindowFunction, error) {
115120
panic("windows are not implemented yet")
116121
}
117122

123+
// WithWindow implements the interface sql.WindowAdaptableExpression.
118124
func (c *CompiledAggregateFunction) WithWindow(window *sql.WindowDefinition) sql.WindowAdaptableExpression {
119125
panic("windows are not implemented yet")
120126
}
121127

128+
// Window implements the interface sql.WindowAdaptableExpression.
122129
func (c *CompiledAggregateFunction) Window() *sql.WindowDefinition {
123130
panic("windows are not implemented yet")
124131
}

server/functions/framework/functions.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -298,26 +298,4 @@ func (f Func1Aggregate) NewBuffer() (sql.AggregationBuffer, error) {
298298
return f.NewAggBuffer()
299299
}
300300

301-
// Func2Aggregate is a function that takes one parameter and is an aggregate function.
302-
type Func2Aggregate struct {
303-
Function2
304-
NewAggBuffer func() (sql.AggregationBuffer, error)
305-
}
306-
307-
func (f Func2Aggregate) NewBuffer() (sql.AggregationBuffer, error) {
308-
return f.NewAggBuffer()
309-
}
310-
311-
// Func3Aggregate is a function that takes one parameter and is an aggregate function.
312-
type Func3Aggregate struct {
313-
Function3
314-
NewAggBuffer func() (sql.AggregationBuffer, error)
315-
}
316-
317-
func (f Func3Aggregate) NewBuffer() (sql.AggregationBuffer, error) {
318-
return f.NewAggBuffer()
319-
}
320-
321301
var _ AggregateFunctionInterface = Func1Aggregate{}
322-
var _ AggregateFunctionInterface = Func2Aggregate{}
323-
var _ AggregateFunctionInterface = Func3Aggregate{}

0 commit comments

Comments
 (0)