Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arrow-row/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down
23 changes: 23 additions & 0 deletions arrow/benches/row_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading