github.com/matrixorigin/matrixone@v0.7.0/pkg/sql/plan/partition_binder.go (about) 1 // Copyright 2022 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package plan 16 17 import ( 18 "github.com/matrixorigin/matrixone/pkg/common/moerr" 19 "github.com/matrixorigin/matrixone/pkg/pb/plan" 20 "github.com/matrixorigin/matrixone/pkg/sql/parsers/tree" 21 ) 22 23 func NewPartitionBinder(builder *QueryBuilder, ctx *BindContext) *PartitionBinder { 24 p := &PartitionBinder{} 25 p.sysCtx = builder.GetContext() 26 p.builder = builder 27 p.ctx = ctx 28 p.impl = p 29 return p 30 } 31 32 func (p *PartitionBinder) BindExpr(expr tree.Expr, i int32, b bool) (*plan.Expr, error) { 33 return p.baseBindExpr(expr, i, b) 34 } 35 36 func (p *PartitionBinder) BindColRef(name *tree.UnresolvedName, i int32, b bool) (*plan.Expr, error) { 37 return p.baseBindColRef(name, i, b) 38 } 39 40 func (p *PartitionBinder) BindAggFunc(s string, expr *tree.FuncExpr, i int32, b bool) (*plan.Expr, error) { 41 return nil, moerr.NewSyntaxError(p.GetContext(), "aggregate functions not allowed in partition clause") 42 } 43 44 func (p *PartitionBinder) BindWinFunc(s string, expr *tree.FuncExpr, i int32, b bool) (*plan.Expr, error) { 45 return nil, moerr.NewSyntaxError(p.GetContext(), "window functions not allowed in partition clause") 46 } 47 48 func (p *PartitionBinder) BindSubquery(subquery *tree.Subquery, b bool) (*plan.Expr, error) { 49 return nil, moerr.NewSyntaxError(p.GetContext(), "subquery not allowed in partition clause") 50 }