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

minor: Improve documentation for DFSchema join and merge functions #2367

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions datafusion/common/src/dfschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ impl DFSchema {
)
}

/// Combine two schemas
/// Create a new schema that contains the fields from this schema followed by the fields
/// from the supplied schema. An error will be returned if there are duplicate field names.
pub fn join(&self, schema: &DFSchema) -> Result<Self> {
let mut fields = self.fields.clone();
let mut metadata = self.metadata.clone();
Expand All @@ -125,7 +126,8 @@ impl DFSchema {
Self::new_with_metadata(fields, metadata)
}

/// Merge a schema into self
/// Modify this schema by appending the fields from the supplied schema, ignoring any
/// duplicate fields.
pub fn merge(&mut self, other_schema: &DFSchema) {
for field in other_schema.fields() {
// skip duplicate columns
Expand Down