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(frontend): remove FunctionCall::new_with_return_type that bypass infer_type #2047

Merged
merged 6 commits into from
Apr 22, 2022

Conversation

xiangjinwu
Copy link
Contributor

@xiangjinwu xiangjinwu commented Apr 22, 2022

What's changed and what's your intention?

  • infer_type returns Err rather than None so that callers do not need to construct errors with repeatedly.
  • FunctionCall now has 3 constructors:
    • new should be used in most cases. Return type is inferred.
    • new_cast dedicates to create cast expression, which needs the "return_type" as input argument.
    • new_unchecked constructs the struct directly bypassing type inference. Mainly for internal expr rewriting where inferring again is less desirable.

To handle in later PR: CASE and IN should be handled by FunctionCall::new rather than new_unchecked.

Checklist

  • I have written necessary docs and comments
    - [ ] I have added necessary unit tests and integration tests (Refactor does not break existing tests.)

Refer to a related PR or issue link (optional)

@codecov
Copy link

codecov bot commented Apr 22, 2022

Codecov Report

Merging #2047 (b0eb46f) into main (2027b1f) will decrease coverage by 0.00%.
The diff coverage is 78.94%.

@@            Coverage Diff             @@
##             main    #2047      +/-   ##
==========================================
- Coverage   70.76%   70.76%   -0.01%     
==========================================
  Files         631      631              
  Lines       81041    80945      -96     
==========================================
- Hits        57351    57281      -70     
+ Misses      23690    23664      -26     
Flag Coverage Δ
rust 70.76% <78.94%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
src/frontend/src/binder/expr/mod.rs 84.00% <55.55%> (+5.84%) ⬆️
src/frontend/src/binder/expr/binary_op.rs 94.11% <100.00%> (-0.12%) ⬇️
src/frontend/src/binder/expr/function.rs 89.58% <100.00%> (-1.95%) ⬇️
src/frontend/src/expr/expr_rewriter.rs 78.37% <100.00%> (ø)
src/frontend/src/expr/function_call.rs 95.16% <100.00%> (-0.26%) ⬇️
src/frontend/src/expr/type_inference.rs 97.38% <100.00%> (+<0.01%) ⬆️
src/frontend/src/expr/utils.rs 98.61% <100.00%> (ø)
...rc/frontend/src/optimizer/plan_node/logical_agg.rs 97.71% <100.00%> (ø)
src/frontend/src/planner/relation.rs 68.62% <100.00%> (-2.02%) ⬇️
... and 2 more

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

Copy link
Collaborator

@TennyZhuang TennyZhuang left a comment

Choose a reason for hiding this comment

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

LGTM!

@xiangjinwu xiangjinwu merged commit 5b5341f into main Apr 22, 2022
@xiangjinwu xiangjinwu deleted the rust-frontend-expr-new branch April 22, 2022 03:27
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

2 participants