uranusjr commented on code in PR #34118:
URL: https://github.com/apache/airflow/pull/34118#discussion_r1318222825


##########
airflow/providers/amazon/aws/operators/sagemaker.py:
##########
@@ -166,9 +167,8 @@ def hook(self):
     def path_to_s3_dataset(path) -> Dataset:
         from openlineage.client.run import Dataset
 
-        path = path.replace("s3://", "")
-        split_path = path.split("/")
-        return Dataset(namespace=f"s3://{split_path[0]}", 
name="/".join(split_path[1:]), facets={})
+        split = urlsplit(path)
+        return Dataset(namespace=f"{split.scheme}://{split.netloc}", 
name=split.path, facets={})

Review Comment:
   Would the path contain query parameters like `?foo=bar&x`? Not familiar with 
this, but using `split.path` would loose those. We might need 
`urlunsplit(split._replace(scheme="", netloc="")).lstrip("/")` instead (getting 
rid of the leading slash to match the current behaviour)



-- 
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]

Reply via email to