You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2022/11/24 20:47:09 UTC
[GitHub] [avro] opwvhk commented on a diff in pull request #1933: AVRO-3573: Duplicate symbols (EnumSchema)
opwvhk commented on code in PR #1933:
URL: https://github.com/apache/avro/pull/1933#discussion_r1031815579
##########
lang/py/avro/schema.py:
##########
@@ -570,7 +570,8 @@ def __init__(
raise avro.errors.InvalidName("An enum symbol must be a valid schema name.")
if len(set(symbols)) < len(symbols):
- raise avro.errors.AvroException(f"Duplicate symbol: {symbols}")
+ duplicate_symbols = {symbol for symbol in symbols if symbols.count(symbol) > 1}
+ raise avro.errors.AvroException(f"Duplicate enum symbol: {list(duplicate_symbols)[0]}")
Review Comment:
This doesn't match with the issue:
> Improvement removes this defect and shows a message "Duplicate symbol" with the symbol, if it is one, or "Duplicates symbols" with the list of duplicate symbols, if there are more than one symbol.
May I suggest to raise this instead?
```python
raise avro.errors.AvroException(f"Duplicate enum symbol(s): {list(duplicate_symbols)}")
```
--
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: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org