github.com/matrixorigin/matrixone@v1.2.0/pkg/sql/parsers/tree/analyze.go (about)

     1  // Copyright 2021 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 tree
    16  
    17  import "github.com/matrixorigin/matrixone/pkg/common/reuse"
    18  
    19  func init() {
    20  	reuse.CreatePool[AnalyzeStmt](
    21  		func() *AnalyzeStmt { return &AnalyzeStmt{} },
    22  		func(a *AnalyzeStmt) { a.reset() },
    23  		reuse.DefaultOptions[AnalyzeStmt](), //.
    24  	) //WithEnableChecker()
    25  }
    26  
    27  // Use statement
    28  type AnalyzeStmt struct {
    29  	statementImpl
    30  	Table *TableName
    31  	Cols  IdentifierList
    32  }
    33  
    34  func (node *AnalyzeStmt) Format(ctx *FmtCtx) {
    35  	ctx.WriteString("analyze table ")
    36  	node.Table.Format(ctx)
    37  	ctx.WriteString("(")
    38  	node.Cols.Format(ctx)
    39  	ctx.WriteString(")")
    40  }
    41  
    42  func (node *AnalyzeStmt) GetStatementType() string { return "Analyze Table" }
    43  func (node *AnalyzeStmt) GetQueryType() string     { return QueryTypeOth }
    44  
    45  func (node *AnalyzeStmt) Free() {
    46  	reuse.Free[AnalyzeStmt](node, nil)
    47  }
    48  
    49  func (node AnalyzeStmt) TypeName() string { return "tree.AnalyzeStmt" }
    50  
    51  func (node *AnalyzeStmt) reset() {
    52  	// if node.Table != nil {
    53  	// node.Table.Free()
    54  	// }
    55  	*node = AnalyzeStmt{}
    56  }
    57  
    58  func NewAnalyzeStmt(tbl *TableName, cols IdentifierList) *AnalyzeStmt {
    59  	analyzestmt := reuse.Alloc[AnalyzeStmt](nil)
    60  	analyzestmt.Table = tbl
    61  	analyzestmt.Cols = cols
    62  	return analyzestmt
    63  }