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
12 changes: 11 additions & 1 deletion go/vt/vtgate/engine/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package engine

import (
"bytes"
"encoding/json"
"sync/atomic"
"time"
Expand Down Expand Up @@ -98,5 +99,14 @@ func (p *Plan) MarshalJSON() ([]byte, error) {
Errors: atomic.LoadUint64(&p.Errors),
TablesUsed: p.TablesUsed,
}
return json.Marshal(marshalPlan)

b := new(bytes.Buffer)
enc := json.NewEncoder(b)
enc.SetEscapeHTML(false)
err := enc.Encode(marshalPlan)
if err != nil {
return nil, err
}

return b.Bytes(), nil
}
11 changes: 5 additions & 6 deletions go/vt/vtgate/engine/plan_description.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,11 @@ func addMap(input map[string]any, buf *bytes.Buffer) error {

func marshalAdd(prepend string, buf *bytes.Buffer, name string, obj any) error {
buf.WriteString(prepend + `"` + name + `":`)
b, err := json.Marshal(obj)
if err != nil {
return err
}
buf.Write(b)
return nil

enc := json.NewEncoder(buf)
enc.SetEscapeHTML(false)

return enc.Encode(obj)
}

// PrimitiveToPlanDescription transforms a primitive tree into a corresponding PlanDescription tree
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/collations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type collationTestCase struct {

func (tc *collationTestCase) run(t *testing.T) {
vschemaWrapper := &vschemaWrapper{
v: loadSchema(t, "schema_test.json", false),
v: loadSchema(t, "vschemas/schema.json", false),
sysVarEnabled: true,
version: Gen4,
}
Expand Down
Loading