Skip to content

Commit 8f4861c

Browse files
committed
[SPARK-51864] Rename parameters and support case-insensitively
1 parent 7fe4882 commit 8f4861c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Sources/SparkConnect/SparkConnectClient.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public actor SparkConnectClient {
4949
#endif
5050
for param in self.url.path.split(separator: ";").dropFirst().filter({ !$0.isEmpty }) {
5151
let kv = param.split(separator: "=")
52-
switch String(kv[0]) {
52+
switch String(kv[0]).lowercased() {
5353
case URIParams.PARAM_USER_AGENT:
5454
clientType = String(kv[1])
5555
case URIParams.PARAM_TOKEN:
@@ -596,11 +596,11 @@ public actor SparkConnectClient {
596596
}
597597

598598
private enum URIParams {
599-
static let PARAM_USER_ID = "userId"
600-
static let PARAM_USER_AGENT = "userAgent"
599+
static let PARAM_GRPC_MAX_MESSAGE_SIZE = "grpc_max_message_size"
600+
static let PARAM_SESSION_ID = "session_id"
601601
static let PARAM_TOKEN = "token"
602-
static let PARAM_USE_SSL = "useSsl"
603-
static let PARAM_SESSION_ID = "sessionId"
604-
static let PARAM_GRPC_MAX_MESSAGE_SIZE = "grpcMaxMessageSize"
602+
static let PARAM_USER_AGENT = "user_agent"
603+
static let PARAM_USER_ID = "user_id"
604+
static let PARAM_USE_SSL = "use_ssl"
605605
}
606606
}

Tests/SparkConnectTests/SparkConnectClientTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct SparkConnectClientTests {
3535

3636
@Test
3737
func parameters() async throws {
38-
let client = SparkConnectClient(remote: "sc://host1:123/;token=abcd;userId=test;userAgent=myagent")
38+
let client = SparkConnectClient(remote: "sc://host1:123/;tOkeN=abcd;user_ID=test;USER_agent=myagent")
3939
#expect(await client.token == "abcd")
4040
#expect(await client.userContext.userID == "test")
4141
#expect(await client.clientType == "myagent")

0 commit comments

Comments
 (0)