github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/plan/table_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 NewTableBinder(builder *QueryBuilder, ctx *BindContext) *TableBinder { 24 b := &TableBinder{} 25 b.sysCtx = builder.GetContext() 26 b.builder = builder 27 b.ctx = ctx 28 b.impl = b 29 30 return b 31 } 32 33 func (b *TableBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error) { 34 return b.baseBindExpr(astExpr, depth, isRoot) 35 } 36 37 func (b *TableBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error) { 38 return b.baseBindColRef(astExpr, depth, isRoot) 39 } 40 41 func (b *TableBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error) { 42 return nil, moerr.NewSyntaxError(b.GetContext(), "aggregate function %s not allowed", funcName) 43 } 44 45 func (b *TableBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error) { 46 return nil, moerr.NewSyntaxError(b.GetContext(), "window function %s not allowed", funcName) 47 } 48 49 func (b *TableBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error) { 50 return nil, moerr.NewNYI(b.GetContext(), "subquery in JOIN condition") 51 } 52 53 func (b *TableBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error) { 54 return nil, moerr.NewInvalidInput(b.GetContext(), "cannot bind time window functions '%s'", funcName) 55 }