Skip to content

Conversation

@lewiszlw
Copy link
Member

Which issue does this PR close?

None.

Rationale for this change

  1. Keep consistent with FlightClient.
  2. We need inner error (for example tonic::Status) to know if we should retry, but ArrowError stores string of tonic::Status.

What changes are included in this PR?

  1. Let flight sql client returns FlightError .
  2. Cleanup code.

Are these changes tested?

CI

Are there any user-facing changes?

Yes.

@github-actions github-actions bot added arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate labels Nov 24, 2025
Copy link
Contributor

@alamb alamb left a 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?

.handshake(req)
.await
.map_err(|e| ArrowError::IpcError(format!("Can't handshake {e}")))?;
let resp = self.flight_client.handshake(req).await?;
Copy link
Contributor

@alamb alamb Dec 10, 2025

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?

Copy link
Member Author

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> {
Copy link
Contributor

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

Copy link
Member Author

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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back.

@alamb alamb added the api-change Changes to the arrow API label Dec 10, 2025
Copy link
Contributor

@alamb alamb left a 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

@alamb alamb changed the title Let flight sql client returns FlightError & cleanup code Change FlightSQLClient to return FlightError & cleanup code Jan 9, 2026
@alamb alamb merged commit 298d3aa into apache:main Jan 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change Changes to the arrow API arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants