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

refactor: remove substrait ser/de for region query in standalone #3812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MichaelScofield
Copy link
Collaborator

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

close #3520

This PR makes the logical plan in region query request not always be serialized to and deserialized from substrait bytes, which is not necessary in standalone mode.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@MichaelScofield MichaelScofield requested review from v0y4g3r and a team as code owners April 26, 2024 11:54
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Apr 26, 2024
@MichaelScofield MichaelScofield force-pushed the refactor/no-serde-for-standalone-plan branch from ee45357 to 7e77982 Compare April 28, 2024 04:44
Copy link

codecov bot commented Apr 28, 2024

Codecov Report

Attention: Patch coverage is 96.15385% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 85.18%. Comparing base (4e5dd1e) to head (6cc8833).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3812      +/-   ##
==========================================
- Coverage   85.47%   85.18%   -0.30%     
==========================================
  Files         991      991              
  Lines      173053   173061       +8     
==========================================
- Hits       147920   147414     -506     
- Misses      25133    25647     +514     

@MichaelScofield MichaelScofield force-pushed the refactor/no-serde-for-standalone-plan branch from 7e77982 to 8aabf78 Compare April 29, 2024 05:57
@MichaelScofield MichaelScofield force-pushed the refactor/no-serde-for-standalone-plan branch from 8aabf78 to e8c9d37 Compare May 7, 2024 02:39
Comment on lines +28 to +38
/// The query request to be handled by the RegionServer(Datanode).
pub struct QueryRequest {
/// The header of this request. Often to store some context of the query. None means all to defaults.
pub header: Option<RegionRequestHeader>,

/// The id of the region to be queried.
pub region_id: RegionId,

/// The form of the query: a logical plan.
pub plan: LogicalPlan,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Putting the QueryRequest in the common-meta is weird. What about moving it to common-query?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can't do it because RegionId is in store-api, and store-api depends on common-query.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to keep region_id in the QueryRequest? We can pass region_id to handle_read() like handle_request().

pub async fn handle_request(
&self,
region_id: RegionId,
request: RegionRequest,
) -> Result<RegionResponse> {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's better to lessen the args of a function. The QueryRequest is directly used in trait Datanode defined in the same file, if QueryRequest is to be not placed in common-meta crate, so is that trait. I think we can do it in the future, to better organize the codes.

@@ -229,24 +215,3 @@ impl TreeNodeVisitor for TableNameExtractor {
}
}
}

struct TableNameRewriter;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we don't need to rewrite the table name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems it's not needed at the first place. Substrait is able to serde the fully qualified table name correctly. Rewriting table name like this could make physical plan failed at the optimization stage because the schema is not match before and after.

@MichaelScofield MichaelScofield force-pushed the refactor/no-serde-for-standalone-plan branch 2 times, most recently from 48520a2 to 50ac605 Compare May 14, 2024 08:16
@MichaelScofield
Copy link
Collaborator Author

@evenyag @waynexia PTAL

@killme2008
Copy link
Contributor

@waynexia Please take a look.

@waynexia
Copy link
Member

I'm going to look into this after v0.8 release.

@MichaelScofield MichaelScofield force-pushed the refactor/no-serde-for-standalone-plan branch from 50ac605 to da59aee Compare May 28, 2024 05:11
@MichaelScofield
Copy link
Collaborator Author

@waynexia PTAL

@MichaelScofield MichaelScofield force-pushed the refactor/no-serde-for-standalone-plan branch from da59aee to 6cc8833 Compare June 3, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the unnecessary ser/de by substrait in standalone mode
4 participants