This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/spark-connect-swift.git
The following commit(s) were added to refs/heads/main by this push: new faae9a3 [SPARK-51864] Rename parameters and support case-insensitively faae9a3 is described below commit faae9a368e90d5bba2b70c49f0856a329937dcf0 Author: Dongjoon Hyun <dongj...@apache.org> AuthorDate: Tue Apr 22 17:00:09 2025 +0900 [SPARK-51864] Rename parameters and support case-insensitively ### What changes were proposed in this pull request? This PR aims to rename parameters and support it case-insensitively according to the documentation. - https://github.com/apache/spark/blob/master/sql/connect/docs/client-connection-string.md ### Why are the changes needed? To match with the documentation. ### Does this PR introduce _any_ user-facing change? No, this is a change on the unreleased version. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #81 from dongjoon-hyun/SPARK-51864. Authored-by: Dongjoon Hyun <dongj...@apache.org> Signed-off-by: Dongjoon Hyun <dongj...@apache.org> --- Sources/SparkConnect/SparkConnectClient.swift | 12 ++++++------ Tests/SparkConnectTests/SparkConnectClientTests.swift | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/SparkConnect/SparkConnectClient.swift b/Sources/SparkConnect/SparkConnectClient.swift index f71ad83..7794a4e 100644 --- a/Sources/SparkConnect/SparkConnectClient.swift +++ b/Sources/SparkConnect/SparkConnectClient.swift @@ -49,7 +49,7 @@ public actor SparkConnectClient { #endif for param in self.url.path.split(separator: ";").dropFirst().filter({ !$0.isEmpty }) { let kv = param.split(separator: "=") - switch String(kv[0]) { + switch String(kv[0]).lowercased() { case URIParams.PARAM_USER_AGENT: clientType = String(kv[1]) case URIParams.PARAM_TOKEN: @@ -618,11 +618,11 @@ public actor SparkConnectClient { } private enum URIParams { - static let PARAM_USER_ID = "userId" - static let PARAM_USER_AGENT = "userAgent" + static let PARAM_GRPC_MAX_MESSAGE_SIZE = "grpc_max_message_size" + static let PARAM_SESSION_ID = "session_id" static let PARAM_TOKEN = "token" - static let PARAM_USE_SSL = "useSsl" - static let PARAM_SESSION_ID = "sessionId" - static let PARAM_GRPC_MAX_MESSAGE_SIZE = "grpcMaxMessageSize" + static let PARAM_USER_AGENT = "user_agent" + static let PARAM_USER_ID = "user_id" + static let PARAM_USE_SSL = "use_ssl" } } diff --git a/Tests/SparkConnectTests/SparkConnectClientTests.swift b/Tests/SparkConnectTests/SparkConnectClientTests.swift index a9c1c22..b3410ef 100644 --- a/Tests/SparkConnectTests/SparkConnectClientTests.swift +++ b/Tests/SparkConnectTests/SparkConnectClientTests.swift @@ -35,7 +35,7 @@ struct SparkConnectClientTests { @Test func parameters() async throws { - let client = SparkConnectClient(remote: "sc://host1:123/;token=abcd;userId=test;userAgent=myagent") + let client = SparkConnectClient(remote: "sc://host1:123/;tOkeN=abcd;user_ID=test;USER_agent=myagent") #expect(await client.token == "abcd") #expect(await client.userContext.userID == "test") #expect(await client.clientType == "myagent") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org