diff --git a/src/connector/src/source/nexmark/mod.rs b/src/connector/src/source/nexmark/mod.rs index 474eeaf6f0619..0c63a96dfe683 100644 --- a/src/connector/src/source/nexmark/mod.rs +++ b/src/connector/src/source/nexmark/mod.rs @@ -43,11 +43,9 @@ const fn none() -> Option { None } -pub type NexmarkProperties = Box; - #[serde_as] #[derive(Clone, Debug, Deserialize, WithOptions)] -pub struct NexmarkPropertiesInner { +pub struct NexmarkProperties { #[serde_as(as = "DisplayFromStr")] #[serde(rename = "nexmark.split.num", default = "identity_i32::<1>")] pub split_num: i32, @@ -233,15 +231,15 @@ fn default_event_num() -> u64 { u64::MAX } -impl Default for NexmarkPropertiesInner { +impl Default for NexmarkProperties { fn default() -> Self { let v = serde_json::to_value(HashMap::::new()).unwrap(); - NexmarkPropertiesInner::deserialize(v).unwrap() + NexmarkProperties::deserialize(v).unwrap() } } -impl From<&NexmarkPropertiesInner> for NexmarkConfig { - fn from(value: &NexmarkPropertiesInner) -> Self { +impl From<&NexmarkProperties> for NexmarkConfig { + fn from(value: &NexmarkProperties) -> Self { // 2015-07-15 00:00:00 pub const BASE_TIME: u64 = 1_436_918_400_000; diff --git a/src/connector/src/source/nexmark/source/reader.rs b/src/connector/src/source/nexmark/source/reader.rs index 28dc76eadeb48..c8e7b0c41d7ea 100644 --- a/src/connector/src/source/nexmark/source/reader.rs +++ b/src/connector/src/source/nexmark/source/reader.rs @@ -77,7 +77,7 @@ impl SplitReader for NexmarkSplitReader { let offset = split.start_offset.unwrap_or(split_index); let assigned_split = split; - let mut generator = EventGenerator::new(NexmarkConfig::from(&*properties)) + let mut generator = EventGenerator::new(NexmarkConfig::from(&properties)) .with_offset(offset) .with_step(split_num); // If the user doesn't specify the event type in the source definition, then the user @@ -188,18 +188,18 @@ mod tests { use anyhow::Result; use super::*; - use crate::source::nexmark::{NexmarkPropertiesInner, NexmarkSplitEnumerator}; + use crate::source::nexmark::{NexmarkProperties, NexmarkSplitEnumerator}; use crate::source::{SourceEnumeratorContext, SplitEnumerator}; #[tokio::test] async fn test_nexmark_split_reader() -> Result<()> { - let props = Box::new(NexmarkPropertiesInner { + let props = NexmarkProperties { split_num: 2, min_event_gap_in_ns: 0, table_type: Some(EventType::Bid), max_chunk_size: 5, ..Default::default() - }); + }; let mut enumerator = NexmarkSplitEnumerator::new(props.clone(), SourceEnumeratorContext::default().into())