@@ -1412,6 +1412,27 @@ def test_flight_generator_stream_of_batches():
14121412 assert result .equals (data )
14131413
14141414
1415+ def test_flight_generator_stream_of_batches_with_dict ():
1416+ """
1417+ Try downloading a flight of RecordBatches with dictionaries
1418+ in a GeneratorStream.
1419+ """
1420+ data = pa .Table .from_arrays ([
1421+ pa .array (["foo" , "bar" , "baz" , "foo" , "foo" ],
1422+ pa .dictionary (pa .int64 (), pa .utf8 ())),
1423+ pa .array ([123 , 234 , 345 , 456 , 567 ])
1424+ ], names = ['a' , 'b' ])
1425+
1426+ with EchoRecordBatchReaderStreamFlightServer () as server , \
1427+ FlightClient (('localhost' , server .port )) as client :
1428+ writer , _ = client .do_put (flight .FlightDescriptor .for_path ('test' ),
1429+ data .schema )
1430+ writer .write_table (data )
1431+ writer .close ()
1432+ result = client .do_get (flight .Ticket (b'' )).read_all ()
1433+ assert result .equals (data )
1434+
1435+
14151436def test_flight_generator_stream_of_table ():
14161437 """Try downloading a flight of Table in a GeneratorStream."""
14171438 data = pa .Table .from_arrays ([
@@ -1428,6 +1449,27 @@ def test_flight_generator_stream_of_table():
14281449 assert result .equals (data )
14291450
14301451
1452+ def test_flight_generator_stream_of_table_with_dict ():
1453+ """
1454+ Try downloading a flight of Table with dictionaries
1455+ in a GeneratorStream.
1456+ """
1457+ data = pa .Table .from_arrays ([
1458+ pa .array (["foo" , "bar" , "baz" , "foo" , "foo" ],
1459+ pa .dictionary (pa .int64 (), pa .utf8 ())),
1460+ pa .array ([123 , 234 , 345 , 456 , 567 ])
1461+ ], names = ['a' , 'b' ])
1462+
1463+ with EchoRecordBatchReaderStreamFlightServer () as server , \
1464+ FlightClient (('localhost' , server .port )) as client :
1465+ writer , _ = client .do_put (flight .FlightDescriptor .for_path ('test' ),
1466+ data .schema )
1467+ writer .write_table (data )
1468+ writer .close ()
1469+ result = client .do_get (flight .Ticket (b'' )).read_all ()
1470+ assert result .equals (data )
1471+
1472+
14311473def test_flight_generator_stream_of_record_batch_reader ():
14321474 """Try downloading a flight of RecordBatchReader in a GeneratorStream."""
14331475 data = pa .Table .from_arrays ([
@@ -1444,6 +1486,27 @@ def test_flight_generator_stream_of_record_batch_reader():
14441486 assert result .equals (data )
14451487
14461488
1489+ def test_flight_generator_stream_of_record_batch_reader_with_dict ():
1490+ """
1491+ Try downloading a flight of RecordBatchReader with dictionaries
1492+ in a GeneratorStream.
1493+ """
1494+ data = pa .Table .from_arrays ([
1495+ pa .array (["foo" , "bar" , "baz" , "foo" , "foo" ],
1496+ pa .dictionary (pa .int64 (), pa .utf8 ())),
1497+ pa .array ([123 , 234 , 345 , 456 , 567 ])
1498+ ], names = ['a' , 'b' ])
1499+
1500+ with EchoRecordBatchReaderStreamFlightServer () as server , \
1501+ FlightClient (('localhost' , server .port )) as client :
1502+ writer , _ = client .do_put (flight .FlightDescriptor .for_path ('test' ),
1503+ data .schema )
1504+ writer .write_table (data )
1505+ writer .close ()
1506+ result = client .do_get (flight .Ticket (b'' )).read_all ()
1507+ assert result .equals (data )
1508+
1509+
14471510def test_flight_invalid_generator_stream ():
14481511 """Try streaming data with mismatched schemas."""
14491512 with InvalidStreamFlightServer () as server , \
0 commit comments