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(binder): support subqurey in FROM #992

Merged
merged 4 commits into from
Mar 17, 2022
Merged

feat(binder): support subqurey in FROM #992

merged 4 commits into from
Mar 17, 2022

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented Mar 17, 2022

What's changed and what's your intention?

support subqurey in FROM

How does this PR work: Added a stack of BindContext, and used here:

pub(super) fn bind_subquery(&mut self, query: Query) -> Result<SubQuery> {
        self.push_context();
        let query = self.bind_query(query)?;
        self.pop_context();
        self.bind_context(
            itertools::zip_eq(query.names().into_iter(), query.data_types().into_iter()),
            "?subquery?".to_string(),
        )?;
        Ok(SubQuery { query })
}

Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests

Refer to a related PR or issue link (optional)

@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #992 (e66bc0e) into main (95b9d6f) will decrease coverage by 0.29%.
The diff coverage is 91.83%.

❗ Current head e66bc0e differs from pull request most recent head d17c4fa. Consider uploading reports for the commit d17c4fa to get more accurate results

@@             Coverage Diff              @@
##               main     #992      +/-   ##
============================================
- Coverage     71.39%   71.09%   -0.30%     
  Complexity     2766     2766              
============================================
  Files           978      977       -1     
  Lines         57782    57629     -153     
  Branches       1790     1790              
============================================
- Hits          41254    40974     -280     
- Misses        15637    15764     +127     
  Partials        891      891              
Flag Coverage Δ
java 61.03% <ø> (ø)
rust 74.92% <91.83%> (-0.40%) ⬇️

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

Impacted Files Coverage Δ
rust/frontend/src/binder/bind_context.rs 96.00% <ø> (+8.00%) ⬆️
rust/frontend/src/binder/set_expr.rs 71.42% <66.66%> (-8.58%) ⬇️
rust/frontend/src/binder/table_ref.rs 84.44% <95.23%> (+7.11%) ⬆️
rust/frontend/src/binder/mod.rs 100.00% <100.00%> (ø)
rust/frontend/src/binder/query.rs 100.00% <100.00%> (ø)
rust/frontend/src/binder/select.rs 98.27% <100.00%> (+0.19%) ⬆️
...rontend/src/optimizer/plan_node/logical_project.rs 97.00% <100.00%> (+1.19%) ⬆️
rust/frontend/src/planner/table_ref.rs 100.00% <100.00%> (ø)
rust/storage/src/hummock/state_store_tests.rs 0.00% <0.00%> (-100.00%) ⬇️
rust/batch/src/task/channel.rs 0.00% <0.00%> (-60.00%) ⬇️
... and 60 more

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

Copy link
Member

@fuyufjh fuyufjh left a comment

Choose a reason for hiding this comment

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

LGTM, but did not see a single comment/rustdoc in this PR :( Please add some comments, thanks!

rust/frontend/src/binder/select.rs Outdated Show resolved Hide resolved
rust/frontend/src/binder/table_ref.rs Show resolved Hide resolved
rust/frontend/src/binder/mod.rs Show resolved Hide resolved
Copy link
Contributor

@xiangjinwu xiangjinwu left a comment

Choose a reason for hiding this comment

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

lgtm

- "?column?" as constant
- add some docs
- remove Clone for SubQuery
@xxchan xxchan requested a review from fuyufjh March 17, 2022 08:09
@xxchan xxchan enabled auto-merge (squash) March 17, 2022 09:27
@xxchan xxchan merged commit 6b044f6 into main Mar 17, 2022
@xxchan xxchan deleted the bind_subquery_from branch March 17, 2022 09:44
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.

4 participants