From 1539a969ac24117370398f9f246ed725632d2998 Mon Sep 17 00:00:00 2001 From: yuunlimm Date: Mon, 1 Jul 2024 17:13:31 -0700 Subject: [PATCH] fix payload filtering for parquet processor --- .../default_models/parquet_transactions.rs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/rust/processor/src/db/common/models/default_models/parquet_transactions.rs b/rust/processor/src/db/common/models/default_models/parquet_transactions.rs index 7a18d621a..a011a34fa 100644 --- a/rust/processor/src/db/common/models/default_models/parquet_transactions.rs +++ b/rust/processor/src/db/common/models/default_models/parquet_transactions.rs @@ -187,24 +187,26 @@ impl Transaction { block_height, block_timestamp, ); - let payload = user_txn + let request = &user_txn .request .as_ref() - .expect("Getting user request failed.") - .payload - .as_ref() - .expect("Getting payload failed."); - let payload_cleaned = get_clean_payload(payload, txn_version); - let payload_type = get_payload_type(payload); + .expect("Getting user request failed."); + + let (payload_cleaned, payload_type) = match request.payload.as_ref() { + Some(payload) => { + let payload_cleaned = get_clean_payload(payload, txn_version); + (payload_cleaned, Some(get_payload_type(payload))) + }, + None => (None, None), + }; - // let serialized_payload = serde_json::to_string(&payload_cleaned).unwrap(); // Handle errors as needed) let serialized_payload = payload_cleaned.map(|payload| canonical_json::to_string(&payload).unwrap()); ( Self::from_transaction_info_with_data( transaction_info, serialized_payload, - Some(payload_type), + payload_type, txn_version, transaction_type, user_txn.events.len() as i64,