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


##########
modules/binary-tuple/src/main/java/org/apache/ignite/internal/binarytuple/inlineschema/TupleWithSchemaMarshalling.java:
##########
@@ -0,0 +1,307 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.binarytuple.inlineschema;
+
+import java.math.BigDecimal;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.Period;
+import java.util.UUID;
+import java.util.function.BiConsumer;
+import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
+import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
+import org.apache.ignite.sql.ColumnType;
+import org.apache.ignite.table.Tuple;
+import org.jetbrains.annotations.Nullable;
+
+/** Tuple with schema marshalling. */
+public final class TupleWithSchemaMarshalling {
+
+    /**
+     * Marshal tuple is the following format:
+     *
+     * <p>marshalledTuple       := | size | binaryTupleWithSchema |
+     *
+     * <p>size                  := int32
+     *
+     * <p>binaryTupleWithSchema := | column1 | ... | columnN | value1 | ... | 
valueN |

Review Comment:
   I think we should not put schema and values into the same `BinaryTuple`.
   
   ```
   binaryTupleWithSchema = BinaryTuple + separate schema (most likely another 
BinaryTuple).
   ```
   
   This will be beneficial when we need to separate the value from the schema. 
   
   **Example 1** - `table.put`:
   * If the provided schema matches the table schema, we can insert the data 
directly without rebuilding the BinaryTuple
   * If the schema is a part of the BinaryTuple, we have to rebuild it
   
   **Example 2** - many items with the same schema (`table.putAll`)
   * Schema can be specified once for many values
   * Not possible when it is a part of the BinaryTuple



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

Reply via email to