You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "bvaradar (via GitHub)" <gi...@apache.org> on 2023/03/07 04:09:42 UTC

[GitHub] [hudi] bvaradar commented on a diff in pull request #6736: [HUDI-4894] Fix ClassCastException when using fixed type defining dec…

bvaradar commented on code in PR #6736:
URL: https://github.com/apache/hudi/pull/6736#discussion_r1127320424


##########
hudi-common/src/main/java/org/apache/hudi/avro/MercifulJsonConverter.java:
##########
@@ -246,13 +246,7 @@ private static JsonToAvroFieldProcessor generateFixedTypeHandler() {
     return new JsonToAvroFieldProcessor() {
       @Override
       public Pair<Boolean, Object> convert(Object value, String name, Schema schema) {
-        // The ObjectMapper use List to represent FixedType
-        // eg: "decimal_val": [0, 0, 14, -63, -52] will convert to ArrayList<Integer>
-        List<Integer> converval = (List<Integer>) value;
-        byte[] src = new byte[converval.size()];
-        for (int i = 0; i < converval.size(); i++) {
-          src[i] = converval.get(i).byteValue();
-        }
+        byte[] src = value.toString().getBytes();

Review Comment:
   @wangxianghu :Can you use ObjectMapper to convert FixedType to Json and see if it is represented as list. The inline comment explicitly states that this is the case.  So, I am worried this would break those cases. 



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org