philippemarcelino commented on issue #2125:
URL: https://github.com/apache/fury/issues/2125#issuecomment-2765739907

   Hi @chaokunyang 
   
   Well, I did some tests this morning, and here are some results that may help 
you.
   
   `
   public class Test {
        
        Map<String, Object> m = new HashMap<>();
   
   }
   [...]
   // OK
                Test a = new Test();
                a.m.put("a", Map.of("a", 0, "b", 1));   // a.m is a HashMap
   
                Test b = new Test();
                b.m = new LinkedHashMap<>();                    // 
Re-instanciating a.m to LinkedHashMap seems ok
                b.m.put("a", Map.of("a", "1"));
   
                fury.deserialize(fury.serialize(a));
                fury.deserialize(fury.serialize(b));
                
   // Also OK           
                Test a = new Test();
                a.m.put("a", Map.of("a", 0, "b", 1));   // Only Integer objects 
in the map
   
                Test b = new Test();
                b.m = new LinkedHashMap<>();
                b.m.put("a", Map.of("a", "1", "b", 1)); // Mixing String and 
Integer in the map
   
                fury.deserialize(fury.serialize(a));
                fury.deserialize(fury.serialize(b));
                
   // KO: changing types within collection properties breaks things
                Test a = new Test();
                a.m.put("a", Map.of("a", 0, "b", 1));   // Map<String, 
ImmutableCollection$MapN>
   
                Test b = new Test();
                b.m = new LinkedHashMap<>();
                b.m.put("a", List.of("a", "1"));                // Map<String, 
ImmutableCollection$List>
   
                fury.deserialize(fury.serialize(a));
                fury.deserialize(fury.serialize(b));
   
   // Also KO: mixing String, Integer and a Collection in the map
                Test a = new Test();
                a.m = new LinkedHashMap<>();
                a.m.put("a", Map.of("a", "1", "b", 1, "c", List.of("c1", 
"c2")));
   
                fury.deserialize(fury.serialize(a));
   `
   Those simple tests will fail with an Out of Bounds exception. When the issue 
is deeper in a more complex object, the error is then reported as either the 
unknonw coder type or null classInfo error reported earlier.
   I've tested this with one such object that threw the "Unknown coder type 50" 
exception: changing one ArrayList value of in inner map A (of an inner map of a 
map) to a Double value (so all values of map A are of the same type Double) 
fixed the issue.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to