You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/11/24 10:38:49 UTC

[GitHub] [ignite-3] AMashenkov commented on a change in pull request #455: IGNITE-15784 Mapper support arbitrary serializable user pojo.

AMashenkov commented on a change in pull request #455:
URL: https://github.com/apache/ignite-3/pull/455#discussion_r755908804



##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/MarshallerUtil.java
##########
@@ -45,32 +46,31 @@
     public static int getValueSize(Object val, NativeType type) throws InvalidTypeException {
         switch (type.spec()) {
             case BYTES:
-                return ((byte[]) val).length;
-            
+                // Return zero for pojo as they are not serialized yet.
+                return (val instanceof byte[]) ? ((byte[]) val).length : 0;

Review comment:
       I'm not sure we can guess anything here, it depends on serialization. Also, it is easy to over-estimate if there are many fields with pojos. Maybe we can disable row size calculation if there is non-null field with user object and use predefined initial buffer size.
   
   As an alternative, we can try to serialize object to a 'blackhole' using configured serializer just to count result byte[] size (without any allocation). This requires some benchmarks. 




-- 
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: notifications-unsubscribe@ignite.apache.org

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