Skip to content

Commit 975b1f6

Browse files
author
Devdutt Shenoi
committed
construct map directly
1 parent 7215e8e commit 975b1f6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/handlers/http/ingest.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,22 +242,23 @@ pub async fn push_logs_unchecked(
242242
rb: RecordBatch,
243243
stream: &Stream,
244244
) -> Result<event::Event, PostError> {
245-
let mut unchecked_event = event::Event {
245+
let unchecked_event = event::Event {
246246
origin_format: "json",
247247
origin_size: 0,
248248
time_partition: None,
249249
is_first_event: true, // NOTE: Maybe should be false
250-
partitions: HashMap::new(),
250+
partitions: [(
251+
get_schema_key(&rb.schema().fields),
252+
PartitionEvent {
253+
rb,
254+
parsed_timestamp: Utc::now().naive_utc(),
255+
custom_partition_values: HashMap::new(), // should be an empty map for unchecked push
256+
},
257+
)]
258+
.into_iter()
259+
.collect(),
251260
stream_type: StreamType::UserDefined,
252261
};
253-
unchecked_event.partitions.insert(
254-
get_schema_key(&rb.schema().fields),
255-
PartitionEvent {
256-
rb,
257-
parsed_timestamp: Utc::now().naive_utc(),
258-
custom_partition_values: HashMap::new(), // should be an empty map for unchecked push
259-
},
260-
);
261262

262263
unchecked_event.process_unchecked(stream)?;
263264

0 commit comments

Comments
 (0)