phoebey01 opened a new issue, #38480:
URL: https://github.com/apache/arrow/issues/38480
### Describe the bug, including details regarding any error messages,
version, and platform.
Seeing the following error from the Flight client side when calling
reader.read_all()
`
ArrowInvalid: IPC stream did not have the expected number (1) of
dictionaries at the start of the stream
table.column_names
`
The issue is only observed when:
1. the server returns a "GeneratorStream" instead of "RecordBatchStream"
2. the table contains column of Categorical / DictionaryArray type
Server.py:
```
import pyarrow as pa
from pyarrow.flight import FlightServerBase, Location, ServerCallContext,
Ticket, GeneratorStream
import pandas as pd
class FlightServer(FlightServerBase):
def __init__(self, host, port):
super().__init__(Location.for_grpc_tcp(host, port))
def do_get(self, context: ServerCallContext, ticket: Ticket):
df = pd.DataFrame.from_dict({
'col_1': pd.Categorical(['a', 'b', 'c', 'a', 'b', 'c'])
})
table = pa.Table.from_pandas(df)
return GeneratorStream(schema=table.schema,
generator=table.to_batches())
# return RecordBatchStream(table) -> this doesnt have issue
if __name__ == '__main__':
server = FlightServer('0.0.0.0', 7688)
print(f'Starting Flight server {server.port}')
server.serve()
```
Client.py
```
from pyarrow.flight import Location, FlightClient
location = Location.for_grpc_tcp('0.0.0.0', 7688)
client = FlightClient(location)
from pyarrow.flight import Ticket
ticket = Ticket('')
reader = client.do_get(ticket)
reader.read_all()
```
### Component(s)
FlightRPC, Python
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]