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

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

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


##########
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:
   Good point. Added `SchemaDescriptor.hasTemporalColumns`. And the descriptor is already cached.



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