apache / apache/arrow

[Python][FlightRPC] FlightServer get_schema raises an error if it returns a Schema instance, requires a SchemaResult

Open
#36,267 0 comments 0 reactions 0 assignees View on GitHub
Component: FlightRPC Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

When a user is designing a get_schema() method for a FlightServer, the expected usage is that it should return a "schema" instance, as it says on the docs. However, the code actually raises an error if a schema is returned, and requires you to return an instance of SchemaResult.

The bug is caused by lines 2059-262 of pyarrow._flight, in the method _get_schema:

```
if not isinstance(result, SchemaResult):
raise TypeError("FlightServerBase.get_schema_info must return "
"a SchemaResult instance, but got {}".format(
type(result)))
```

I think this could be corrected by changing SchemaResult to Schema, and parsing the Schema as a SchemaResult internally.

### Component(s)

FlightRPC

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.