itholic commented on code in PR #40672:
URL: https://github.com/apache/spark/pull/40672#discussion_r1160369876
##########
python/pyspark/errors/exceptions/base.py:
##########
@@ -31,14 +31,12 @@ def __init__(
error_class: Optional[str] = None,
message_parameters: Optional[Dict[str, str]] = None,
):
- # `message` vs `error_class` & `message_parameters` are mutually
exclusive.
- assert (message is not None and (error_class is None and
message_parameters is None)) or (
- message is None and (error_class is not None and
message_parameters is not None)
- )
-
- self.error_reader = ErrorClassesReader()
-
if message is None:
+ assert (
Review Comment:
> If the error message field is None, we can render the message from the
error class and parameter.
Yes, the existing code already does that. We're doing basically:
1. if the `message` is `None`, we render the message from the `error_class`
and `message_parameter`.
2. if the `message` exists, we use that message instead of `error_class` and
`message_parameter`. In this case, `error_class` and `message_parameter` will
never be used, so we block to accept them in force.
Your fix removes the second condition, so that's why @amaliujia concerned
about this I guess.
btw, what is the reason for changing this code? Is there a case where we
need to receive `message`, `error_class`, and `message_parameter` at the same
time? If we cannot avoid it, I agree with this modification.
--
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]