-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7261 from pedro-stanaka/feat/plan-serialize-optimize
query: forward query plan in the remote query request
- Loading branch information
Showing
8 changed files
with
586 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) The Thanos Authors. | ||
// Licensed under the Apache License 2.0. | ||
|
||
package querypb | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"github.com/thanos-io/promql-engine/api" | ||
"github.com/thanos-io/promql-engine/logicalplan" | ||
) | ||
|
||
func NewJSONEncodedPlan(plan api.RemoteQuery) (*QueryPlan, error) { | ||
node, ok := plan.(logicalplan.Node) | ||
if !ok { | ||
return nil, errors.New("plan is not a logicalplan.Node") | ||
} | ||
bytes, err := logicalplan.Marshal(node) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &QueryPlan{ | ||
Encoding: &QueryPlan_Json{Json: bytes}, | ||
}, nil | ||
} |
Oops, something went wrong.