-
Notifications
You must be signed in to change notification settings - Fork 738
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
Add begin/end_transaction methods in FlightSqlServiceClient #6026
Conversation
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.
Looks good to me -- thank you @lewiszlw
Could you please add basic integration tests for this code (that shows the data correctly making it from the client to the server)?
I think an example of such a test is here.
arrow-rs/arrow-flight/tests/client.rs
Lines 46 to 70 in eb2d00b
#[tokio::test] | |
async fn test_handshake() { | |
do_test(|test_server, mut client| async move { | |
client.add_header("foo-header", "bar-header-value").unwrap(); | |
let request_payload = Bytes::from("foo-request-payload"); | |
let response_payload = Bytes::from("bar-response-payload"); | |
let request = HandshakeRequest { | |
payload: request_payload.clone(), | |
protocol_version: 0, | |
}; | |
let response = HandshakeResponse { | |
payload: response_payload.clone(), | |
protocol_version: 0, | |
}; | |
test_server.set_handshake_response(Ok(response)); | |
let response = client.handshake(request_payload).await.unwrap(); | |
assert_eq!(response, response_payload); | |
assert_eq!(test_server.take_handshake_request(), Some(request)); | |
ensure_metadata(&client, &test_server); | |
}) | |
.await; | |
} |
Though that looks like it is only for FlightServiceClient
rather than the FlightSqlServiceClient
🤔
@@ -399,6 +403,54 @@ impl FlightSqlServiceClient<Channel> { | |||
)) | |||
} | |||
|
|||
/// Request to begin a transaction. | |||
pub async fn begin_transaction(&mut self) -> Result<Bytes, ArrowError> { |
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 was wondering if there were any parameters that should be passed to this function, but I see the underlying message doesn't have any either so this makes sense to me
I added a test in |
Yeah, it seems like flight_sql_client_cli.rs is slowly becoming the test for the |
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
@@ -318,244 +358,6 @@ impl FlightSqlService for FlightSqlServiceImpl { | |||
Ok(resp) | |||
} | |||
|
|||
async fn get_flight_info_substrait_plan( |
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 all have default impls, so it is ok to remove them, right?
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.
Thanks again @lewiszlw |
Which issue does this PR close?
Closes #.
Rationale for this change
FlightSqlService
suppots transaction feature, so add some helper methods for client.What changes are included in this PR?
Are there any user-facing changes?