MCPcopy Create free account
hub / github.com/apache/arrow / ConstantFlightServer

Class ConstantFlightServer

python/pyarrow/tests/test_flight.py:138–169  ·  view source on GitHub ↗

A Flight server that always returns the same data. See ARROW-4796: this server implementation will segfault if Flight does not properly hold a reference to the Table object.

Source from the content-addressed store, hash-verified

136
137
138class ConstantFlightServer(FlightServerBase):
139 """A Flight server that always returns the same data.
140
141 See ARROW-4796: this server implementation will segfault if Flight
142 does not properly hold a reference to the Table object.
143 """
144
145 CRITERIA = b"the expected criteria"
146
147 def __init__(self, location=None, options=None, **kwargs):
148 super().__init__(location, **kwargs)
149 # Ticket -> Table
150 self.table_factories = {
151 b'ints': simple_ints_table,
152 b'dicts': simple_dicts_table,
153 b'multi': multiple_column_table,
154 }
155 self.options = options
156
157 def list_flights(self, context, criteria):
158 if criteria == self.CRITERIA:
159 yield flight.FlightInfo(
160 pa.schema([]),
161 flight.FlightDescriptor.for_path('/foo'),
162 []
163 )
164
165 def do_get(self, context, ticket):
166 # Return a fresh table, so that Flight is the only one keeping a
167 # reference.
168 table = self.table_factories[ticket.ticket]()
169 return flight.RecordBatchStream(table, options=self.options)
170
171
172class MetadataFlightServer(FlightServerBase):

Callers 15

test_flight_list_flightsFunction · 0.85
test_flight_client_closeFunction · 0.85
test_flight_do_get_intsFunction · 0.85
test_do_get_ints_pandasFunction · 0.85
test_flight_do_get_dictsFunction · 0.85
test_timeout_passesFunction · 0.85
test_read_optionsFunction · 0.85
test_location_invalidFunction · 0.85
test_tls_failsFunction · 0.85
test_tls_do_getFunction · 0.85

Calls

no outgoing calls

Tested by 15

test_flight_list_flightsFunction · 0.68
test_flight_client_closeFunction · 0.68
test_flight_do_get_intsFunction · 0.68
test_do_get_ints_pandasFunction · 0.68
test_flight_do_get_dictsFunction · 0.68
test_timeout_passesFunction · 0.68
test_read_optionsFunction · 0.68
test_location_invalidFunction · 0.68
test_tls_failsFunction · 0.68
test_tls_do_getFunction · 0.68