shenh062326 commented on a change in pull request #1690:
URL: https://github.com/apache/hudi/pull/1690#discussion_r435692529



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/avro/MercifulJsonConverter.java
##########
@@ -245,10 +245,14 @@ private static JsonToAvroFieldProcessor 
generateFixedTypeHandler() {
     return new JsonToAvroFieldProcessor() {
       @Override
       public Pair<Boolean, Object> convert(Object value, String name, Schema 
schema) {
-        byte[] src = value.toString().getBytes();
+        ArrayList<Integer> converval = (ArrayList<Integer>) value;

Review comment:
       1. Currently Fix.toString() will convert bytes to string, 
   ```
   public String toString() { return Arrays.toString(bytes); } 
   ```
   the result is like "decimal_val": [0, 0, 14, -63, -52], 
   
   2. MercifulJsonConverter.convert will parse json string to jsonObjectMap, 
   ```
   public GenericRecord convert(String json, Schema schema) {
       try {
         Map<String, Object> jsonObjectMap = mapper.readValue(json, Map.class);
         return convertJsonToAvro(jsonObjectMap, schema);
       } catch (IOException e) {
         throw new HoodieIOException(e.getMessage(), e);
       }
     }
   ```
   
   it will convert "decimal_val": [0, 0, 14, -63, -52], to ArrayList<Integer>.
   
![image](https://user-images.githubusercontent.com/9527867/83839808-9a2a8200-a72f-11ea-8f6c-f28d0484551d.png)
   
   3. the generateFixedTypeHandler() will process it incorrect. 




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

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


Reply via email to