@@ -81,7 +81,7 @@ pub async fn ingest_internal_stream(stream_name: String, body: Bytes) -> Result<
8181 let size: usize = body. len ( ) ;
8282 let parsed_timestamp = Utc :: now ( ) . naive_utc ( ) ;
8383 let ( rb, is_first) = {
84- let body_val : Value = serde_json:: from_slice ( & body) ?;
84+ let json : Value = serde_json:: from_slice ( & body) ?;
8585 let hash_map = PARSEABLE . streams . read ( ) . unwrap ( ) ;
8686 let schema = hash_map
8787 . get ( & stream_name)
@@ -91,7 +91,7 @@ pub async fn ingest_internal_stream(stream_name: String, body: Bytes) -> Result<
9191 . expect ( LOCK_EXPECT )
9292 . schema
9393 . clone ( ) ;
94- let event = format:: json:: Event { data : body_val } ;
94+ let event = format:: json:: Event { json } ;
9595 // For internal streams, use old schema
9696 event. into_recordbatch ( & schema, false , None , SchemaVersion :: V0 ) ?
9797 } ;
@@ -355,7 +355,7 @@ mod tests {
355355 use std:: { collections:: HashMap , sync:: Arc } ;
356356
357357 use crate :: {
358- handlers :: http :: modal :: utils :: ingest_utils :: into_event_batch ,
358+ event :: format :: { json , EventFormat } ,
359359 metadata:: SchemaVersion ,
360360 utils:: json:: { convert_array_to_object, flatten:: convert_to_array} ,
361361 } ;
@@ -392,8 +392,9 @@ mod tests {
392392 "b" : "hello" ,
393393 } ) ;
394394
395- let ( rb, _) =
396- into_event_batch ( json, HashMap :: default ( ) , false , None , SchemaVersion :: V0 ) . unwrap ( ) ;
395+ let ( rb, _) = json:: Event { json }
396+ . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
397+ . unwrap ( ) ;
397398
398399 assert_eq ! ( rb. num_rows( ) , 1 ) ;
399400 assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -419,8 +420,9 @@ mod tests {
419420 "c" : null
420421 } ) ;
421422
422- let ( rb, _) =
423- into_event_batch ( json, HashMap :: default ( ) , false , None , SchemaVersion :: V0 ) . unwrap ( ) ;
423+ let ( rb, _) = json:: Event { json }
424+ . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
425+ . unwrap ( ) ;
424426
425427 assert_eq ! ( rb. num_rows( ) , 1 ) ;
426428 assert_eq ! ( rb. num_columns( ) , 3 ) ;
@@ -450,7 +452,9 @@ mod tests {
450452 . into_iter ( ) ,
451453 ) ;
452454
453- let ( rb, _) = into_event_batch ( json, schema, false , None , SchemaVersion :: V0 ) . unwrap ( ) ;
455+ let ( rb, _) = json:: Event { json }
456+ . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 )
457+ . unwrap ( ) ;
454458
455459 assert_eq ! ( rb. num_rows( ) , 1 ) ;
456460 assert_eq ! ( rb. num_columns( ) , 3 ) ;
@@ -480,7 +484,9 @@ mod tests {
480484 . into_iter ( ) ,
481485 ) ;
482486
483- assert ! ( into_event_batch( json, schema, false , None , SchemaVersion :: V0 , ) . is_err( ) ) ;
487+ assert ! ( json:: Event { json }
488+ . into_recordbatch( & schema, false , None , SchemaVersion :: V0 , )
489+ . is_err( ) ) ;
484490 }
485491
486492 #[ test]
@@ -496,7 +502,9 @@ mod tests {
496502 . into_iter ( ) ,
497503 ) ;
498504
499- let ( rb, _) = into_event_batch ( json, schema, false , None , SchemaVersion :: V0 ) . unwrap ( ) ;
505+ let ( rb, _) = json:: Event { json }
506+ . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 )
507+ . unwrap ( ) ;
500508
501509 assert_eq ! ( rb. num_rows( ) , 1 ) ;
502510 assert_eq ! ( rb. num_columns( ) , 1 ) ;
@@ -535,8 +543,9 @@ mod tests {
535543 } ,
536544 ] ) ;
537545
538- let ( rb, _) =
539- into_event_batch ( json, HashMap :: default ( ) , false , None , SchemaVersion :: V0 ) . unwrap ( ) ;
546+ let ( rb, _) = json:: Event { json }
547+ . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
548+ . unwrap ( ) ;
540549
541550 assert_eq ! ( rb. num_rows( ) , 3 ) ;
542551 assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -582,8 +591,9 @@ mod tests {
582591 } ,
583592 ] ) ;
584593
585- let ( rb, _) =
586- into_event_batch ( json, HashMap :: default ( ) , false , None , SchemaVersion :: V0 ) . unwrap ( ) ;
594+ let ( rb, _) = json:: Event { json }
595+ . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
596+ . unwrap ( ) ;
587597
588598 assert_eq ! ( rb. num_rows( ) , 3 ) ;
589599 assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -630,7 +640,9 @@ mod tests {
630640 . into_iter ( ) ,
631641 ) ;
632642
633- let ( rb, _) = into_event_batch ( json, schema, false , None , SchemaVersion :: V0 ) . unwrap ( ) ;
643+ let ( rb, _) = json:: Event { json }
644+ . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 )
645+ . unwrap ( ) ;
634646
635647 assert_eq ! ( rb. num_rows( ) , 3 ) ;
636648 assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -677,7 +689,9 @@ mod tests {
677689 . into_iter ( ) ,
678690 ) ;
679691
680- assert ! ( into_event_batch( json, schema, false , None , SchemaVersion :: V0 , ) . is_err( ) ) ;
692+ assert ! ( json:: Event { json }
693+ . into_recordbatch( & schema, false , None , SchemaVersion :: V0 , )
694+ . is_err( ) ) ;
681695 }
682696
683697 #[ test]
@@ -715,13 +729,10 @@ mod tests {
715729 )
716730 . unwrap ( ) ;
717731
718- let ( rb, _) = into_event_batch (
719- flattened_json,
720- HashMap :: default ( ) ,
721- false ,
722- None ,
723- SchemaVersion :: V0 ,
724- )
732+ let ( rb, _) = json:: Event {
733+ json : flattened_json,
734+ }
735+ . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
725736 . unwrap ( ) ;
726737 assert_eq ! ( rb. num_rows( ) , 4 ) ;
727738 assert_eq ! ( rb. num_columns( ) , 5 ) ;
@@ -803,13 +814,10 @@ mod tests {
803814 )
804815 . unwrap ( ) ;
805816
806- let ( rb, _) = into_event_batch (
807- flattened_json,
808- HashMap :: default ( ) ,
809- false ,
810- None ,
811- SchemaVersion :: V1 ,
812- )
817+ let ( rb, _) = json:: Event {
818+ json : flattened_json,
819+ }
820+ . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V1 )
813821 . unwrap ( ) ;
814822
815823 assert_eq ! ( rb. num_rows( ) , 4 ) ;
0 commit comments