@@ -472,19 +472,30 @@ mod tests {
472472 }
473473
474474 #[ tokio:: test]
475- async fn test_infer_schema_stream_separated_chunks_with_nulls ( ) -> Result < ( ) > {
475+ async fn test_infer_schema_stream_null_chunks ( ) -> Result < ( ) > {
476476 let session_ctx = SessionContext :: new ( ) ;
477477 let state = session_ctx. state ( ) ;
478- let variable_object_store = Arc :: new ( VariableStream :: new (
479- Bytes :: from (
480- r#"c1,c2
481- 1,1.0
482- ,
478+
479+ // a stream where each line is read as a separate chunk,
480+ // data type for each chunk is inferred separately.
481+ // +----+-----+----+
482+ // | c1 | c2 | c3 |
483+ // +----+-----+----+
484+ // | 1 | 1.0 | | type: Int64, Float64, Null
485+ // | | | | type: Null, Null, Null
486+ // +----+-----+----+
487+ let chunked_object_store = Arc :: new ( ChunkedStore :: new (
488+ Arc :: new ( VariableStream :: new (
489+ Bytes :: from (
490+ r#"c1,c2,c3
491+ 1,1.0,
492+ ,,
483493"# ,
484- ) ,
494+ ) ,
495+ 1 ,
496+ ) ) ,
485497 1 ,
486498 ) ) ;
487- let chunked_object_store = Arc :: new ( ChunkedStore :: new ( variable_object_store, 1 ) ) ;
488499 let object_meta = ObjectMeta {
489500 location : Path :: parse ( "/" ) ?,
490501 last_modified : DateTime :: default ( ) ,
@@ -508,7 +519,8 @@ mod tests {
508519 . map ( |f| format ! ( "{}: {:?}" , f. name( ) , f. data_type( ) ) )
509520 . collect ( ) ;
510521
511- assert_eq ! ( vec![ "c1: Int64" , "c2: Float64" ] , actual_fields) ;
522+ // ensure null chunks don't skew type inference
523+ assert_eq ! ( vec![ "c1: Int64" , "c2: Float64" , "c3: Null" ] , actual_fields) ;
512524 Ok ( ( ) )
513525 }
514526
0 commit comments