mchades commented on code in PR #14659:
URL: https://github.com/apache/gravitino/pull/14659#discussion_r4490299418


##########
clients/client-python/gravitino/dto/util/dto_converters.py:
##########
@@ -844,3 +873,36 @@ def to_table_update_request(change) -> 
TableUpdateRequestBase:
         raise IllegalArgumentException(
             f"Unknown change type: {change.__class__.__name__}"
         )
+
+    @staticmethod
+    def _is_binary_or_fixed(data_type) -> bool:
+        return isinstance(data_type, (Types.BinaryType, Types.FixedType))
+
+    @staticmethod
+    def _literal_value_to_dto_string(value, data_type) -> Optional[str]:
+        if value is None:
+            return None
+        # Match Java DTOConverters / #14609: 0x + lowercase hex for 
binary/fixed bytes.
+        if DTOConverters._is_binary_or_fixed(data_type) and isinstance(
+            value, (bytes, bytearray)
+        ):
+            return "0x" + bytes(value).hex()

Review Comment:
   [P2] Update Python tests for the new binary encoding
   
   Please update the Python converter tests alongside this codec. On `dc1a64c`, 
`python -m unittest tests.unittests.dto.util.test_dto_converters` fails in two 
tests: `test_from_function_arg_literal_dto` supplies raw `bytes`, so 
`_decode_binary_hex` raises `TypeError`; `test_to_function_arg_function_arg` 
still expects `"b'test'"` instead of `"0x74657374"`. Both pass on the PR base 
`171ce25f`. Please use string-valued wire fixtures for decoding, update the 
encoded expectations, and add binary/fixed round-trip coverage.



-- 
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]

Reply via email to