Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: optimize plan gist encoding and decoding #138641

Merged
merged 8 commits into from
Jan 9, 2025
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: 3 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ ALL_TESTS = [
"//pkg/util/admission/admissionpb:admissionpb_test",
"//pkg/util/admission:admission_test",
"//pkg/util/assetbundle:assetbundle_test",
"//pkg/util/base64:base64_test",
"//pkg/util/binfetcher:binfetcher_test",
"//pkg/util/bitarray:bitarray_test",
"//pkg/util/bitmap:bitmap_test",
Expand Down Expand Up @@ -2432,6 +2433,8 @@ GO_TARGETS = [
"//pkg/util/assetbundle/gen:gen_lib",
"//pkg/util/assetbundle:assetbundle",
"//pkg/util/assetbundle:assetbundle_test",
"//pkg/util/base64:base64",
"//pkg/util/base64:base64_test",
"//pkg/util/binfetcher:binfetcher",
"//pkg/util/binfetcher:binfetcher_test",
"//pkg/util/bitarray:bitarray",
Expand Down
12 changes: 9 additions & 3 deletions pkg/sql/opt/bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,10 +943,12 @@ func (h *harness) runSimple(tb testing.TB, query benchQuery, phase Phase) {
tb.Fatalf("invalid phase %s for Simple", phase)
}

var gf explain.PlanGistFactory
gf.Init(exec.StubFactory{})
root := execMemo.RootExpr()
eb := execbuilder.New(
context.Background(),
explain.NewPlanGistFactory(exec.StubFactory{}),
&gf,
&h.optimizer,
execMemo,
nil, /* catalog */
Expand Down Expand Up @@ -999,10 +1001,12 @@ func (h *harness) runPrepared(tb testing.TB, phase Phase) {
tb.Fatalf("invalid phase %s for Prepared", phase)
}

var gf explain.PlanGistFactory
gf.Init(exec.StubFactory{})
root := execMemo.RootExpr()
eb := execbuilder.New(
context.Background(),
explain.NewPlanGistFactory(exec.StubFactory{}),
&gf,
&h.optimizer,
execMemo,
nil, /* catalog */
Expand Down Expand Up @@ -1777,9 +1781,11 @@ func BenchmarkExecBuild(b *testing.B) {

b.Run(tc.query.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
var gf explain.PlanGistFactory
gf.Init(exec.StubFactory{})
eb := execbuilder.New(
context.Background(),
explain.NewPlanGistFactory(exec.StubFactory{}),
&gf,
&h.optimizer,
execMemo,
nil, /* catalog */
Expand Down
5 changes: 3 additions & 2 deletions pkg/sql/opt/exec/execbuilder/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ func (b *Builder) buildExplain(
// annotates nodes with extra information when the factory is an
// exec.ExplainFactory so it must be the outer factory and the gist
// factory must be the inner factory.
gf := explain.NewPlanGistFactory(f)
ef := explain.NewFactory(gf, b.semaCtx, b.evalCtx)
var gf explain.PlanGistFactory
gf.Init(f)
ef := explain.NewFactory(&gf, b.semaCtx, b.evalCtx)

explainBld := New(
b.ctx, ef, b.optimizer, b.mem, b.catalog, explainExpr.Input,
Expand Down
1 change: 1 addition & 0 deletions pkg/sql/opt/exec/explain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ go_library(
"//pkg/sql/sessiondatapb",
"//pkg/sql/types",
"//pkg/util",
"//pkg/util/base64",
"//pkg/util/errorutil",
"//pkg/util/humanizeutil",
"//pkg/util/intsets",
Expand Down
Loading
Loading