You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "istvan-fodor (via GitHub)" <gi...@apache.org> on 2024/04/18 15:55:17 UTC
[I] Arrow RS Flight SQL + JDBC [arrow-rs]
istvan-fodor opened a new issue, #5662:
URL: https://github.com/apache/arrow-rs/issues/5662
**Which part is this question about**
The Arrow Flight SQL example server.
**Describe your question**
I have been trying to get the Rust Arrow Flight SQL example server to work with the Arrow JDBC driver and I have been running into multiple issues. I wanted to check if anybody was ever able to get the Rust server to work nicely with the Java / Arrow JDBC driver.
1. The first issue I faced was authentication (it is more of na FYI in the arrow-rs context). It looks like after a successful handshake call the driver didn't include the authorization header in subsequent calls. This question is tracked here: https://lists.apache.org/thread/ww4bc9jrb9r81xmwc9rnzvbl29650pkc. Sharing it here as well, just in case anybody has an idea of what might be wrong, as that thread is pretty silent so far.
2. If I comment out the logic in `check_token` to just return ` Ok(())` all the time in the Rust code I see that whenever the driver tries to run a query, it runs into a loop. In ngrep I caught roughly this pattern:
```
arrow.flight.protocol.FlightService/Handshake
arrow.flight.protocol.sql.ActionCreatePreparedStatementRequest
(
arrow.flight.protocol.sql.CreatePreparedStatement
arrow.flight.protocol.sql.CommandPreparedStatementQuery
arrow.flight.protocol.sql.FetchResults
) x5
```
Eventually on the Java side I see this error:
```
java.sql.SQLException: Error while executing SQL "SELECT 1": Failed to successfully execute query after 5 attempts.
at org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.Helper.createException(Helper.java:56)
at org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:235)
at com.fusiongrid.App.main(App.java:29)
at org.codehaus.mojo.exec.ExecJavaMojo.doMain(ExecJavaMojo.java:385)
at org.codehaus.mojo.exec.ExecJavaMojo.doExec(ExecJavaMojo.java:374)
at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0(ExecJavaMojo.java:296)
at java.base/java.lang.Thread.run(Thread.java:1570)
Caused by: java.lang.RuntimeException: Failed to successfully execute query after 5 attempts.
at org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:168)
at org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
... 5 more
```
I wanted to check if there is any known circumstance that might cause the server to return a faulty response somewhere that throws the driver into the loop and makes it bomb out after 5 tries?
**Additional context**
I tried JDBC driver versions 15.0.2 and 16.0.0-SNAPSHOT. For the example server I just took whatever was latest on the arrow-rs master branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Arrow RS Flight SQL + JDBC [arrow-rs]
Posted by "istvan-fodor (via GitHub)" <gi...@apache.org>.
istvan-fodor commented on issue #5662:
URL: https://github.com/apache/arrow-rs/issues/5662#issuecomment-2066651382
2. was caused by #5669.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Arrow RS Flight SQL + JDBC [arrow-rs]
Posted by "istvan-fodor (via GitHub)" <gi...@apache.org>.
istvan-fodor commented on issue #5662:
URL: https://github.com/apache/arrow-rs/issues/5662#issuecomment-2064639084
Update on the first issue (see [discussion](https://lists.apache.org/thread/66zd5k3l63vrztjjmgzdh3xm389cbkbk)). It looks like that the expectation would be to set the authorization header on the response. I took a look at the `FlightSqlServiceClient` and it looks like the authorization header is indeed expected in the handshake response:
```rust
let resp = self
.flight_client
.handshake(req)
.await
.map_err(|e| ArrowError::IpcError(format!("Can't handshake {e}")))?;
if let Some(auth) = resp.metadata().get("authorization") {
let auth = auth
.to_str()
.map_err(|_| ArrowError::ParseError("Can't read auth header".to_string()))?;
let bearer = "Bearer ";
if !auth.starts_with(bearer) {
Err(ArrowError::ParseError("Invalid auth header!".to_string()))?;
}
let auth = auth[bearer.len()..].to_string();
self.token = Some(auth);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Arrow RS Flight SQL + JDBC [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on issue #5662:
URL: https://github.com/apache/arrow-rs/issues/5662#issuecomment-2079450412
I think this is resolved by #5666
Feel free to re-open if this isn't the case :+1:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Arrow RS Flight SQL + JDBC [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed issue #5662: Arrow RS Flight SQL + JDBC
URL: https://github.com/apache/arrow-rs/issues/5662
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org