Skip to content

Commit

Permalink
add benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
houqp committed Aug 29, 2022
1 parent f91462c commit dab6556
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
5 changes: 5 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,8 @@ tempfile = "3"
maplit = { version = "1" }
anyhow = "1"
rand = "0.8"
criterion = "0"

[[bench]]
name = "read_checkpoint"
harness = false
14 changes: 8 additions & 6 deletions rust/src/action/parquet2_read/boolean.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use parquet2::encoding::hybrid_rle::BitmapIter;
use parquet2::metadata::ColumnDescriptor;
use parquet2::page::DataPage;
use parquet2::schema::types::PhysicalType;

use super::validity::ValidityRowIndexIter;
use super::{split_page, ActionVariant, ParseError};
Expand Down Expand Up @@ -56,11 +55,14 @@ where
SetFn: Fn(&mut ActType, bool),
{
#[cfg(debug_assertions)]
if page.descriptor.primitive_type.physical_type != PhysicalType::Boolean {
return Err(ParseError::InvalidAction(format!(
"expect physical parquet type boolean, got {:?}",
page.descriptor.primitive_type,
)));
{
use parquet2::schema::types::PhysicalType;
if page.descriptor.primitive_type.physical_type != PhysicalType::Boolean {
return Err(ParseError::InvalidAction(format!(
"expect physical parquet type boolean, got {:?}",
page.descriptor.primitive_type,
)));
}
}

let some_value_iter = SomeBooleanValueIter::try_new(page, descriptor)?;
Expand Down
14 changes: 8 additions & 6 deletions rust/src/action/parquet2_read/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use parquet2::metadata::ColumnDescriptor;
use parquet2::page::{DataPage, DictPage};
use parquet2::schema::types::PhysicalType;

use super::string::for_each_repeated_string_field_value_with_idx;
use super::{ActionVariant, ParseError};
Expand All @@ -29,11 +28,14 @@ where
{
debug_assert!(field[0] == "key_value");
#[cfg(debug_assertions)]
if page.descriptor.primitive_type.physical_type != PhysicalType::ByteArray {
return Err(ParseError::InvalidAction(format!(
"expect parquet utf8 type for map key/value, got primitive type: {:?}",
page.descriptor.primitive_type,
)));
{
use parquet2::schema::types::PhysicalType;
if page.descriptor.primitive_type.physical_type != PhysicalType::ByteArray {
return Err(ParseError::InvalidAction(format!(
"expect parquet utf8 type for map key/value, got primitive type: {:?}",
page.descriptor.primitive_type,
)));
}
}

match field[1].as_str() {
Expand Down
27 changes: 16 additions & 11 deletions rust/src/action/parquet2_read/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use parquet2::encoding::hybrid_rle::HybridRleDecoder;
use parquet2::encoding::Encoding;
use parquet2::metadata::ColumnDescriptor;
use parquet2::page::{DataPage, DictPage};
use parquet2::schema::types::PhysicalType;

use super::dictionary;
use super::dictionary::binary::BinaryPageDict;
Expand Down Expand Up @@ -206,11 +205,14 @@ where
MapFn: FnMut(Result<(usize, Vec<String>), ParseError>) -> Result<(), ParseError>,
{
#[cfg(debug_assertions)]
if page.descriptor.primitive_type.physical_type != PhysicalType::ByteArray {
return Err(ParseError::InvalidAction(format!(
"expect parquet utf8 type, got primitive type: {:?}",
page.descriptor.primitive_type,
)));
{
use parquet2::schema::types::PhysicalType;
if page.descriptor.primitive_type.physical_type != PhysicalType::ByteArray {
return Err(ParseError::InvalidAction(format!(
"expect parquet utf8 type, got primitive type: {:?}",
page.descriptor.primitive_type,
)));
}
}

match page.encoding() {
Expand Down Expand Up @@ -271,11 +273,14 @@ where
SetFn: Fn(&mut ActType, String),
{
#[cfg(debug_assertions)]
if page.descriptor.primitive_type.physical_type != PhysicalType::ByteArray {
return Err(ParseError::InvalidAction(format!(
"expect parquet utf8 type, got primitive type: {:?}",
page.descriptor.primitive_type,
)));
{
use parquet2::schema::types::PhysicalType;
if page.descriptor.primitive_type.physical_type != PhysicalType::ByteArray {
return Err(ParseError::InvalidAction(format!(
"expect parquet utf8 type, got primitive type: {:?}",
page.descriptor.primitive_type,
)));
}
}

let map_fn = |entry: Result<(usize, String), ParseError>| -> Result<(), ParseError> {
Expand Down

0 comments on commit dab6556

Please sign in to comment.