@@ -428,3 +428,29 @@ def test_empty_file(path, use_threads):
428428 df2 = wr .s3 .read_parquet (path , dataset = True , use_threads = use_threads )
429429 df2 ["par" ] = df2 ["par" ].astype ("string" )
430430 assert df .equals (df2 )
431+
432+
433+ def test_read_chunked (path ):
434+ path = f"{ path } file.parquet"
435+ df = pd .DataFrame ({"c0" : [0 , 1 , 2 ], "c1" : [None , None , None ]})
436+ wr .s3 .to_parquet (df , path )
437+ df2 = next (wr .s3 .read_parquet (path , chunked = True ))
438+ assert df .shape == df2 .shape
439+
440+
441+ def test_read_chunked_validation_exception (path ):
442+ path = f"{ path } file.parquet"
443+ df = pd .DataFrame ({"c0" : [0 , 1 , 2 ], "c1" : [None , None , None ]})
444+ wr .s3 .to_parquet (df , path )
445+ with pytest .raises (wr .exceptions .UndetectedType ):
446+ next (wr .s3 .read_parquet (path , chunked = True , validate_schema = True ))
447+
448+
449+ def test_read_chunked_validation_exception2 (path ):
450+ df = pd .DataFrame ({"c0" : [0 , 1 , 2 ]})
451+ wr .s3 .to_parquet (df , f"{ path } file0.parquet" )
452+ df = pd .DataFrame ({"c1" : [0 , 1 , 2 ]})
453+ wr .s3 .to_parquet (df , f"{ path } file1.parquet" )
454+ with pytest .raises (wr .exceptions .InvalidSchemaConvergence ):
455+ for _ in wr .s3 .read_parquet (path , dataset = True , chunked = True , validate_schema = True ):
456+ pass
0 commit comments