Skip to content

Commit

Permalink
fix: ci lint err
Browse files Browse the repository at this point in the history
  • Loading branch information
BugsGuru committed Jan 24, 2025
1 parent 2078463 commit a6e54db
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sqle/driver/mysql/rule/ai/rule_00097.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func RuleSQLE00097(input *rulepkg.RuleHandlerInput) error {
checkViolate := func(table *ast.TableName, col string) (bool, error) {
createTableStmt, err := getCreateTableStmt(table)
if err != nil {
return false, fmt.Errorf("Failed to get CREATE TABLE statement for table %s: %v", table, err)
return false, fmt.Errorf("Failed to get CREATE TABLE statement for table %s: %v", table.Name.String(), err)
}
columnDef := getColumnDef(createTableStmt, col)

Expand Down
5 changes: 4 additions & 1 deletion sqle/driver/mysql/rule/ai/rule_00100.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ func RuleSQLE00100(input *rulepkg.RuleHandlerInput) error {
case *ast.SelectStmt, *ast.UnionStmt:
// 当sql是insert ... select语句中的SelectStmt/UnionStmt的Text() 为'', 因此这里改用Restore方式获取sqlText
sqlBuilder := new(strings.Builder)
node.Restore(format.NewRestoreCtx((format.RestoreStringSingleQuotes), sqlBuilder))
err := node.Restore(format.NewRestoreCtx((format.RestoreStringSingleQuotes), sqlBuilder))
if err != nil {
return false, err
}
sqlText := sqlBuilder.String()
executionPlan, err := util.GetExecutionPlan(input.Ctx, sqlText)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion sqle/driver/mysql/rule/ai/rule_00110.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func RuleSQLE00110(input *rulepkg.RuleHandlerInput) error {
indexes, err := util.GetTableIndexes(input.Ctx, table.Name.String(), table.Schema.String())
if err != nil {
// 记录错误日志并继续检查下一个表
log.NewEntry().Errorf("获取表 %s 的索引失败: %v", table, err)
log.NewEntry().Errorf("获取表 %s 的索引失败: %v", table.Name.String(), err)
continue
}

Expand Down
5 changes: 4 additions & 1 deletion sqle/driver/mysql/session/mock_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,10 @@ func InitializeMockContext(e *executor.Executor, context *AIMockContext) (*Conte
}
}
for tableName, sizeGB := range context.tableSize {
ctx.SetTableSize(ctx.currentSchema, tableName, sizeGB*1024 /*size MB*/)
err := ctx.SetTableSize(ctx.currentSchema, tableName, sizeGB*1024 /*size MB*/)
if err != nil {
return nil, err
}
}
return ctx, nil
}

0 comments on commit a6e54db

Please sign in to comment.