jecsand838 commented on code in PR #8242: URL: https://github.com/apache/arrow-rs/pull/8242#discussion_r2308882812
########## arrow-avro/benches/decoder.rs: ########## @@ -369,42 +405,55 @@ const MIX_SCHEMA: &str = r#"{"type":"record","name":"MixRec","fields":[{"name":" const NEST_SCHEMA: &str = r#"{"type":"record","name":"NestRec","fields":[{"name":"sub","type":{"type":"record","name":"Sub","fields":[{"name":"x","type":"int"},{"name":"y","type":"string"}]}}]}"#; macro_rules! dataset { - ($name:ident, $schema_json:expr, $gen_fn:ident) => { + (@impl $name:ident, $schema_json:expr, $gen_fn:ident, $prefix_size:expr, $fingerprint_expr:expr) => { static $name: Lazy<Vec<Vec<u8>>> = Lazy::new(|| { let schema = ApacheSchema::parse_str($schema_json).expect("invalid schema for generator"); Review Comment: I'd probably recommend just going with two simpler macros like this: ```rust macro_rules! dataset { ($name:ident, $schema_json:expr, $gen_fn:ident) => { static $name: Lazy<Vec<Vec<u8>>> = Lazy::new(|| { let schema = ApacheSchema::parse_str($schema_json).expect("invalid schema for generator"); let arrow_schema = AvroSchema::new($schema_json.parse().unwrap()); let fingerprint = arrow_schema.fingerprint().expect("fingerprint failed"); let prefix = make_prefix(fingerprint); SIZES .iter() .map(|&n| $gen_fn(&schema, n, &prefix)) .collect() }); }; } /// Additional helper for Confluent's ID-based wire format (00 + BE u32). macro_rules! dataset_id { ($name:ident, $schema_json:expr, $gen_fn:ident, $id:expr) => { static $name: Lazy<Vec<Vec<u8>>> = Lazy::new(|| { let schema = ApacheSchema::parse_str($schema_json).expect("invalid schema for generator"); let prefix = make_prefix(Fingerprint::Id($id)); SIZES .iter() .map(|&n| $gen_fn(&schema, n, &prefix)) .collect() }); }; } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org