You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "AMashenkov (via GitHub)" <gi...@apache.org> on 2024/05/29 13:02:08 UTC

Re: [PR] IGNITE-22061 Use compact representation of BigDecimal to improve values size estimation [ignite-3]

AMashenkov commented on code in PR #3819:
URL: https://github.com/apache/ignite-3/pull/3819#discussion_r1618847754


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/reflection/ObjectStatistics.java:
##########
@@ -23,35 +23,81 @@
 import org.apache.ignite.internal.marshaller.Marshaller;
 import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
+import org.apache.ignite.internal.schema.marshaller.MarshallerUtil;
 import org.apache.ignite.internal.schema.row.RowAssembler;
 import org.apache.ignite.internal.type.NativeType;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
 
 /**
  * Object statistic.
  */
 class ObjectStatistics {
-    /** Cached zero statistics. */
-    private static final ObjectStatistics ZERO_STATISTICS = new ObjectStatistics(-1);
-
     /** Estimated total size of the object. */
     private final int estimatedValueSize;
 
+    private final Object[] values;
+
     /** Constructor. */
-    private ObjectStatistics(int estimatedValueSize) {
+    private ObjectStatistics(Object[] values, int estimatedValueSize) {
+        this.values = values;
         this.estimatedValueSize = estimatedValueSize;
     }
 
-    private int getEstimatedValueSize() {
+    int estimatedValueSize() {
         return estimatedValueSize;
     }
 
+    @TestOnly
+    <T> T value(int index) {
+        return (T) values[index];
+    }
+
+    static MarshallerRowBuilder createRowBuilder(SchemaDescriptor schema, Marshaller keyMarsh, Object key) {

Review Comment:
   Expression like `ObjectStatistics.createRowBuilder(...)` looks weird. 
   
   Let's move factory methods to MarshallerRowBuilder class or MarshallerUtil.



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