Skip to content

Enable querier execution from logical plan #6908

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rubywtl
Copy link
Contributor

@rubywtl rubywtl commented Jul 24, 2025

What this PR does:
This PR enables the queriers to execute a logical plan derived from the serialized logical plan in the request body, under the distributed execution feature flag. It includes a fallback to the PromQL engine when necessary.

Unit tests have been added to verify that queries are correctly executed from the logical plan in the request body when expected, as opposed to the query string in the request URL

Which issue(s) this PR fixes:
Addresses the problem outlined in proposal 6789

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@rubywtl rubywtl force-pushed the querier/logical-plan-execution branch from fe31a41 to 2f83e12 Compare July 24, 2025 01:37
@rubywtl
Copy link
Contributor Author

rubywtl commented Jul 24, 2025

An open question: when we expect to execute from a logical plan but receive an empty plan parameter, should we
(1) treat this as an error (since the frontend in this case should provide a plan) and return a error: 500,
or (2) handle it gracefully by falling back to the PromQL query string?

My current implementation does the fallback, but I'm wondering if this masks potential frontend issues we should catch instead

@rubywtl rubywtl force-pushed the querier/logical-plan-execution branch from 2f83e12 to 422b1f2 Compare July 24, 2025 17:32
rubywtl added 6 commits July 24, 2025 11:53
Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
…ler code

Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
@rubywtl rubywtl force-pushed the querier/logical-plan-execution branch from a7a4faf to d984196 Compare July 24, 2025 18:53
rubywtl added 2 commits July 24, 2025 12:15
Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
Signed-off-by: rubywtl <rubyharrisonlee@gmail.com>
endTime := convertMsToTime(end)
stepDuration := convertMsToDuration(step)

byteLP := []byte(r.PostFormValue("plan"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use FormValue to align with how we parse other parameters?

}
qry, err = q.queryEngine.MakeInstantQueryFromPlan(ctx, q.queryable, opts, logicalPlan, tsTime, r.FormValue("query"))
if err != nil {
return apiFuncResult{nil, &apiError{errorBadData, fmt.Errorf("failed to create range query from logical plan: %v", err)}, nil, nil}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instant query

if len(byteLP) != 0 {
logicalPlan, err := logicalplan.Unmarshal(byteLP)
if err != nil {
return apiFuncResult{nil, &apiError{errorBadData, fmt.Errorf("invalid logical plan: %v", err)}, nil, nil}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad data error is a 400 and usually means something wrong on the user request. This seems ok if querier is directly queried by the user and plan is provided there. But in this usecase, we expect the plan provided by the Query Frontend.

If a plan is able to be generated and sent to Querier, it should eliminate the case of bad request. To me, unable to deserialize the created plan seems a service issue rather than a client issue under this scenario as the generated plan might be wrong. Returning 4XX in this case might make users confusing.

Let's see what others think.

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a new integration test for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy