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


##########
common/src/main/java/org/apache/gravitino/dto/util/DTOConverters.java:
##########
@@ -1651,4 +1673,46 @@ public static PolicyContent fromDTO(PolicyContentDTO 
policyContentDTO) {
     throw new IllegalArgumentException(
         "Unsupported policy content type: " + policyContentDTO.getClass());
   }
+
+  private static boolean isBinaryOrFixed(Type dataType) {
+    return dataType instanceof Types.BinaryType || dataType instanceof 
Types.FixedType;
+  }
+
+  private static String literalValueToDtoString(Object value, Type dataType) {
+    // byte[].toString() is an object identity and cannot preserve the 
literal's bytes.
+    if (isBinaryOrFixed(dataType) && value instanceof byte[]) {
+      return BINARY_HEX_PREFIX + BINARY_HEX.encode((byte[]) value);
+    }
+    return value.toString();
+  }
+
+  /**
+   * Decodes {@code 0x}-prefixed hex for binary/fixed. Unprefixed values keep 
their previous string
+   * interpretation (#14609).
+   */
+  private static Object literalValueFromDtoString(String value, Type dataType) 
{
+    if (!isBinaryOrFixed(dataType) || value == null) {
+      return value;

Review Comment:
   Updated on `16f85aadd`: the shared Java/Python DTO decoder again keeps 
unprefixed binary/fixed wire values as strings for provider-specific 
interpretation (e.g. PostgreSQL `DEFAULT 'AB'`), with a regression covering 
that path. `0x`-prefixed values still decode to bytes, and the Iceberg read 
path continues to emit `0x`-prefixed hex.



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