@@ -81,7 +81,7 @@ pub async fn ingest_internal_stream(stream_name: String, body: Bytes) -> Result<
81
81
let size: usize = body. len ( ) ;
82
82
let parsed_timestamp = Utc :: now ( ) . naive_utc ( ) ;
83
83
let ( rb, is_first) = {
84
- let body_val : Value = serde_json:: from_slice ( & body) ?;
84
+ let json : Value = serde_json:: from_slice ( & body) ?;
85
85
let hash_map = PARSEABLE . streams . read ( ) . unwrap ( ) ;
86
86
let schema = hash_map
87
87
. get ( & stream_name)
@@ -91,7 +91,7 @@ pub async fn ingest_internal_stream(stream_name: String, body: Bytes) -> Result<
91
91
. expect ( LOCK_EXPECT )
92
92
. schema
93
93
. clone ( ) ;
94
- let event = format:: json:: Event { data : body_val } ;
94
+ let event = format:: json:: Event { json } ;
95
95
// For internal streams, use old schema
96
96
event. into_recordbatch ( & schema, false , None , SchemaVersion :: V0 ) ?
97
97
} ;
@@ -355,7 +355,7 @@ mod tests {
355
355
use std:: { collections:: HashMap , sync:: Arc } ;
356
356
357
357
use crate :: {
358
- handlers :: http :: modal :: utils :: ingest_utils :: into_event_batch ,
358
+ event :: format :: { json , EventFormat } ,
359
359
metadata:: SchemaVersion ,
360
360
utils:: json:: { convert_array_to_object, flatten:: convert_to_array} ,
361
361
} ;
@@ -392,8 +392,9 @@ mod tests {
392
392
"b" : "hello" ,
393
393
} ) ;
394
394
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 ( ) ;
397
398
398
399
assert_eq ! ( rb. num_rows( ) , 1 ) ;
399
400
assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -419,8 +420,9 @@ mod tests {
419
420
"c" : null
420
421
} ) ;
421
422
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 ( ) ;
424
426
425
427
assert_eq ! ( rb. num_rows( ) , 1 ) ;
426
428
assert_eq ! ( rb. num_columns( ) , 3 ) ;
@@ -450,7 +452,9 @@ mod tests {
450
452
. into_iter ( ) ,
451
453
) ;
452
454
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 ( ) ;
454
458
455
459
assert_eq ! ( rb. num_rows( ) , 1 ) ;
456
460
assert_eq ! ( rb. num_columns( ) , 3 ) ;
@@ -480,7 +484,9 @@ mod tests {
480
484
. into_iter ( ) ,
481
485
) ;
482
486
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( ) ) ;
484
490
}
485
491
486
492
#[ test]
@@ -496,7 +502,9 @@ mod tests {
496
502
. into_iter ( ) ,
497
503
) ;
498
504
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 ( ) ;
500
508
501
509
assert_eq ! ( rb. num_rows( ) , 1 ) ;
502
510
assert_eq ! ( rb. num_columns( ) , 1 ) ;
@@ -535,8 +543,9 @@ mod tests {
535
543
} ,
536
544
] ) ;
537
545
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 ( ) ;
540
549
541
550
assert_eq ! ( rb. num_rows( ) , 3 ) ;
542
551
assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -582,8 +591,9 @@ mod tests {
582
591
} ,
583
592
] ) ;
584
593
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 ( ) ;
587
597
588
598
assert_eq ! ( rb. num_rows( ) , 3 ) ;
589
599
assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -630,7 +640,9 @@ mod tests {
630
640
. into_iter ( ) ,
631
641
) ;
632
642
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 ( ) ;
634
646
635
647
assert_eq ! ( rb. num_rows( ) , 3 ) ;
636
648
assert_eq ! ( rb. num_columns( ) , 4 ) ;
@@ -677,7 +689,9 @@ mod tests {
677
689
. into_iter ( ) ,
678
690
) ;
679
691
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( ) ) ;
681
695
}
682
696
683
697
#[ test]
@@ -715,13 +729,10 @@ mod tests {
715
729
)
716
730
. unwrap ( ) ;
717
731
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 )
725
736
. unwrap ( ) ;
726
737
assert_eq ! ( rb. num_rows( ) , 4 ) ;
727
738
assert_eq ! ( rb. num_columns( ) , 5 ) ;
@@ -803,13 +814,10 @@ mod tests {
803
814
)
804
815
. unwrap ( ) ;
805
816
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 )
813
821
. unwrap ( ) ;
814
822
815
823
assert_eq ! ( rb. num_rows( ) , 4 ) ;
0 commit comments