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

[GitHub] [ignite-3] ademakov commented on a diff in pull request #2004: IGNITE-18925 Avoid BinaryTuple conversion from client to storage

ademakov commented on code in PR #2004:
URL: https://github.com/apache/ignite-3/pull/2004#discussion_r1182312609


##########
modules/table/src/main/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerImpl.java:
##########
@@ -317,10 +332,45 @@ private static RowAssembler createAssembler(SchemaDescriptor schema, InternalTup
      * @param tup    Internal tuple.
      * @throws SchemaMismatchException If a tuple column value doesn't match the current column type.
      */
-    private void writeColumn(RowAssembler rowAsm, Column col, InternalTuple tup) throws SchemaMismatchException {
+    private static void writeColumn(RowAssembler rowAsm, Column col, InternalTuple tup) throws SchemaMismatchException {
         RowAssembler.writeValue(rowAsm, col, tup.value(col.name()));
     }
 
+    /**
+     * Determines whether binary tuple rebuild is required.
+     *
+     * @param schema Schema.
+     * @return True if binary tuple rebuild is required; false if the tuple can be written to storage as is.
+     */
+    private static boolean binaryTupleRebuildRequired(SchemaDescriptor schema) {
+        for (var col : schema.keyColumns().columns()) {
+            if (binaryTupleRebuildRequired(col)) {
+                return true;
+            }
+        }
+
+        for (var col : schema.valueColumns().columns()) {
+            if (binaryTupleRebuildRequired(col)) {
+                return true;
+            }
+        }
+
+        return false;

Review Comment:
   This computation seems to be heavy. Can it be cached somehow?



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