github.com/dolthub/go-mysql-server@v0.18.0/sql/analyzer/warnings.go (about) 1 // Copyright 2020-2021 Dolthub, Inc. 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 analyzer 16 17 import ( 18 "github.com/dolthub/go-mysql-server/sql" 19 "github.com/dolthub/go-mysql-server/sql/plan" 20 "github.com/dolthub/go-mysql-server/sql/transform" 21 ) 22 23 func clearWarnings(ctx *sql.Context, a *Analyzer, node sql.Node, scope *plan.Scope, sel RuleSelector) (sql.Node, transform.TreeIdentity, error) { 24 children := node.Children() 25 if len(children) == 0 { 26 return node, transform.SameTree, nil 27 } 28 29 switch ch := children[0].(type) { 30 case plan.ShowWarnings: 31 return node, transform.SameTree, nil 32 case *plan.Offset: 33 clearWarnings(ctx, a, ch, scope, sel) 34 return node, transform.SameTree, nil 35 case *plan.Limit: 36 clearWarnings(ctx, a, ch, scope, sel) 37 return node, transform.SameTree, nil 38 } 39 40 ctx.ClearWarnings() 41 return node, transform.SameTree, nil 42 }