Remove column by index and return it. Return the `ArrayRef` if the column is removed. # Panics Panics if `index`` out of bounds. # Example ``` use std::sync::Arc; use arrow_array::{BooleanArray, Int32Array, RecordBatch}; use arrow_schema::{DataType, Field, Schema}; let id_array = Int32Array::from(vec![1, 2, 3, 4, 5]); let bool_array = BooleanArray::from(vec![true, false, false, true, true]);
(&mut self, index: usize)
| 666 | /// assert_eq!(batch.num_columns(), 1); |
| 667 | /// ``` |
| 668 | pub fn remove_column(&mut self, index: usize) -> ArrayRef { |
| 669 | let mut builder = SchemaBuilder::from(self.schema.as_ref()); |
| 670 | builder.remove(index); |
| 671 | self.schema = Arc::new(builder.finish()); |
| 672 | self.columns.remove(index) |
| 673 | } |
| 674 | |
| 675 | /// Return a new RecordBatch where each column is sliced |
| 676 | /// according to `offset` and `length` |