File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
python/pyspark/sql/connect/client Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -393,22 +393,19 @@ def _extract_attributes(self) -> None:
393
393
)
394
394
self .set (kv [0 ], urllib .parse .unquote (kv [1 ]))
395
395
396
- netloc = self .url .netloc .split (":" )
397
- if len (netloc ) == 1 :
398
- self ._host = netloc [0 ]
399
- self ._port = DefaultChannelBuilder .default_port ()
400
- elif len (netloc ) == 2 :
401
- self ._host = netloc [0 ]
402
- self ._port = int (netloc [1 ])
403
- else :
396
+ if not self .url .hostname :
404
397
raise PySparkValueError (
405
398
errorClass = "INVALID_CONNECT_URL" ,
406
399
messageParameters = {
407
- "detail" : f"Target destination '{ self .url .netloc } ' should match the "
408
- f"'<host>:<port>' pattern. Please update the destination to follow "
409
- f"the correct format, e.g., 'hostname:port'." ,
400
+ "detail" : f"Hostname is missing in the URL: '{ self .url .geturl () } '. "
401
+ " Please update the URL to follow the correct format, "
402
+ " e.g., 'sc:// hostname:port'." ,
410
403
},
411
404
)
405
+ self ._host = self .url .hostname
406
+ self ._port = (
407
+ self .url .port if self .url .port is not None else DefaultChannelBuilder .default_port ()
408
+ )
412
409
413
410
@property
414
411
def secure (self ) -> bool :
You can’t perform that action at this time.
0 commit comments