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

feat: implement infer_return_type in frontend #3295

Merged
merged 3 commits into from
Jun 17, 2022
Merged

Conversation

ZENOTME
Copy link
Contributor

@ZENOTME ZENOTME commented Jun 17, 2022

What's changed and what's your intention?

The original implementation of infer_return_type interface in frontend is copied from run_statement. It will actually execute the statement and get the result description from the result of execution. This implementation is primarily for testing purposes but it's inefficient. Infer_return_type API is to get the result description but needn't execute.

Hence we give a new implementation for infer_return_type. It calls a new function "infer", "infer" will get the result description
of the query statement but not execute.

Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Refer to a related PR or issue link (optional)

#3131

@codecov
Copy link

codecov bot commented Jun 17, 2022

Codecov Report

Merging #3295 (674a7d1) into main (f9d3ba8) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #3295      +/-   ##
==========================================
- Coverage   73.23%   73.21%   -0.02%     
==========================================
  Files         748      748              
  Lines      101766   101785      +19     
==========================================
+ Hits        74524    74525       +1     
- Misses      27242    27260      +18     
Flag Coverage Δ
rust 73.21% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/frontend/src/session.rs 41.93% <0.00%> (-2.08%) ⬇️
src/meta/src/barrier/mod.rs 70.23% <0.00%> (+0.29%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Contributor

@BowenXiao1999 BowenXiao1999 left a comment

Choose a reason for hiding this comment

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

Great Job! LGTM!

Later we can cache the plan to acheive high efficiency.

}

fn user_authenticator(&self) -> &UserAuthenticator {
&self.user_authenticator
}
}

fn infer(session: Arc<SessionImpl>, stmt: Statement) -> Result<Vec<PgFieldDescriptor>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add some docstring.

@ZENOTME ZENOTME merged commit ab9f036 into main Jun 17, 2022
@ZENOTME ZENOTME deleted the zj/add_infer_function branch June 17, 2022 06:31
@hengm3467
Copy link
Contributor

@ZENOTME I assume the implementation change is invisible to users. Correct? Thanks.

@ZENOTME
Copy link
Contributor Author

ZENOTME commented Jun 17, 2022

@ZENOTME I assume the implementation change is invisible to users. Correct? Thanks.

Yes

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.

None yet

3 participants