github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/rule_name.go (about) 1 // Copyright 2018 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package opt 12 13 // RuleName enumerates the names of all the optimizer rules. Manual rule names 14 // are defined in this file and rule names generated by Optgen are defined in 15 // rule_name.og.go. 16 type RuleName uint32 17 18 // Enumeration of all manual rule names. 19 const ( 20 InvalidRuleName RuleName = iota 21 22 // ------------------------------------------------------------ 23 // Manual Rule Names 24 // ------------------------------------------------------------ 25 26 SimplifyRootOrdering 27 PruneRootCols 28 SimplifyZeroCardinalityGroup 29 30 // NumManualRules tracks the number of manually-defined rules. 31 NumManualRuleNames 32 ) 33 34 // IsNormalize returns true if r is a normalization rule. 35 func (r RuleName) IsNormalize() bool { 36 return r < startExploreRule 37 } 38 39 // IsExplore returns true if r is an exploration rule. 40 func (r RuleName) IsExplore() bool { 41 return r > startExploreRule 42 } 43 44 // Make linter happy. 45 var _ = InvalidRuleName 46 var _ = NumManualRuleNames 47 var _ = RuleName.IsNormalize 48 var _ = RuleName.IsExplore