-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change FlightSQLClient to return FlightError & cleanup code
#8916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lewiszlw -- this does make things look nicer 👌
Since it is an API change (change of error types) we'll have to wait for the next major release.
Could you move the change to arrow_data_from_flight_data into its own PR (and deprecate it first, rather than just remove it, along with a note about what API to use instead?
arrow-flight/src/sql/client.rs
Outdated
| .handshake(req) | ||
| .await | ||
| .map_err(|e| ArrowError::IpcError(format!("Can't handshake {e}")))?; | ||
| let resp = self.flight_client.handshake(req).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding context that the error was happening in the the handshake (rather than just passing along the generic service laer) was useful context, but has been lost in this refactoring.
Is there any way to add it back without losing access to the inner tonic status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find easy way to do this. Restored this change first.
| /// a token for future requests. Any other data returned by the server in the handshake | ||
| /// response is returned as a binary blob. | ||
| pub async fn handshake(&mut self, username: &str, password: &str) -> Result<Bytes, ArrowError> { | ||
| pub async fn handshake(&mut self, username: &str, password: &str) -> Result<Bytes> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a breaking API change I believe -- the result used to be ArrowError and is now FlightError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. FlightSqlServiceClient's methods now return FlightError instead of ArrowError.
| } | ||
|
|
||
| /// Extract `Schema` or `RecordBatch`es from the `FlightData` wire representation | ||
| pub fn arrow_data_from_flight_data( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public function - https://docs.rs/arrow-flight/latest/arrow_flight/sql/client/fn.arrow_data_from_flight_data.html
I recommend we deprecate it first and then remove it in the future:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added back.
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement in my mind -- thank you @lewiszlw
FlightError & cleanup codeFlightError & cleanup code
Which issue does this PR close?
None.
Rationale for this change
FlightClient.tonic::Status) to know if we should retry, but ArrowError stores string oftonic::Status.What changes are included in this PR?
FlightError.Are these changes tested?
CI
Are there any user-facing changes?
Yes.