From 30a63abc423b8af7cc8cc0e7650e069e786b0f65 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 22 Nov 2024 14:50:53 -0500 Subject: [PATCH 1/2] Remove some very old deprecated functions --- arrow-array/src/array/struct_array.rs | 6 ----- arrow-flight/src/utils.rs | 24 ------------------ parquet/src/file/properties.rs | 36 --------------------------- 3 files changed, 66 deletions(-) diff --git a/arrow-array/src/array/struct_array.rs b/arrow-array/src/array/struct_array.rs index 41eb8235e540..692f76e4821d 100644 --- a/arrow-array/src/array/struct_array.rs +++ b/arrow-array/src/array/struct_array.rs @@ -239,12 +239,6 @@ impl StructArray { &self.fields } - /// Returns child array refs of the struct array - #[deprecated(note = "Use columns().to_vec()")] - pub fn columns_ref(&self) -> Vec { - self.columns().to_vec() - } - /// Return field names in this struct array pub fn column_names(&self) -> Vec<&str> { match self.data_type() { diff --git a/arrow-flight/src/utils.rs b/arrow-flight/src/utils.rs index c3a2e0d0bdd1..3242f511ae61 100644 --- a/arrow-flight/src/utils.rs +++ b/arrow-flight/src/utils.rs @@ -27,30 +27,6 @@ use arrow_ipc::convert::fb_to_schema; use arrow_ipc::{reader, root_as_message, writer, writer::IpcWriteOptions}; use arrow_schema::{ArrowError, Schema, SchemaRef}; -/// Convert a `RecordBatch` to a vector of `FlightData` representing the bytes of the dictionaries -/// and a `FlightData` representing the bytes of the batch's values -#[deprecated( - since = "30.0.0", - note = "Use IpcDataGenerator directly with DictionaryTracker to avoid re-sending dictionaries" -)] -pub fn flight_data_from_arrow_batch( - batch: &RecordBatch, - options: &IpcWriteOptions, -) -> (Vec, FlightData) { - let data_gen = writer::IpcDataGenerator::default(); - let mut dictionary_tracker = - writer::DictionaryTracker::new_with_preserve_dict_id(false, options.preserve_dict_id()); - - let (encoded_dictionaries, encoded_batch) = data_gen - .encoded_batch(batch, &mut dictionary_tracker, options) - .expect("DictionaryTracker configured above to not error on replacement"); - - let flight_dictionaries = encoded_dictionaries.into_iter().map(Into::into).collect(); - let flight_batch = encoded_batch.into(); - - (flight_dictionaries, flight_batch) -} - /// Convert a slice of wire protocol `FlightData`s into a vector of `RecordBatch`es pub fn flight_data_to_batches(flight_data: &[FlightData]) -> Result, ArrowError> { let schema = flight_data.first().ok_or_else(|| { diff --git a/parquet/src/file/properties.rs b/parquet/src/file/properties.rs index efcb63258f99..f4f610ab96f8 100644 --- a/parquet/src/file/properties.rs +++ b/parquet/src/file/properties.rs @@ -185,14 +185,6 @@ impl WriterProperties { WriterPropertiesBuilder::with_defaults() } - /// Returns data page size limit. - /// - /// Note: this is a best effort limit based on the write batch size - #[deprecated(since = "41.0.0", note = "Use data_page_size_limit")] - pub fn data_pagesize_limit(&self) -> usize { - self.data_page_size_limit - } - /// Returns data page size limit. /// /// Note: this is a best effort limit based on the write batch size @@ -202,14 +194,6 @@ impl WriterProperties { self.data_page_size_limit } - /// Returns dictionary page size limit. - /// - /// Note: this is a best effort limit based on the write batch size - #[deprecated(since = "41.0.0", note = "Use dictionary_page_size_limit")] - pub fn dictionary_pagesize_limit(&self) -> usize { - self.dictionary_page_size_limit - } - /// Returns dictionary page size limit. /// /// Note: this is a best effort limit based on the write batch size @@ -433,16 +417,6 @@ impl WriterPropertiesBuilder { self } - /// Sets best effort maximum size of a data page in bytes. - /// - /// Note: this is a best effort limit based on value of - /// [`set_write_batch_size`](Self::set_write_batch_size). - #[deprecated(since = "41.0.0", note = "Use set_data_page_size_limit")] - pub fn set_data_pagesize_limit(mut self, value: usize) -> Self { - self.data_page_size_limit = value; - self - } - /// Sets best effort maximum size of a data page in bytes (defaults to `1024 * 1024`). /// /// The parquet writer will attempt to limit the sizes of each @@ -471,16 +445,6 @@ impl WriterPropertiesBuilder { self } - /// Sets best effort maximum dictionary page size, in bytes. - /// - /// Note: this is a best effort limit based on value of - /// [`set_write_batch_size`](Self::set_write_batch_size). - #[deprecated(since = "41.0.0", note = "Use set_dictionary_page_size_limit")] - pub fn set_dictionary_pagesize_limit(mut self, value: usize) -> Self { - self.dictionary_page_size_limit = value; - self - } - /// Sets best effort maximum dictionary page size, in bytes (defaults to `1024 * 1024`). /// /// The parquet writer will attempt to limit the size of each From 9a0d4d05453c62d0e60526c39eed1c72e2ae2bfd Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Fri, 22 Nov 2024 15:00:38 -0500 Subject: [PATCH 2/2] fix --- arrow-flight/src/utils.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arrow-flight/src/utils.rs b/arrow-flight/src/utils.rs index 3242f511ae61..c3a2e0d0bdd1 100644 --- a/arrow-flight/src/utils.rs +++ b/arrow-flight/src/utils.rs @@ -27,6 +27,30 @@ use arrow_ipc::convert::fb_to_schema; use arrow_ipc::{reader, root_as_message, writer, writer::IpcWriteOptions}; use arrow_schema::{ArrowError, Schema, SchemaRef}; +/// Convert a `RecordBatch` to a vector of `FlightData` representing the bytes of the dictionaries +/// and a `FlightData` representing the bytes of the batch's values +#[deprecated( + since = "30.0.0", + note = "Use IpcDataGenerator directly with DictionaryTracker to avoid re-sending dictionaries" +)] +pub fn flight_data_from_arrow_batch( + batch: &RecordBatch, + options: &IpcWriteOptions, +) -> (Vec, FlightData) { + let data_gen = writer::IpcDataGenerator::default(); + let mut dictionary_tracker = + writer::DictionaryTracker::new_with_preserve_dict_id(false, options.preserve_dict_id()); + + let (encoded_dictionaries, encoded_batch) = data_gen + .encoded_batch(batch, &mut dictionary_tracker, options) + .expect("DictionaryTracker configured above to not error on replacement"); + + let flight_dictionaries = encoded_dictionaries.into_iter().map(Into::into).collect(); + let flight_batch = encoded_batch.into(); + + (flight_dictionaries, flight_batch) +} + /// Convert a slice of wire protocol `FlightData`s into a vector of `RecordBatch`es pub fn flight_data_to_batches(flight_data: &[FlightData]) -> Result, ArrowError> { let schema = flight_data.first().ok_or_else(|| {