nchammas commented on code in PR #56174: URL: https://github.com/apache/spark/pull/56174#discussion_r3904664123
########## python/pyspark/sql/protobuf/functions.py: ########## @@ -286,9 +287,14 @@ def to_protobuf( def _read_descriptor_set_file(filePath: str) -> bytes: - # TODO(SPARK-43847): Throw structured errors like "PROTOBUF_DESCRIPTOR_FILE_NOT_FOUND" etc. - with open(filePath, "rb") as f: - return f.read() + try: + with open(filePath, "rb") as f: + return f.read() + except OSError as e: Review Comment: There are [lots of reasons](https://docs.python.org/3.14/library/exceptions.html#os-exceptions) a program may raise `OSError`. I don't think it's correct to map them all to "protobuf descriptor file not found". You probably want `FileNotFoundError`. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
