Skip to content

Commit 3318896

Browse files
committed
use get_mut
1 parent 48f0ad3 commit 3318896

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

datafusion/datasource/src/table_schema.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,10 @@ impl TableSchema {
144144
self.table_partition_cols = Arc::new(partition_cols);
145145
} else {
146146
// Append to existing partition columns
147-
self.table_partition_cols = Arc::new(
148-
self.table_partition_cols
149-
.iter()
150-
.cloned()
151-
.chain(partition_cols)
152-
.collect(),
147+
let table_partition_cols = Arc::get_mut(&mut self.table_partition_cols).expect(
148+
"Expected to be the sole owner of table_partition_cols since this function accepts mut self",
153149
);
150+
table_partition_cols.extend(partition_cols);
154151
}
155152
let mut builder = SchemaBuilder::from(self.file_schema.as_ref());
156153
builder.extend(self.table_partition_cols.iter().cloned());

0 commit comments

Comments
 (0)