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

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


The following commit(s) were added to refs/heads/master by this push:
     new dc91a244e Minor: run clippy on `arrow-integration-testing` (#3428)
dc91a244e is described below

commit dc91a244e34a7ffe88f5d0676cef59843926c41d
Author: Andrew Lamb <[email protected]>
AuthorDate: Tue Jan 3 15:19:25 2023 -0500

    Minor: run clippy on `arrow-integration-testing` (#3428)
    
    * Minor run clippy on arrow-integration-testing
    
    * Fix clippy errors in arrow-integration-testing
---
 .github/workflows/arrow.yml                             |  4 ++++
 .../src/flight_client_scenarios/integration_test.rs     | 12 ++++++++++--
 .../src/flight_server_scenarios/integration_test.rs     | 17 +++++++++++++----
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/arrow.yml b/.github/workflows/arrow.yml
index c1e9d600a..a5f402cbe 100644
--- a/.github/workflows/arrow.yml
+++ b/.github/workflows/arrow.yml
@@ -208,5 +208,9 @@ jobs:
         run: cargo clippy -p arrow-arith --all-targets --features 
dyn_arith_dict -- -D warnings
       - name: Clippy arrow-row with all features
         run: cargo clippy -p arrow-row --all-targets --all-features -- -D 
warnings
+      - name: Clippy arrow-integration-test with all features
+        run: cargo clippy -p arrow-integration-test --all-targets 
--all-features -- -D warnings
+      - name: Clippy arrow-integration-testing with all features
+        run: cargo clippy -p arrow-integration-testing --all-targets 
--all-features -- -D warnings
       - name: Clippy arrow with all features except SIMD
         run: cargo clippy -p arrow 
--features=prettyprint,csv,ipc,test_utils,ffi,ipc_compression,dyn_cmp_dict,dyn_arith_dict,chrono-tz
 --all-targets -- -D warnings
diff --git 
a/arrow-integration-testing/src/flight_client_scenarios/integration_test.rs 
b/arrow-integration-testing/src/flight_client_scenarios/integration_test.rs
index a40076b3d..1f1b312f9 100644
--- a/arrow-integration-testing/src/flight_client_scenarios/integration_test.rs
+++ b/arrow-integration-testing/src/flight_client_scenarios/integration_test.rs
@@ -130,8 +130,16 @@ async fn send_batch(
     batch: &RecordBatch,
     options: &writer::IpcWriteOptions,
 ) -> Result {
-    let (dictionary_flight_data, mut batch_flight_data) =
-        arrow_flight::utils::flight_data_from_arrow_batch(batch, options);
+    let data_gen = writer::IpcDataGenerator::default();
+    let mut dictionary_tracker = writer::DictionaryTracker::new(false);
+
+    let (encoded_dictionaries, encoded_batch) = data_gen
+        .encoded_batch(batch, &mut dictionary_tracker, options)
+        .expect("DictionaryTracker configured above to not error on 
replacement");
+
+    let dictionary_flight_data: Vec<FlightData> =
+        encoded_dictionaries.into_iter().map(Into::into).collect();
+    let mut batch_flight_data: FlightData = encoded_batch.into();
 
     upload_tx
         .send_all(&mut stream::iter(dictionary_flight_data).map(Ok))
diff --git 
a/arrow-integration-testing/src/flight_server_scenarios/integration_test.rs 
b/arrow-integration-testing/src/flight_server_scenarios/integration_test.rs
index 9c6f26bef..7ad4c676f 100644
--- a/arrow-integration-testing/src/flight_server_scenarios/integration_test.rs
+++ b/arrow-integration-testing/src/flight_server_scenarios/integration_test.rs
@@ -25,7 +25,7 @@ use arrow::{
     buffer::Buffer,
     datatypes::Schema,
     datatypes::SchemaRef,
-    ipc::{self, reader},
+    ipc::{self, reader, writer},
     record_batch::RecordBatch,
 };
 use arrow_flight::{
@@ -121,15 +121,24 @@ impl FlightService for FlightServiceImpl {
             .iter()
             .enumerate()
             .flat_map(|(counter, batch)| {
-                let (dictionary_flight_data, mut batch_flight_data) =
-                    arrow_flight::utils::flight_data_from_arrow_batch(batch, 
&options);
+                let data_gen = writer::IpcDataGenerator::default();
+                let mut dictionary_tracker = 
writer::DictionaryTracker::new(false);
+
+                let (encoded_dictionaries, encoded_batch) = data_gen
+                    .encoded_batch(batch, &mut dictionary_tracker, &options)
+                    .expect(
+                        "DictionaryTracker configured above to not error on 
replacement",
+                    );
+
+                let dictionary_flight_data =
+                    encoded_dictionaries.into_iter().map(Into::into);
+                let mut batch_flight_data: FlightData = encoded_batch.into();
 
                 // Only the record batch's FlightData gets app_metadata
                 let metadata = counter.to_string().into();
                 batch_flight_data.app_metadata = metadata;
 
                 dictionary_flight_data
-                    .into_iter()
                     .chain(std::iter::once(batch_flight_data))
                     .map(Ok)
             });

Reply via email to