Fokko commented on code in PR #1770: URL: https://github.com/apache/iceberg-python/pull/1770#discussion_r2054659488
########## pyiceberg/conversions.py: ########## @@ -540,20 +560,26 @@ def _(_: StringType, val: str) -> str: @from_json.register(FixedType) -def _(t: FixedType, val: str) -> bytes: +def _(t: FixedType, val: Union[str, bytes]) -> bytes: """JSON hexadecimal encoded string into bytes.""" - b = codecs.decode(val.encode(UTF8), "hex") + if isinstance(val, str): + b = codecs.decode(val.encode(UTF8), "hex") - if len(t) != len(b): - raise ValueError(f"FixedType has length {len(t)}, which is different from the value: {len(b)}") + if len(t) != len(b): + raise ValueError(f"FixedType has length {len(t)}, which is different from the value: {len(b)}") - return b + return b + else: + return val Review Comment: Good one, thanks! -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org