itholic commented on code in PR #44176:
URL: https://github.com/apache/spark/pull/44176#discussion_r1414868874
##########
python/pyspark/errors/utils.py:
##########
@@ -40,9 +40,14 @@ def get_error_message(self, error_class: str,
message_parameters: Dict[str, str]
f"Undefined error message parameter for error class:
{error_class}. "
f"Parameters: {message_parameters}"
)
- table = str.maketrans("<>", "{}")
- return message_template.translate(table).format(**message_parameters)
+ def replace_match(match):
+ return match.group().translate(str.maketrans("<>", "{}"))
+
+ # Convert <> to {} only when paired.
+ message_template = re.sub(r"<([^<>]*)>", replace_match,
message_template)
+
+ return message_template.format(**message_parameters)
Review Comment:
This change should fix the previous build failure from
https://github.com/apache/spark/actions/runs/7088462269/job/19291103742.
Manually confirmed that now the error is properly generated as below:
<img width="1203" alt="Screenshot 2023-12-05 at 1 42 39 PM"
src="https://github.com/apache/spark/assets/44108233/5f628094-fd16-4380-b30b-5fe2f5dcbc77">
cc @HyukjinKwon @dongjoon-hyun FYI.
--
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]