Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions builtin/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package builtin

import (
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/model"

"github.com/chaos-mesh/go-sqlsmith/types"
"github.com/chaos-mesh/go-sqlsmith/util"
Expand All @@ -31,7 +30,7 @@ func GenerateFuncCallExpr(table *types.Table, args int, stable bool) ast.ExprNod

fns := getValidArgsFunc(args, stable)
fn := copyFunc(fns[util.Rd(len(fns))])
funcCallExpr.FnName = model.NewCIStr(fn.name)
funcCallExpr.FnName = ast.NewCIStr(fn.name)
for i := 0; i < args; i++ {
r := util.Rd(100)
if r > 80 {
Expand Down
3 changes: 1 addition & 2 deletions builtin/genetate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package builtin

import (
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/model"
)

// GenerateTypeFuncCallExpr generate FuncCallExpr by given type
Expand All @@ -34,6 +33,6 @@ func GenerateTypeFuncCallExpr(t string) *ast.FuncCallExpr {
// GenerateTimestampFuncCallExpr generate builtin func which will return date type
func GenerateTimestampFuncCallExpr() *ast.FuncCallExpr {
return &ast.FuncCallExpr{
FnName: model.NewCIStr("CURRENT_TIMESTAMP"),
FnName: ast.NewCIStr("CURRENT_TIMESTAMP"),
}
}
9 changes: 4 additions & 5 deletions builtin/hint.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"math/rand"

"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/model"

"github.com/chaos-mesh/go-sqlsmith/types"
"github.com/chaos-mesh/go-sqlsmith/util"
Expand Down Expand Up @@ -91,7 +90,7 @@ func GenerateHintExpr(table *types.Table) (h *ast.TableOptimizerHint) {
}
h = new(ast.TableOptimizerHint)
hintKeyword := enabledKeywords[util.Rd(len(enabledKeywords))]
h.HintName = model.NewCIStr(hintKeyword.name)
h.HintName = ast.NewCIStr(hintKeyword.name)

if hintKeyword.maxArg == 0 {
return
Expand All @@ -114,17 +113,17 @@ func GenerateHintExpr(table *types.Table) (h *ast.TableOptimizerHint) {
shuffledTables := make([]ast.HintTable, 0)
for _, t := range table.InnerTableList {
shuffledTables = append(shuffledTables, ast.HintTable{
TableName: model.NewCIStr(t.Table),
TableName: ast.NewCIStr(t.Table),
})
}
rand.Shuffle(len(shuffledTables), func(i, j int) {
shuffledTables[i], shuffledTables[j] = shuffledTables[j], shuffledTables[i]
})

shuffledIndexes := make([]model.CIStr, 0)
shuffledIndexes := make([]ast.CIStr, 0)
for _, idx := range table.Indexes {
if idx != "" {
shuffledIndexes = append(shuffledIndexes, model.NewCIStr(idx))
shuffledIndexes = append(shuffledIndexes, ast.NewCIStr(idx))
}
}
rand.Shuffle(len(shuffledIndexes), func(i, j int) {
Expand Down
7 changes: 3 additions & 4 deletions ddl_ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package sqlsmith

import (
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/model"

"github.com/chaos-mesh/go-sqlsmith/util"
)
Expand Down Expand Up @@ -91,12 +90,12 @@ func (s *SQLSmith) alterTableSpecDropColumn() *ast.AlterTableSpec {
}

func (s *SQLSmith) createIndexStmt() *ast.CreateIndexStmt {
var indexType model.IndexType
var indexType ast.IndexType
switch util.Rd(2) {
case 0:
indexType = model.IndexTypeBtree
indexType = ast.IndexTypeBtree
default:
indexType = model.IndexTypeHash
indexType = ast.IndexTypeHash
}

node := ast.CreateIndexStmt{
Expand Down
90 changes: 43 additions & 47 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,81 +1,77 @@
module github.com/chaos-mesh/go-sqlsmith

go 1.21

toolchain go1.21.0
go 1.23.8

require (
github.com/BurntSushi/toml v1.3.2
github.com/BurntSushi/toml v1.5.0
github.com/go-sql-driver/mysql v1.7.1
github.com/google/uuid v1.4.0
github.com/google/uuid v1.6.0
github.com/ngaut/log v0.0.0-20180314031856-b8e36e7ba5ac
github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32
github.com/pingcap/tidb v1.1.0-beta.0.20231212043317-b478056bbf73
github.com/pingcap/tidb/pkg/parser v0.0.0-20231212043317-b478056bbf73
github.com/stretchr/testify v1.8.4
github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f
github.com/pingcap/tidb v1.1.0-beta.0.20250415053443-ea52376d91c8
github.com/pingcap/tidb/pkg/parser v0.0.0-20250415053443-ea52376d91c8
github.com/stretchr/testify v1.10.0
)

require (
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudfoundry/gosigar v1.3.6 // indirect
github.com/cockroachdb/errors v1.8.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opentracing/basictracer-go v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c // indirect
github.com/pingcap/kvproto v0.0.0-20231122054644-fb0f5c2a0a10 // indirect
github.com/pingcap/log v1.1.1-0.20230317032135-a0d097d16e22 // indirect
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect
github.com/pingcap/failpoint v0.0.0-20240528011301-b51a646c7c86 // indirect
github.com/pingcap/kvproto v0.0.0-20250224053625-b6a98c6bf02d // indirect
github.com/pingcap/log v1.1.1-0.20241212030209-7e3ff8601a2a // indirect
github.com/pingcap/sysutil v1.0.1-0.20240311050922-ae81ee01f3a5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_golang v1.22.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.16.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/shirou/gopsutil/v3 v3.23.10 // indirect
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect
github.com/tikv/client-go/v2 v2.0.8-0.20231201024404-0ff16620f6c0 // indirect
github.com/tikv/pd/client v0.0.0-20231130081618-862eee18738e // indirect
github.com/tikv/client-go/v2 v2.0.8-0.20250327030528-1906b778d741 // indirect
github.com/tikv/pd/client v0.0.0-20250327162546-07c19b1f2f9f // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twmb/murmur3 v1.1.6 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.etcd.io/etcd/api/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/v3 v3.5.10 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.etcd.io/etcd/api/v3 v3.5.12 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect
go.etcd.io/etcd/client/v3 v3.5.12 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading