This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new e0906ae875 Remove deprecated flight_data_from_arrow_batch (#6823)
e0906ae875 is described below

commit e0906ae8754057d05307421dbd336234d6f56471
Author: Piotr Findeisen <[email protected]>
AuthorDate: Tue Dec 3 09:53:34 2024 +0100

    Remove deprecated flight_data_from_arrow_batch (#6823)
    
    `flight_data_from_arrow_batch` was deprecated since v 30.0.0.
    The only remaining usage was in tests, so convert it to a test helper.
---
 arrow-flight/src/encode.rs | 23 ++++++++++++++++++++---
 arrow-flight/src/utils.rs  | 24 ------------------------
 2 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/arrow-flight/src/encode.rs b/arrow-flight/src/encode.rs
index 66ceab308f..3ca192d0bb 100644
--- a/arrow-flight/src/encode.rs
+++ b/arrow-flight/src/encode.rs
@@ -1586,12 +1586,29 @@ mod tests {
         hydrate_dictionaries(&batch, batch.schema()).expect("failed to 
optimize");
     }
 
-    pub fn make_flight_data(
+    fn make_flight_data(
         batch: &RecordBatch,
         options: &IpcWriteOptions,
     ) -> (Vec<FlightData>, FlightData) {
-        #[allow(deprecated)]
-        crate::utils::flight_data_from_arrow_batch(batch, options)
+        flight_data_from_arrow_batch(batch, options)
+    }
+
+    fn flight_data_from_arrow_batch(
+        batch: &RecordBatch,
+        options: &IpcWriteOptions,
+    ) -> (Vec<FlightData>, FlightData) {
+        let data_gen = IpcDataGenerator::default();
+        let mut dictionary_tracker =
+            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)
     }
 
     #[test]
diff --git a/arrow-flight/src/utils.rs b/arrow-flight/src/utils.rs
index c3a2e0d0bd..3242f511ae 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>, 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<Vec<RecordBatch>, ArrowError> {
     let schema = flight_data.first().ok_or_else(|| {

Reply via email to