Make it easier to match FlightSQL messages #3874
Labels
arrow
Changes to the arrow crate
arrow-flight
Changes to the arrow-flight crate
enhancement
Any new improvement worthy of a entry in the changelog
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
When implementing FlightSQL the do_get and get_flight_info gRPC methods are called for several of the message types. Thus those endpoints need to decode the incoming message and then do the appropriate action
However, the current way the messages are decoded from
prost::Any
means the only way I have figured out how to check dynamically for each message type is anif
chain like thisIt would be great to have an enum so a rust
match
statement could be usedDescribe alternatives you've considered
@stuartcarnie proposed the following in https://github.com/influxdata/influxdb_iox/pull/7213/files#r1137963627:
I created a gist that extends the sql crate in arrow-flight, that demonstrates an approach allowing us to remove all the
if Some(..)
to a single match:I extended the
prost_message_ext
macro to create aCommands
enum with all the messages passed to the macro. TheCommands
macro has a static function,unpack
, that is capable of unpacking any of the registered messages.Additional context
The text was updated successfully, but these errors were encountered: