Documentation
¶
Index ¶
- func BindHint(stmt ast.StmtNode, hintsSet *HintsSet) ast.StmtNode
- func ExtractTableHintsFromStmtNode(node ast.Node) []*ast.TableOptimizerHint
- func GenerateQBName(nodeType NodeType, blockOffset int) model.CIStr
- func RestoreIndexHint(hint *ast.IndexHint) (string, error)
- func RestoreOptimizerHints(hints []*ast.TableOptimizerHint) string
- func RestoreTableOptimizerHint(hint *ast.TableOptimizerHint) string
- type BlockHintProcessor
- func (p *BlockHintProcessor) Enter(in ast.Node) (ast.Node, bool)
- func (p *BlockHintProcessor) GetCurrentStmtHints(hints []*ast.TableOptimizerHint, nodeType NodeType, currentOffset int) []*ast.TableOptimizerHint
- func (p *BlockHintProcessor) GetHintOffset(qbName model.CIStr, nodeType NodeType, currentOffset int) int
- func (p *BlockHintProcessor) Leave(in ast.Node) (ast.Node, bool)
- func (p *BlockHintProcessor) MaxSelectStmtOffset() int
- type HintsSet
- type NodeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTableHintsFromStmtNode ¶
func ExtractTableHintsFromStmtNode(node ast.Node) []*ast.TableOptimizerHint
ExtractTableHintsFromStmtNode extracts table hints from this node.
func GenerateQBName ¶
GenerateQBName builds QBName from offset.
func RestoreIndexHint ¶
RestoreIndexHint returns string format of IndexHint.
func RestoreOptimizerHints ¶
func RestoreOptimizerHints(hints []*ast.TableOptimizerHint) string
RestoreOptimizerHints restores these hints.
func RestoreTableOptimizerHint ¶
func RestoreTableOptimizerHint(hint *ast.TableOptimizerHint) string
RestoreTableOptimizerHint returns string format of TableOptimizerHint.
Types ¶
type BlockHintProcessor ¶
type BlockHintProcessor struct { QbNameMap map[string]int // Map from query block name to select stmt offset. QbHints map[int][]*ast.TableOptimizerHint // Group all hints at same query block. Ctx sessionctx.Context // contains filtered or unexported fields }
BlockHintProcessor processes hints at different level of sql statement.
func (*BlockHintProcessor) GetCurrentStmtHints ¶
func (p *BlockHintProcessor) GetCurrentStmtHints(hints []*ast.TableOptimizerHint, nodeType NodeType, currentOffset int) []*ast.TableOptimizerHint
GetCurrentStmtHints extracts all hints that take effects at current stmt.
func (*BlockHintProcessor) GetHintOffset ¶
func (p *BlockHintProcessor) GetHintOffset(qbName model.CIStr, nodeType NodeType, currentOffset int) int
GetHintOffset gets the offset of stmt that the hints take effects.
func (*BlockHintProcessor) MaxSelectStmtOffset ¶
func (p *BlockHintProcessor) MaxSelectStmtOffset() int
MaxSelectStmtOffset returns the current stmt offset.
type HintsSet ¶
type HintsSet struct {
// contains filtered or unexported fields
}
HintsSet contains all hints of a query.
func CollectHint ¶
CollectHint collects hints for a statement.
func ParseHintsSet ¶
func ParseHintsSet(p *parser.Parser, sql, charset, collation, db string) (*HintsSet, []error, error)
ParseHintsSet parses a SQL string, then collects and normalizes the HintsSet.
func (*HintsSet) ContainTableHint ¶
ContainTableHint checks whether the table hint set contains a hint.
func (*HintsSet) GetFirstTableHints ¶
func (hs *HintsSet) GetFirstTableHints() []*ast.TableOptimizerHint
GetFirstTableHints gets the first table hints.