lxyzxx commented on code in PR #4290:
URL: https://github.com/apache/arrow-adbc/pull/4290#discussion_r3232907520
##########
java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlConnection.java:
##########
@@ -262,54 +276,91 @@ private FlightClient createInitialConnection(
}
}
- // Build the client using the above properties.
- final FlightClient client = buildClient(location);
-
// Add user-specified headers.
ArrayList<CallOption> options = new ArrayList<>();
final FlightCallHeaders callHeaders = new FlightCallHeaders();
- for (Map.Entry<String, Object> parameter : parameters.entrySet()) {
- if
(parameter.getKey().startsWith(FlightSqlConnectionProperties.RPC_CALL_HEADER_PREFIX))
{
- String userHeaderName =
- parameter
- .getKey()
-
.substring(FlightSqlConnectionProperties.RPC_CALL_HEADER_PREFIX.length());
-
- if (parameter.getValue() instanceof String) {
- callHeaders.insert(userHeaderName, (String) parameter.getValue());
- } else if (parameter.getValue() instanceof byte[]) {
- callHeaders.insert(userHeaderName, (byte[]) parameter.getValue());
- } else {
- throw new AdbcException(
- String.format(
- "Header values must be String or byte[]. The header failing
was %s.",
- parameter.getKey()),
- null,
- AdbcStatusCode.INVALID_ARGUMENT,
- null,
- 0);
+ String authorizationHeader = null;
+ String username = null;
+ String password = null;
+ String oauthFlow = null;
+ if (parameters != null) {
+ for (Map.Entry<String, Object> parameter : parameters.entrySet()) {
+ if
(parameter.getKey().startsWith(FlightSqlConnectionProperties.RPC_CALL_HEADER_PREFIX))
{
+ String userHeaderName =
+ parameter
+ .getKey()
+
.substring(FlightSqlConnectionProperties.RPC_CALL_HEADER_PREFIX.length());
+
+ if (parameter.getValue() instanceof String) {
+ callHeaders.insert(userHeaderName, (String) parameter.getValue());
+ } else if (parameter.getValue() instanceof byte[]) {
+ callHeaders.insert(userHeaderName, (byte[]) parameter.getValue());
+ } else {
+ throw new AdbcException(
+ String.format(
+ "Header values must be String or byte[]. The header
failing was %s.",
+ parameter.getKey()),
+ null,
+ AdbcStatusCode.INVALID_ARGUMENT,
+ null,
+ 0);
+ }
Review Comment:
I kept Flight client creation unchanged in this PR to avoid a broader
refactor. This update only moves OAuth provider creation to Arrow Java; using
or decoupling `ArrowFlightSqlClientHandler.Builder` can be a follow-up.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]