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

Jefffrey 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 c7dc6b8bae Add validated row decode benchmark (#10259)
c7dc6b8bae is described below

commit c7dc6b8baeb6e1746e20e77ffbe990dd7d1d1042
Author: Andrew Lamb <[email protected]>
AuthorDate: Thu Jul 2 08:12:24 2026 -0400

    Add validated row decode benchmark (#10259)
    
    # Which issue does this PR close?
    
    - related to https://github.com/apache/arrow-rs/pull/10250 from
    @Jefffrey
    
    # Rationale for this change
    
    The existing row format benchmark measures `convert_rows` using rows
    created directly by `RowConverter::convert_columns`, which skips UTF-8
    validation during decode.
    
    # What changes are included in this PR?
    
    This adds a `convert_rows_validated` benchmark that decodes rows parsed
    through `RowParser`, exercising the UTF-8 validation path. It also
    derives `Clone` for `Rows` so the benchmark setup can reuse the prepared
    rows when converting to binary.
    
    # Are these changes tested?
    
    CI.
    
    I also ran it locally like
    ```shell
    cargo bench --bench row_format -- convert_rows_validated
    ```
    
    
    # Are there any user-facing changes?
    
    No breaking changes. `Rows` now implements `Clone`.
---
 arrow-row/src/lib.rs        |  2 +-
 arrow/benches/row_format.rs | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arrow-row/src/lib.rs b/arrow-row/src/lib.rs
index 182481f42b..17ede5a0c4 100644
--- a/arrow-row/src/lib.rs
+++ b/arrow-row/src/lib.rs
@@ -1221,7 +1221,7 @@ struct RowConfig {
 /// A row-oriented representation of arrow data, that is normalized for 
comparison.
 ///
 /// See the [module level documentation](self) and [`RowConverter`] for more 
details.
-#[derive(Debug)]
+#[derive(Debug, Clone)]
 pub struct Rows {
     /// Underlying row bytes
     buffer: Vec<u8>,
diff --git a/arrow/benches/row_format.rs b/arrow/benches/row_format.rs
index f33d8d16b8..6615a4d230 100644
--- a/arrow/benches/row_format.rs
+++ b/arrow/benches/row_format.rs
@@ -61,6 +61,29 @@ fn do_bench(c: &mut Criterion, name: &str, cols: 
Vec<ArrayRef>) {
         b.iter(|| hint::black_box(converter.convert_rows(&rows).unwrap()));
     });
 
+    // Benchmark parsing strings which may need utf8 validation.
+    fn is_stringlike(array: &ArrayRef) -> bool {
+        matches!(array.data_type(), DataType::Utf8 | DataType::Utf8View)
+    }
+    if cols.iter().all(is_stringlike) {
+        // RowParser marks rows as requiring UTF-8 validation when they are 
decoded
+        // back into Arrow arrays by RowConverter::convert_rows.
+        let parser = converter.parser();
+        let parsed_rows: Vec<_> = rows
+            .iter()
+            .map(|row| parser.parse(row.as_ref()).owned())
+            .collect();
+        c.bench_function(&format!("convert_rows_parsed {name}"), |b| {
+            b.iter(|| {
+                hint::black_box(
+                    converter
+                        .convert_rows(parsed_rows.iter().map(|row| row.row()))
+                        .unwrap(),
+                )
+            });
+        });
+    }
+
     let mut rows = converter.empty_rows(0, 0);
     c.bench_function(&format!("append_rows {name}"), |b| {
         let cols = cols.clone();

Reply via email to