You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/09/24 15:37:59 UTC

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

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


##########
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:
   > Could you add a test based on your example in the PR description?
   @yihua thanks for your time
   Done



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