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: create nested table schema according to proto file #1078

Merged
merged 26 commits into from
Mar 24, 2022

Conversation

cykbls01
Copy link
Contributor

@cykbls01 cykbls01 commented Mar 20, 2022

What's changed and what's your intention?

PLEASE DO NOT LEAVE THIS EMPTY !!!

Please explain IN DETAIL what the changes are in this PR and why they are needed:

  1. implement create nested table schema according to proto file.
  2. change struct of ColumnDesc and from function of TableCatalog and ColumnDesc to store the struct column and type name.

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)

#575

@codecov
Copy link

codecov bot commented Mar 20, 2022

Codecov Report

Merging #1078 (f17c7e4) into main (b54424d) will increase coverage by 0.11%.
The diff coverage is 92.48%.

@@             Coverage Diff              @@
##               main    #1078      +/-   ##
============================================
+ Coverage     70.28%   70.40%   +0.11%     
  Complexity     2766     2766              
============================================
  Files           997      997              
  Lines         83966    84342     +376     
  Branches       1790     1790              
============================================
+ Hits          59016    59378     +362     
- Misses        24059    24073      +14     
  Partials        891      891              
Flag Coverage Δ
java 61.01% <ø> (ø)
rust 72.57% <92.48%> (+0.13%) ⬆️

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

Impacted Files Coverage Δ
rust/frontend/src/handler/create_source.rs 0.00% <0.00%> (ø)
rust/frontend/src/catalog/table_catalog.rs 94.06% <98.57%> (+5.93%) ⬆️
rust/common/src/catalog/column.rs 72.72% <100.00%> (ø)
rust/frontend/src/catalog/column_catalog.rs 95.21% <100.00%> (+58.37%) ⬆️
rust/frontend/src/handler/create_table.rs 100.00% <100.00%> (ø)
rust/source/src/parser/protobuf_parser.rs 90.71% <100.00%> (+3.71%) ⬆️
.../src/executor/managed_state/aggregation/extreme.rs 90.40% <0.00%> (+0.27%) ⬆️
... and 3 more

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

@cykbls01 cykbls01 closed this Mar 21, 2022
@cykbls01 cykbls01 reopened this Mar 21, 2022
rust/frontend/src/catalog/column_catalog.rs Outdated Show resolved Hide resolved
proto/plan.proto Outdated Show resolved Hide resolved
rust/frontend/src/catalog/column_catalog.rs Outdated Show resolved Hide resolved
rust/frontend/src/catalog/table_catalog.rs Outdated Show resolved Hide resolved
rust/batch/src/executor/delete.rs Show resolved Hide resolved
rust/common/src/catalog/column.rs Outdated Show resolved Hide resolved
rust/stream/src/executor/source.rs Show resolved Hide resolved
rust/common/src/catalog/column.rs Outdated Show resolved Hide resolved
rust/source/src/parser/protobuf_parser.rs Outdated Show resolved Hide resolved
rust/prost/src/imp.rs Outdated Show resolved Hide resolved
rust/common/src/catalog/column.rs Outdated Show resolved Hide resolved
@neverchanje neverchanje marked this pull request as ready for review March 24, 2022 01:39
Copy link
Contributor

@neverchanje neverchanje left a comment

Choose a reason for hiding this comment

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

overall lgtm, @st1page PTAL

Comment on lines +130 to +136
column_desc: Some(ProstColumnDesc {
column_id: 0,
name: ROWID_NAME.to_string(),
field_descs: vec![],
column_type: Some(DataType::Int32.to_protobuf()),
type_name: String::new(),
}),
Copy link
Contributor

@neverchanje neverchanje Mar 24, 2022

Choose a reason for hiding this comment

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

Suggested change
column_desc: Some(ProstColumnDesc {
column_id: 0,
name: ROWID_NAME.to_string(),
field_descs: vec![],
column_type: Some(DataType::Int32.to_protobuf()),
type_name: String::new(),
}),
column_desc: Some(ProstColumnDesc::new_atomic(
ROWID_NAME.to_string(),
DataType::Varchar.to_protobuf(),
"",
}),

Why didn't you just refactor all occurrences of direct struct instantiation?

and actully you can simplify more:

pub fn new_atomic(data_type: DataType, name: impl Into<String>, column_id: i32) -> Self {
        Self {
            column_type: Some(data_type.to_protobuf()), // you can get away from to_protobuf() every where
            column_id,
            name: name.into(), // use Into<String> for arguments that can possibily be either &str or String,
            ..Default::default()
        }
    }

@cykbls01 cykbls01 requested a review from st1page March 24, 2022 11:45
Copy link
Contributor

@st1page st1page left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants