Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
systay committed Jan 13, 2025
1 parent ac8bbc6 commit dbec6cc
Show file tree
Hide file tree
Showing 5 changed files with 920 additions and 0 deletions.
38 changes: 38 additions & 0 deletions go/vt/vtgate/planbuilder/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,3 +872,41 @@ func benchmarkPlanner(b *testing.B, version plancontext.PlannerVersion, testCase
}
}
}

func (s *planTestSuite) TestMy() {
vschema, err := vschemawrapper.NewVschemaWrapper(
vtenv.NewTestEnv(),
loadSchema(s.T(), "vschemas/my_schema.json", true),
TestBuilder,
)
require.NoError(s.T(), err)
// vschema := &vschemawrapper.VSchemaWrapper{
// V: loadSchema(s.T(), "vschemas/my_schema.json", true),
// SysVarEnabled: true,
// Version: Gen4,
// Env: vtenv.NewTestEnv(),
// }

s.testFile("my.json", vschema, false)
}

func BenchmarkMine(b *testing.B) {
vschema, err := vschemawrapper.NewVschemaWrapper(
vtenv.NewTestEnv(),
loadSchema(b, "vschemas/my_schema.json", true),
TestBuilder,
)
require.NoError(b, err)
testCases := readJSONTests("my.json")

b.ReportAllocs()
b.ResetTimer()
for range b.N {
for _, tcase := range testCases {
plan, _ := TestBuilder(tcase.Query, vschema, vschema.CurrentDb())
if plan == nil {
panic("")
}
}
}
}
740 changes: 740 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/my.json

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/vschemas/my_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"keyspaces": {
"unsharded_ns": {
"sharded": false,
"tables": {
"my_table_seq": {
"type": "sequence",
"columns": [
{
"name": "next_id",
"type": "UINT64"
},
{
"name": "cache",
"type": "UINT32"
},
{
"name": "id",
"type": "UINT64"
}
],
"column_list_authoritative": true
}
}
},
"main": {
"sharded": true,
"vindexes": {
"binary_vdx": {
"type": "binary"
}
},
"tables": {
"my_table": {
"column_vindexes": [
{
"columns": [
"sdKey"
],
"name": "binary_vdx"
}
],
"auto_increment": {
"column": "id",
"sequence": "my_table_seq"
},
"columns": [
{
"name": "col01",
"type": "VARCHAR"
},
{
"name": "col02",
"type": "INT64"
},
{
"name": "col03",
"type": "BLOB"
},
{
"name": "col04",
"type": "VARCHAR"
},
{
"name": "col05",
"type": "VARBINARY"
},
{
"name": "col06",
"type": "INT8"
},
{
"name": "col07",
"type": "INT64"
},
{
"name": "col08",
"type": "VARBINARY"
},
{
"name": "sdKey",
"type": "VARBINARY"
},
{
"name": "col09",
"type": "INT64"
},
{
"name": "col10",
"type": "INT64"
},
{
"name": "col11",
"type": "INT64"
},
{
"name": "col12",
"type": "INT64"
},
{
"name": "id",
"type": "UINT64"
}
],
"column_list_authoritative": true
}
}
}
}
}
16 changes: 16 additions & 0 deletions main_bench
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
goos: darwin
goarch: arm64
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
cpu: Apple M1 Ultra
BenchmarkMine-20 202 5799386 ns/op 3685888 B/op 74513 allocs/op
BenchmarkMine-20 207 5812796 ns/op 3685465 B/op 74511 allocs/op
BenchmarkMine-20 205 5781308 ns/op 3686535 B/op 74514 allocs/op
BenchmarkMine-20 207 5726108 ns/op 3686011 B/op 74513 allocs/op
BenchmarkMine-20 205 5782586 ns/op 3685913 B/op 74512 allocs/op
BenchmarkMine-20 206 5761832 ns/op 3685581 B/op 74512 allocs/op
BenchmarkMine-20 206 5755995 ns/op 3685772 B/op 74512 allocs/op
BenchmarkMine-20 207 5811997 ns/op 3685700 B/op 74513 allocs/op
BenchmarkMine-20 207 5804760 ns/op 3685839 B/op 74512 allocs/op
BenchmarkMine-20 207 5728856 ns/op 3685925 B/op 74512 allocs/op
PASS
ok vitess.io/vitess/go/vt/vtgate/planbuilder 18.944s
16 changes: 16 additions & 0 deletions with_cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
goos: darwin
goarch: arm64
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
cpu: Apple M1 Ultra
BenchmarkMine-20 202 5858150 ns/op 3687144 B/op 74512 allocs/op
BenchmarkMine-20 205 5884388 ns/op 3687345 B/op 74512 allocs/op
BenchmarkMine-20 205 5872149 ns/op 3687565 B/op 74513 allocs/op
BenchmarkMine-20 206 5813034 ns/op 3687350 B/op 74512 allocs/op
BenchmarkMine-20 207 5836727 ns/op 3687054 B/op 74512 allocs/op
BenchmarkMine-20 207 5826613 ns/op 3687322 B/op 74512 allocs/op
BenchmarkMine-20 204 5839730 ns/op 3687249 B/op 74512 allocs/op
BenchmarkMine-20 205 5814595 ns/op 3687180 B/op 74511 allocs/op
BenchmarkMine-20 205 5796803 ns/op 3687704 B/op 74513 allocs/op
BenchmarkMine-20 207 5861450 ns/op 3687561 B/op 74513 allocs/op
PASS
ok vitess.io/vitess/go/vt/vtgate/planbuilder 19.160s

0 comments on commit dbec6cc

Please sign in to comment.