@@ -16,7 +16,6 @@ import (
1616 "github.com/antlr4-go/antlr/v4"
1717 "github.com/oceanbase/ob-operator/internal/sql-analyzer/api/model"
1818 obmysql "github.com/oceanbase/ob-operator/internal/sql-analyzer/parser/mysql"
19- logger "github.com/sirupsen/logrus"
2019)
2120
2221// SelectAllRule checks for the usage of SELECT *
@@ -47,7 +46,6 @@ func (r *SelectAllRule) Description() string {
4746func (r * SelectAllRule ) Analyze (tree antlr.ParseTree , indexes []model.IndexInfo ) []model.SqlDiagnoseInfo {
4847 r .diagnoseResults = []model.SqlDiagnoseInfo {} // Reset results for each analysis
4948
50- logger .Infof ("[SelectAllRule] Starting analysis" )
5149 // Use ParseTreeWalker to walk the tree with the listener
5250 walker := antlr .NewParseTreeWalker ()
5351 walker .Walk (r , tree )
@@ -58,16 +56,12 @@ func (r *SelectAllRule) Analyze(tree antlr.ParseTree, indexes []model.IndexInfo)
5856// EnterProjection is called when the listener enters a 'projection' rule.
5957// Matches: projection : bit_expr | bit_expr AS? column_label | bit_expr AS? STRING_VALUE | Star ;
6058func (r * SelectAllRule ) EnterProjection (ctx * obmysql.ProjectionContext ) {
61- logger .Infof ("[SelectAllRule] Entering Projection. Text: %s" , ctx .GetText ())
6259 if ctx .Star () != nil { // Check if the '*' token exists in this projection context
63- logger .Infof ("[SelectAllRule] Found Star in Projection" )
6460 r .diagnoseResults = append (r .diagnoseResults , model.SqlDiagnoseInfo {
6561 RuleName : r .Name (),
6662 Level : "WARN" ,
6763 Suggestion : "Specify specific columns instead of using SELECT * to improve performance and clarity." ,
6864 Reason : "Using SELECT * retrieves all columns, which can be inefficient and return unnecessary data." ,
6965 })
70- } else {
71- logger .Infof ("[SelectAllRule] No Star in Projection" )
7266 }
7367}
0 commit comments