You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2021/06/09 07:55:21 UTC

[ignite-3] branch main updated: IGNITE-14746: Improve row layout. Omit offset for the first varlen. (#152)

This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new fb14a5f  IGNITE-14746: Improve row layout. Omit offset for the first varlen. (#152)
fb14a5f is described below

commit fb14a5fb47bae0fd81bd20ff2e6d0a801f16a80b
Author: Andrew V. Mashenkov <AM...@users.noreply.github.com>
AuthorDate: Wed Jun 9 10:55:14 2021 +0300

    IGNITE-14746: Improve row layout. Omit offset for the first varlen. (#152)
---
 .../ignite/internal/schema/ExpandableByteBuf.java  |   6 +-
 .../org/apache/ignite/internal/schema/Row.java     |  26 +-
 .../ignite/internal/schema/RowAssembler.java       |  80 ++-
 .../asm/IdentityMarshallerCodeGenerator.java       |   3 +-
 .../asm/ObjectMarshallerCodeGenerator.java         |   5 +-
 .../internal/schema/ExpandableByteBufTest.java     |  29 +-
 .../schema/RowAssemblerAdvancedSchemaTest.java     | 307 +++++++++
 .../schema/RowAssemblerSimpleSchemaTest.java       | 643 ++++++++++++++++++
 .../ignite/internal/schema/RowAssemblerTest.java   | 738 ---------------------
 9 files changed, 1060 insertions(+), 777 deletions(-)

diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ExpandableByteBuf.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ExpandableByteBuf.java
index d74d719..5ee4f34 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/ExpandableByteBuf.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/ExpandableByteBuf.java
@@ -189,7 +189,7 @@ public class ExpandableByteBuf {
                     break;
 
                 if (cr.isOverflow()) {
-                    expand(len + 1);
+                    expand(len + (int)encoder.maxBytesPerChar());
 
                     continue;
                 }
@@ -205,7 +205,7 @@ public class ExpandableByteBuf {
                 len = buf.position();
 
                 if (cr.isOverflow()) {
-                    expand(len + 1);
+                    expand(len + (int)encoder.maxBytesPerChar());
 
                     continue;
                 }
@@ -270,7 +270,7 @@ public class ExpandableByteBuf {
                 l += MB;
         }
 
-        byte[] tmp = new byte[cap];
+        byte[] tmp = new byte[l];
 
         System.arraycopy(arr, 0, tmp, 0, arr.length);
 
diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java
index a2fa63e..973e8b2 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java
@@ -371,11 +371,9 @@ public class Row implements BinaryRow {
         if (hasNullMap && isNull(off, colIdx))
             return -1;
 
-        assert hasVarTable || type.fixedLength();
-
         return type.fixedLength() ?
             fixlenColumnOffset(cols, off, colIdx, hasVarTable, hasNullMap) :
-            varlenColumnOffsetAndLength(cols, off, colIdx, hasNullMap);
+            varlenColumnOffsetAndLength(cols, off, colIdx, hasVarTable, hasNullMap);
     }
 
     /**
@@ -438,10 +436,11 @@ public class Row implements BinaryRow {
      * @param cols Columns chunk.
      * @param baseOff Chunk base offset.
      * @param idx Column index in the chunk.
+     * @param hasVarTbl Has varlen table flag.
      * @param hasNullMap Has null map flag.
      * @return Encoded offset (from the row start) and length of the column with the given index.
      */
-    private long varlenColumnOffsetAndLength(Columns cols, int baseOff, int idx, boolean hasNullMap) {
+    private long varlenColumnOffsetAndLength(Columns cols, int baseOff, int idx, boolean hasVarTbl, boolean hasNullMap) {
         int vartableOff = baseOff + CHUNK_LEN_FIELD_SIZE;
 
         int numNullsBefore = 0;
@@ -473,16 +472,29 @@ public class Row implements BinaryRow {
         }
 
         idx -= cols.numberOfFixsizeColumns() + numNullsBefore;
+
+        if (idx == 0) { // Very first non-null varlen column.
+            int off = cols.numberOfFixsizeColumns() == 0 ?
+                (hasVarTbl ? vartableOff + varlenItemOffset(readShort(vartableOff)) : vartableOff) :
+                fixlenColumnOffset(cols, baseOff, cols.numberOfFixsizeColumns(), hasVarTbl, hasNullMap);
+
+            long len = hasVarTbl ?
+                readShort(vartableOff + varlenItemOffset(0)) - (off - baseOff) :
+                readInteger(baseOff) - (off - baseOff);
+
+            return (len << 32) | off;
+        }
+
         int vartableSize = readShort(vartableOff);
 
         // Offset of idx-th column is from base offset.
-        int resOff = readShort(vartableOff + varlenItemOffset(idx));
+        int resOff = readShort(vartableOff + varlenItemOffset(idx - 1));
 
-        long len = (idx == vartableSize - 1) ?
+        long len = (idx == vartableSize) ?
             // totalLength - columnStartOffset
             readInteger(baseOff) - resOff :
             // nextColumnStartOffset - columnStartOffset
-            readShort(vartableOff + varlenItemOffset(idx + 1)) - resOff;
+            readShort(vartableOff + varlenItemOffset(idx)) - resOff;
 
         return (len << 32) | (resOff + baseOff);
     }
diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java
index 770ab6d..79cfb8c 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java
@@ -86,8 +86,10 @@ public class RowAssembler {
      * @return Total size of the varlen table.
      */
     public static int varlenTableChunkSize(int nonNullVarlenCols) {
-        return nonNullVarlenCols == 0 ? 0 :
-            VARLEN_TABLE_SIZE_FIELD_SIZE + nonNullVarlenCols * VARLEN_COLUMN_OFFSET_FIELD_SIZE;
+        int items = nonNullVarlenCols - 1; // Ignore very first varlen.
+
+        return items <= 0 ? 0 :
+            VARLEN_TABLE_SIZE_FIELD_SIZE + items * VARLEN_COLUMN_OFFSET_FIELD_SIZE;
     }
 
     /**
@@ -189,16 +191,18 @@ public class RowAssembler {
 
         buf.putShort(0, (short)schema.version());
 
-        if (nonNullVarlenKeyCols == 0)
-            flags |= OMIT_KEY_VARTBL_FLAG;
+        if (nonNullVarlenKeyCols > 1) // First varlen column offset is known.
+            buf.putShort(varlenTblChunkOff, (short)(nonNullVarlenKeyCols - 1));
         else
-            buf.putShort(varlenTblChunkOff, (short)nonNullVarlenKeyCols);
+            flags |= OMIT_KEY_VARTBL_FLAG;
     }
 
     /**
      * Appends {@code null} value for the current column to the chunk.
+     *
+     * @return {@code this} for chaining.
      */
-    public void appendNull() {
+    public RowAssembler appendNull() {
         Column col = curCols.column(curCol);
 
         if (!col.nullable())
@@ -211,14 +215,17 @@ public class RowAssembler {
             keyHash *= 31;
 
         shiftColumn(0, false);
+
+        return this;
     }
 
     /**
      * Appends byte value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendByte(byte val) {
+    public RowAssembler appendByte(byte val) {
         checkType(NativeTypes.BYTE);
 
         buf.put(curOff, val);
@@ -227,14 +234,17 @@ public class RowAssembler {
             keyHash = 31 * keyHash + Byte.hashCode(val);
 
         shiftColumn(NativeTypes.BYTE);
+
+        return this;
     }
 
     /**
      * Appends short value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendShort(short val) {
+    public RowAssembler appendShort(short val) {
         checkType(NativeTypes.SHORT);
 
         buf.putShort(curOff, val);
@@ -243,14 +253,17 @@ public class RowAssembler {
             keyHash = 31 * keyHash + Short.hashCode(val);
 
         shiftColumn(NativeTypes.SHORT);
+
+        return this;
     }
 
     /**
      * Appends int value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendInt(int val) {
+    public RowAssembler appendInt(int val) {
         checkType(NativeTypes.INTEGER);
 
         buf.putInt(curOff, val);
@@ -259,14 +272,17 @@ public class RowAssembler {
             keyHash = 31 * keyHash + Integer.hashCode(val);
 
         shiftColumn(NativeTypes.INTEGER);
+
+        return this;
     }
 
     /**
      * Appends long value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendLong(long val) {
+    public RowAssembler appendLong(long val) {
         checkType(NativeTypes.LONG);
 
         buf.putLong(curOff, val);
@@ -275,14 +291,17 @@ public class RowAssembler {
             keyHash += 31 * keyHash + Long.hashCode(val);
 
         shiftColumn(NativeTypes.LONG);
+
+        return this;
     }
 
     /**
      * Appends float value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendFloat(float val) {
+    public RowAssembler appendFloat(float val) {
         checkType(NativeTypes.FLOAT);
 
         buf.putFloat(curOff, val);
@@ -291,14 +310,17 @@ public class RowAssembler {
             keyHash += 31 * keyHash + Float.hashCode(val);
 
         shiftColumn(NativeTypes.FLOAT);
+
+        return this;
     }
 
     /**
      * Appends double value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendDouble(double val) {
+    public RowAssembler appendDouble(double val) {
         checkType(NativeTypes.DOUBLE);
 
         buf.putDouble(curOff, val);
@@ -307,14 +329,17 @@ public class RowAssembler {
             keyHash += 31 * keyHash + Double.hashCode(val);
 
         shiftColumn(NativeTypes.DOUBLE);
+
+        return this;
     }
 
     /**
      * Appends UUID value for the current column to the chunk.
      *
      * @param uuid Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendUuid(UUID uuid) {
+    public RowAssembler appendUuid(UUID uuid) {
         checkType(NativeTypes.UUID);
 
         buf.putLong(curOff, uuid.getLeastSignificantBits());
@@ -324,25 +349,31 @@ public class RowAssembler {
             keyHash += 31 * keyHash + uuid.hashCode();
 
         shiftColumn(NativeTypes.UUID);
+
+        return this;
     }
 
     /**
      * Appends String value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendString(String val) {
+    public RowAssembler appendString(String val) {
         checkType(NativeTypes.STRING);
 
         try {
             int written = buf.putString(curOff, val, encoder());
 
-            writeOffset(curVarlenTblEntry, curOff - baseOff);
+            if (curVarlenTblEntry != 0)
+                writeOffset(curVarlenTblEntry - 1, curOff - baseOff);
 
             if (isKeyColumn())
                 keyHash += 31 * keyHash + val.hashCode();
 
             shiftColumn(written, true);
+
+            return this;
         }
         catch (CharacterCodingException e) {
             throw new AssemblyException("Failed to encode string", e);
@@ -353,8 +384,9 @@ public class RowAssembler {
      * Appends byte[] value for the current column to the chunk.
      *
      * @param val Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendBytes(byte[] val) {
+    public RowAssembler appendBytes(byte[] val) {
         checkType(NativeTypes.BYTES);
 
         buf.putBytes(curOff, val);
@@ -362,17 +394,21 @@ public class RowAssembler {
         if (isKeyColumn())
             keyHash += 31 * keyHash + Arrays.hashCode(val);
 
-        writeOffset(curVarlenTblEntry, curOff - baseOff);
+        if (curVarlenTblEntry != 0)
+            writeOffset(curVarlenTblEntry - 1, curOff - baseOff);
 
         shiftColumn(val.length, true);
+
+        return this;
     }
 
     /**
      * Appends BitSet value for the current column to the chunk.
      *
      * @param bitSet Column value.
+     * @return {@code this} for chaining.
      */
-    public void appendBitmask(BitSet bitSet) {
+    public RowAssembler appendBitmask(BitSet bitSet) {
         Column col = curCols.column(curCol);
 
         checkType(NativeTypeSpec.BITMASK);
@@ -394,6 +430,8 @@ public class RowAssembler {
             keyHash += 31 * keyHash + Arrays.hashCode(arr);
 
         shiftColumn(maskType);
+
+        return this;
     }
 
     /**
@@ -514,10 +552,10 @@ public class RowAssembler {
 
             initOffsets(baseOff + chunkLen, nonNullVarlenValCols);
 
-            if (nonNullVarlenValCols == 0)
-                flags |= OMIT_VAL_VARTBL_FLAG;
+            if (nonNullVarlenValCols > 1)
+                buf.putShort(varlenTblChunkOff, (short)(nonNullVarlenValCols - 1));
             else
-                buf.putShort(varlenTblChunkOff, (short)nonNullVarlenValCols);
+                flags |= OMIT_VAL_VARTBL_FLAG;
         }
     }
 
diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/IdentityMarshallerCodeGenerator.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/IdentityMarshallerCodeGenerator.java
index 30864fa..3e7f05d 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/IdentityMarshallerCodeGenerator.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/IdentityMarshallerCodeGenerator.java
@@ -21,6 +21,7 @@ import com.facebook.presto.bytecode.BytecodeNode;
 import com.facebook.presto.bytecode.ParameterizedType;
 import com.facebook.presto.bytecode.Variable;
 import com.facebook.presto.bytecode.expression.BytecodeExpressions;
+import org.apache.ignite.internal.schema.RowAssembler;
 import org.apache.ignite.internal.schema.marshaller.Serializer;
 
 /**
@@ -61,7 +62,7 @@ class IdentityMarshallerCodeGenerator implements MarshallerCodeGenerator {
 
     /** {@inheritDoc} */
     @Override public BytecodeNode marshallObject(ParameterizedType serializerClass, Variable asm, Variable obj) {
-        return asm.invoke(columnAccessor.writeMethodName(), void.class, obj.cast(columnAccessor.writeArgType()));
+        return asm.invoke(columnAccessor.writeMethodName(), RowAssembler.class, obj.cast(columnAccessor.writeArgType()));
     }
 
     /** {@inheritDoc} */
diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/ObjectMarshallerCodeGenerator.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/ObjectMarshallerCodeGenerator.java
index ab417d5..8f47eda 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/ObjectMarshallerCodeGenerator.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/ObjectMarshallerCodeGenerator.java
@@ -34,6 +34,7 @@ import java.lang.reflect.Field;
 import java.util.Collections;
 import java.util.EnumSet;
 import org.apache.ignite.internal.schema.Columns;
+import org.apache.ignite.internal.schema.RowAssembler;
 import org.apache.ignite.internal.schema.marshaller.MarshallerUtil;
 import org.apache.ignite.internal.schema.marshaller.Serializer;
 import org.apache.ignite.lang.IgniteInternalException;
@@ -103,14 +104,14 @@ class ObjectMarshallerCodeGenerator implements MarshallerCodeGenerator {
 
             final BytecodeExpression marshallNonNulExpr = asm.invoke(
                 columnAccessor.writeMethodName(),
-                void.class,
+                RowAssembler.class,
                 Collections.singletonList(columnAccessor.writeArgType()),
                 fld.cast(columnAccessor.writeArgType()));
 
             if (columns.column(i).nullable())
                 block.append(new BytecodeBlock().append(
                     new IfStatement().condition(BytecodeExpressions.isNull(fld))
-                        .ifTrue(asm.invoke("appendNull", void.class))
+                        .ifTrue(asm.invoke("appendNull", RowAssembler.class))
                         .ifFalse(marshallNonNulExpr))
                 );
             else
diff --git a/modules/schema/src/test/java/org/apache/ignite/internal/schema/ExpandableByteBufTest.java b/modules/schema/src/test/java/org/apache/ignite/internal/schema/ExpandableByteBufTest.java
index dc78997..b0f86bd 100644
--- a/modules/schema/src/test/java/org/apache/ignite/internal/schema/ExpandableByteBufTest.java
+++ b/modules/schema/src/test/java/org/apache/ignite/internal/schema/ExpandableByteBufTest.java
@@ -33,7 +33,7 @@ public class ExpandableByteBufTest {
      *
      */
     @Test
-    public void testAllTypesDirectOrder() throws Exception {
+    public void allTypesDirectOrder() throws Exception {
         ExpandableByteBuf buf = new ExpandableByteBuf(5);
 
         byte[] targetBytes = {1, 2, 3, 4, 5, 6, 7};
@@ -77,7 +77,7 @@ public class ExpandableByteBufTest {
      *
      */
     @Test
-    public void testAllTypesReverseOrder() throws Exception {
+    public void allTypesReverseOrder() throws Exception {
         ExpandableByteBuf buf = new ExpandableByteBuf(5);
 
         byte[] targetBytes = {1, 2, 3, 4, 5, 6, 7};
@@ -121,7 +121,7 @@ public class ExpandableByteBufTest {
      *
      */
     @Test
-    public void testJavadocDesc() {
+    public void exampleFromJavadoc() {
         ExpandableByteBuf b = new ExpandableByteBuf(1);
         b.put(0, (byte)1); // Does not expand.
         b.put(5, (byte)1); // Expands, meaningful bytes are [0..5]
@@ -134,8 +134,27 @@ public class ExpandableByteBufTest {
      *
      */
     @Test
-    public void testStringExpandMultipleTimes() throws Exception {
-        // Expansion chain 1->2->4->8->16->32.
+    public void stringExpandMultipleTimes() throws Exception {
+        // Expansion chain 1->2->4->8->16.
+        ExpandableByteBuf buf = new ExpandableByteBuf(1);
+
+        assertEquals(3, buf.putString(0, "我", StandardCharsets.UTF_8.newEncoder()));
+        assertEquals("我", new String(buf.toArray()));
+
+        assertEquals(3, buf.putString(3, "愛", StandardCharsets.UTF_8.newEncoder()));
+        assertEquals("我愛", new String(buf.toArray()));
+
+        assertEquals(4, buf.putString(6, "Java", StandardCharsets.UTF_8.newEncoder()));
+        assertEquals(10, buf.toArray().length);
+        assertEquals("我愛Java", new String(buf.toArray()));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void stringWithnMultiByteChars() throws Exception {
+        // Expansion chain 1->2->4.
         ExpandableByteBuf buf = new ExpandableByteBuf(1);
 
         String str = "abcdefghijklmnopq";
diff --git a/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerAdvancedSchemaTest.java b/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerAdvancedSchemaTest.java
new file mode 100644
index 0000000..d4f9daf
--- /dev/null
+++ b/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerAdvancedSchemaTest.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.schema;
+
+import java.util.Arrays;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.ignite.internal.schema.NativeTypes.BYTE;
+import static org.apache.ignite.internal.schema.NativeTypes.BYTES;
+import static org.apache.ignite.internal.schema.NativeTypes.INTEGER;
+import static org.apache.ignite.internal.schema.NativeTypes.SHORT;
+import static org.apache.ignite.internal.schema.NativeTypes.STRING;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+/**
+ * Validate row layout for different schema configurations.
+ */
+public class RowAssemblerAdvancedSchemaTest {
+    /** Table ID test value. */
+    public final UUID tableId = UUID.randomUUID();
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and fix-len nullable value.
+     */
+    @Test
+    public void fixedNullableColumns() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {
+                new Column("keyCol2", BYTE, true),
+                new Column("keyCol1", SHORT, true),
+                new Column("keyCol3", INTEGER, true)
+            },
+            new Column[] {
+                new Column("valCol2", BYTE, true),
+                new Column("valCol1", INTEGER, true),
+                new Column("valCol3", SHORT, true)
+            });
+
+        // Last col null
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, -11, 43, 0, 0, 8, 0, 0, 0, 4, 11, 22, 0, 8, 0, 0, 0, 4, -44, -66, -1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendByte((byte)11)
+                .appendShort((short)22)
+                .appendNull()
+                .appendByte((byte)-44)
+                .appendShort((short)-66)
+                .appendNull()
+                .build());
+
+        // First col null.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, -53, 2, 0, 0, 11, 0, 0, 0, 1, 22, 0, 33, 0, 0, 0, 11, 0, 0, 0, 1, -55, -1, -66, -1, -1, -1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendShort((byte)22)
+                .appendInt(33)
+                .appendNull()
+                .appendShort((short)-55)
+                .appendInt(-66)
+                .build());
+
+        // Middle col null.
+        assertRowBytesEquals(new byte[] {42, 0, 24, 0, 108, 41, 0, 0, 10, 0, 0, 0, 2, 11, 33, 0, 0, 0, 10, 0, 0, 0, 2, -44, -66, -1, -1, -1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendByte((byte)11)
+                .appendNull()
+                .appendInt(33)
+                .appendByte((byte)-44)
+                .appendNull()
+                .appendInt(-66)
+                .build());
+
+        // Null both.
+        assertRowBytesEquals(new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 7, 5, 0, 0, 0, 7},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(new byte[] {42, 0, 25, 0, 22, 44, 0, 0, 12, 0, 0, 0, 0, 11, 22, 0, 33, 0, 0, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendByte((byte)11)
+                .appendShort((short)22)
+                .appendInt(33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and fix-len nullable value.
+     */
+    @Test
+    public void varlenNullableColumns() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {
+                new Column("keyCol1", STRING, true),
+                new Column("keyCol2", BYTES, true),
+                new Column("keyCol3", STRING, true)
+            },
+            new Column[] {
+                new Column("valCol1", STRING, true),
+                new Column("valCol2", BYTES, true),
+                new Column("valCol3", STRING, true)
+            });
+
+        // Last col null
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 0, 0, 47, -30, -119, -81,
+                17, 0, 0, 0, 4, 1, 0, 12, 0, 33, -77, 120, 97, 115, 99, 105, 105,
+                21, 0, 0, 0, 4, 1, 0, 11, 0, 33, -77, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97},
+            new RowAssembler(schema, 25, 2, 2)
+                .appendBytes(new byte[] {33, -77, 120})
+                .appendString("ascii")
+                .appendNull()
+                .appendBytes(new byte[] {33, -77})
+                .appendString("我愛Java")
+                .appendNull()
+                .build());
+
+        // Fist col null.
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 0, 0, -116, -92, 12, 98,
+                24, 0, 0, 0, 1, 1, 0, 14, 0, 97, 115, 99, 105, 105, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97,
+                24, 0, 0, 0, 1, 1, 0, 19, 0, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97, 97, 115, 99, 105, 105},
+            new RowAssembler(schema, 0, 2, 2)
+                .appendNull()
+                .appendString("ascii")
+                .appendString("我愛Java")
+                .appendNull()
+                .appendString("我愛Java")
+                .appendString("ascii")
+                .build());
+
+        // Middle col null.
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 0, 0, -52, 97, -9, -77,
+                22, 0, 0, 0, 2, 1, 0, 12, 0, 33, -77, 120, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97,
+                16, 0, 0, 0, 2, 1, 0, 11, 0, 33, -77, 97, 115, 99, 105, 105},
+            new RowAssembler(schema, 0, 2, 2)
+                .appendBytes(new byte[] {33, -77, 120})
+                .appendNull()
+                .appendString("我愛Java")
+                .appendBytes(new byte[] {33, -77})
+                .appendNull()
+                .appendString("ascii")
+                .build());
+
+        // Null both.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 7, 5, 0, 0, 0, 7},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 17, 0, -47, -112, 1, 24,
+                29, 0, 0, 0, 0, 2, 0, 14, 0, 24, 0, 33, -77, 120, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97, 97, 115, 99, 105, 105},
+            new RowAssembler(schema, 0, 3, 0)
+                .appendBytes(new byte[] {33, -77, 120})
+                .appendString("我愛Java")
+                .appendString("ascii")
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and fix-len nullable value.
+     */
+    @Test
+    public void mixedTypes() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {
+                new Column("keyCol1", BYTE, true),
+                new Column("keyCol1", SHORT, true),
+                new Column("keyCol2", BYTES, true),
+                new Column("keyCol3", STRING, true)
+            },
+            new Column[] {
+                new Column("valCol1", BYTE, true),
+                new Column("valCol1", SHORT, true),
+                new Column("valCol2", BYTES, true),
+                new Column("valCol3", STRING, true)
+            });
+
+        // Check null/non-null all fixlen/varlen.
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 0, 0, -85, 82, 5, 0,
+                12, 0, 0, 0, 12, 1, 0, 0, 0, 11, 22, 0,
+                16, 0, 0, 0, 3, 1, 0, 11, 0, 77, -88, 97, 115, 99, 105, 105},
+            new RowAssembler(schema, 0, 2, 2)
+                .appendByte((byte)11)
+                .appendShort((short)22)
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendBytes(new byte[] {77, -88})
+                .appendString("ascii")
+                .build());
+
+        // Check null/non-null fixlen.
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 0, 0, -20, 4, 120, -80,
+                23, 0, 0, 0, 1, 1, 0, 13, 0, 22, 0, 33, -44, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97,
+                17, 0, 0, 0, 2, 1, 0, 12, 0, 55, 77, -88, 97, 115, 99, 105, 105},
+            new RowAssembler(schema, 0, 2, 2)
+                .appendNull()
+                .appendShort((short)22)
+                .appendBytes(new byte[] {33, -44})
+                .appendString("我愛Java")
+                .appendByte((byte)55)
+                .appendNull()
+                .appendBytes(new byte[] {77, -88})
+                .appendString("ascii")
+                .build());
+
+        // Check null/non-null varlen.
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 24, 0, 12, 57, 124, -80,
+                18, 0, 0, 0, 4, 11, 22, 0, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97,
+                10, 0, 0, 0, 8, 55, 22, 0, 77, -88},
+            new RowAssembler(schema, 0, 1, 1)
+                .appendByte((byte)11)
+                .appendShort((short)22)
+                .appendNull()
+                .appendString("我愛Java")
+                .appendByte((byte)55)
+                .appendShort((short)22)
+                .appendBytes(new byte[] {77, -88})
+                .appendNull()
+                .build());
+
+        // Check null/non-null mixed.
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 24, 0, -52, -29, 123, -80,
+                16, 0, 0, 0, 6, 11, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97,
+                9, 0, 0, 0, 9, 22, 0, 77, -88},
+            new RowAssembler(schema, 0, 1, 1)
+                .appendByte((byte)11)
+                .appendNull()
+                .appendNull()
+                .appendString("我愛Java")
+                .appendNull()
+                .appendShort((short)22)
+                .appendBytes(new byte[] {77, -88})
+                .appendNull()
+                .build());
+
+        // Check all null/non-null.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 16, 0, -20, 88, 125, -80,
+                24, 0, 0, 0, 0, 1, 0, 14, 0, 11, 22, 0, 33, -44, -26, -120, -111, -26, -124, -101, 74, 97, 118, 97,
+                5, 0, 0, 0, 15},
+            new RowAssembler(schema, 0, 2, 0)
+                .appendByte((byte)11)
+                .appendShort((short)22)
+                .appendBytes(new byte[] {33, -44})
+                .appendString("我愛Java")
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .appendNull()
+                .build());
+    }
+
+    /**
+     * @param expected Expected row bytes.
+     * @param actual Actual row bytes.
+     */
+    private void assertRowBytesEquals(byte[] expected, byte[] actual) {
+        assertArrayEquals(expected, actual, Arrays.toString(actual));
+    }
+}
diff --git a/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerSimpleSchemaTest.java b/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerSimpleSchemaTest.java
new file mode 100644
index 0000000..7733b5a
--- /dev/null
+++ b/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerSimpleSchemaTest.java
@@ -0,0 +1,643 @@
+/*
+ * 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.schema;
+
+import java.util.Arrays;
+import java.util.UUID;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.ignite.internal.schema.NativeTypes.BYTE;
+import static org.apache.ignite.internal.schema.NativeTypes.BYTES;
+import static org.apache.ignite.internal.schema.NativeTypes.INTEGER;
+import static org.apache.ignite.internal.schema.NativeTypes.SHORT;
+import static org.apache.ignite.internal.schema.NativeTypes.STRING;
+import static org.apache.ignite.internal.schema.NativeTypes.UUID;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
+/**
+ * Validate row layout for different schema configurations.
+ */
+public class RowAssemblerSimpleSchemaTest {
+    /** Uuid test value. */
+    public final UUID uuidVal = new UUID(-5204230847775358097L, 4916207022290092939L);
+
+    /** Table ID test value. */
+    public final UUID tableId = java.util.UUID.randomUUID();
+
+    /**
+     * Validate row layout for schema of fix-len non-null key and fix-len nullable value.
+     */
+    @Test
+    public void fixedKeyFixedNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyIntCol", INTEGER, false)},
+            new Column[] {new Column("valIntCol", INTEGER, true)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 26, 0, 33, 0, 0, 0, 8, 0, 0, 0, 33, 0, 0, 0, 9, 0, 0, 0, 0, -71, -1, -1, -1},
+            new RowAssembler(schema, 24, 0, 0)
+                .appendInt(33)
+                .appendInt(-71)
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 26, 0, 33, 0, 0, 0, 8, 0, 0, 0, 33, 0, 0, 0, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 21, 0, 0)
+                .appendInt(33)
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 27, 0, 33, 0, 0, 0, 8, 0, 0, 0, 33, 0, 0, 0},
+            new RowAssembler(schema, 16, 0, 0)
+                .appendInt(33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len non-null key and fix-len non-null value.
+     */
+    @Test
+    public void fixedKeyFixedValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyShortCol", SHORT, false)},
+            new Column[] {new Column("valShortCol", SHORT, false)});
+
+        // With value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 30, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0, 6, 0, 0, 0, -71, -1},
+            new RowAssembler(schema, 20, 0, 0)
+                .appendShort((short)33)
+                .appendShort((short)-71)
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 31, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0},
+            new RowAssembler(schema, 14, 0, 0)
+                .appendShort((short)33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len non-null key and var-len nullable value.
+     */
+    @Test
+    public void fixedKeyVarlenNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyShortCol", SHORT, false)},
+            new Column[] {new Column("valStrCol", STRING, true)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 26, 0, -33, -1, -1, -1, 6, 0, 0, 0, -33, -1, 8, 0, 0, 0, 0, 118, 97, 108},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendShort((short)-33)
+                .appendString("val")
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 26, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 27, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len non-null key and var-len non-null value.
+     */
+    @Test
+    public void fixedKeyVarlenValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyShortCol", SHORT, false)},
+            new Column[] {new Column("valStrCol", STRING, false)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 30, 0, -33, -1, -1, -1, 6, 0, 0, 0, -33, -1, 7, 0, 0, 0, 118, 97, 108},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendShort((short)-33)
+                .appendString("val")
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 31, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and fix-len non-null value.
+     */
+    @Test
+    public void fixedNullableKeyFixedValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyShortCol", SHORT, true)},
+            new Column[] {new Column("valByteCol", BYTE, false)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, -33, -1, -1, -1, 7, 0, 0, 0, 0, -33, -1, 5, 0, 0, 0, 71},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)-33)
+                .appendByte((byte)71)
+                .build());
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, -71},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendByte((byte)-71)
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 29, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 33, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and fix-len nullable value.
+     */
+    @Test
+    public void fixedNullableKeyFixedNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyShortCol", SHORT, true)},
+            new Column[] {new Column("valShortCol", SHORT, true)});
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 7, 0, 0, 0, 0, 33, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendShort((short)33)
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 33, 0, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .appendNull()
+                .build());
+
+        // Null both.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 25, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 33, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .build());
+
+    }
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and var-len nullable value.
+     */
+    @Test
+    public void fixedNullableKeyVarlenNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyIntCol", SHORT, true)},
+            new Column[] {new Column("valStrCol", STRING, true)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 33, 0, 8, 0, 0, 0, 0, 118, 97, 108},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendShort((short)33)
+                .appendString("val")
+                .build());
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 8, 0, 0, 0, 0, 118, 97, 108},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendNull()
+                .appendString("val")
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 33, 0, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .appendNull()
+                .build());
+
+        // Null both.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 25, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 33, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendShort((short)33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of fix-len nullable key and var-len non-null value.
+     */
+    @Test
+    public void fixedNullableKeyVarlenValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyByteCol", BYTE, true)},
+            new Column[] {new Column("valStrCol", STRING, false)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, 33, 0, 0, 0, 6, 0, 0, 0, 0, 33, 7, 0, 0, 0, 118, 97, 108},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendByte((byte)33)
+                .appendString("val").build());
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 7, 0, 0, 0, 118, 97, 108},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendNull()
+                .appendString("val").build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 29, 0, 33, 0, 0, 0, 6, 0, 0, 0, 0, 33},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendByte((byte)33)
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of var-len non-null key and fix-len nullable value.
+     */
+    @Test
+    public void varlenKeyFixedNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, false)},
+            new Column[] {new Column("valUuidCol", UUID, true)});
+
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 26, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121,
+                21, 0, 0, 0, 0, -117, -61, -31, 85, 61, -32, 57, 68, 111, 67, 56, -3, -99, -37, -58, -73},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .appendUuid(uuidVal)
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 26, 0, 95, -98, 1, 0, 7, 0, 0, 0,107, 101, 121, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 1, 0)
+
+                .appendString("key")
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 27, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+
+    }
+
+    /**
+     * Validate row layout for schema of var-len non-null key and fix-len non-null value.
+     */
+    @Test
+    public void varlenKeyFixedValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, false)},
+            new Column[] {new Column("valUuidCol", UUID, false)});
+
+        assertRowBytesEquals(
+            new byte[] {
+                42, 0, 30, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121,
+                20, 0, 0, 0, -117, -61, -31, 85, 61, -32, 57, 68, 111, 67, 56, -3, -99, -37, -58, -73},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .appendUuid(uuidVal)
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 31, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+
+    }
+
+    /**
+     * Validate row layout for schema of var-len non-null key and var-len nullable value.
+     */
+    @Test
+    public void varlenKeyVarlenNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, false)},
+            new Column[] {new Column("valBytesCol", BYTES, true)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 26, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121, 9, 0, 0, 0, 0, -1, 1, 0, 120},
+            new RowAssembler(schema, 0, 1, 1)
+                .appendString("key")
+                .appendBytes(new byte[] {-1, 1, 0, 120})
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 26, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 27, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+
+    }
+
+    /**
+     * Validate row layout for schema of var-len non-null key and var-len non-null value.
+     */
+    @Test
+    public void varlenKeyVarlenValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, false)},
+            new Column[] {new Column("valBytesCol", BYTES, false)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 30, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121, 8, 0, 0, 0, -1, 1, 0, 120},
+            new RowAssembler(schema, 0, 1, 1)
+                .appendString("key")
+                .appendBytes(new byte[] {-1, 1, 0, 120})
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 31, 0, 95, -98, 1, 0, 7, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of var-len nullable key and fix-len nullable value.
+     */
+    @Test
+    public void varlenNullableKeyFixedNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, true)},
+            new Column[] {new Column("valShortCol", SHORT, true)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121, 7, 0, 0, 0, 0, -71, -1},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .appendShort((short)-71)
+                .build());
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 7, 0, 0, 0, 0, 71, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendShort((short)71)
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .appendNull()
+                .build());
+
+        // Null both.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 25, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+
+    }
+
+    /**
+     * Validate row layout for schema of var-len nullable key and fix-len non-null value.
+     */
+    @Test
+    public void varlenNullableKeyFixedValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, true)},
+            new Column[] {new Column("valShortCol", SHORT, false)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121, 6, 0, 0, 0, -71, -1},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .appendShort((short)-71L)
+                .build());
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 6, 0, 0, 0, 71, 0},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendShort((short)71)
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 29, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of var-len nullable key and var-len nullable value.
+     */
+    @Test
+    public void varlenNullableKeyVarlenNullableValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, true)},
+            new Column[] {new Column("valBytesCol", BYTES, true)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121, 9, 0, 0, 0, 0, -1, 1, 0, 120},
+            new RowAssembler(schema, 0, 1, 1)
+                .appendString("key")
+                .appendBytes(new byte[] {-1, 1, 0, 120})
+                .build());
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 9, 0, 0, 0, 0, -1, 1, 0, 120},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendNull()
+                .appendBytes(new byte[] {-1, 1, 0, 120})
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .appendNull()
+                .build());
+
+        // Null both.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1},
+            new RowAssembler(schema, 0, 0, 0)
+                .appendNull()
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 25, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+    }
+
+    /**
+     * Validate row layout for schema of var-len nullable key and var-len non-null value.
+     */
+    @Test
+    public void varlenNullableKeyVarlenValue() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {new Column("keyStrCol", STRING, true)},
+            new Column[] {new Column("valBytesCol", BYTES, false)});
+
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121, 8, 0, 0, 0, -1, 1, 0, 120},
+            new RowAssembler(schema, 0, 1, 1)
+                .appendString("key")
+                .appendBytes(new byte[] {-1, 1, 0, 120})
+                .build());
+
+        // Null key.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 28, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 8, 0, 0, 0, -1, 1, 0, 120},
+            new RowAssembler(schema, 0, 0, 1)
+                .appendNull()
+                .appendBytes(new byte[] {-1, 1, 0, 120})
+                .build());
+
+        // No value.
+        assertRowBytesEquals(
+            new byte[] {42, 0, 29, 0, 95, -98, 1, 0, 8, 0, 0, 0, 0, 107, 101, 121},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendString("key")
+                .build());
+    }
+
+    /**
+     * Validate row layout for key\value columns of different types.
+     */
+    @Test
+    public void mixedTypes() {
+        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42,
+            new Column[] {
+                new Column("keyShortCol", SHORT, false),
+                new Column("keyStrCol", STRING, false)
+            },
+            new Column[] {
+                new Column("valIntCol", INTEGER, true),
+                new Column("valStrCol", STRING, true)
+            });
+
+        assertRowBytesEquals(new byte[] {
+                42, 0, 26, 0, -110, -109, 94, -68,
+                12, 0, 0, 0, 33, 0, 107, 101, 121, 115, 116, 114,
+                15, 0, 0, 0, 0, 73, 0, 0, 0, 118, 97, 108, 115, 116, 114},
+            new RowAssembler(schema, 0, 1, 1)
+                .appendShort((short)33)
+                .appendString("keystr")
+                .appendInt(73)
+                .appendString("valstr")
+                .build());
+
+        // Null value.
+        assertRowBytesEquals(new byte[] {
+                42, 0, 26, 0, 32, 99, 115, -49,
+                13, 0, 0, 0, 33, 0, 107, 101, 121, 115, 116, 114, 50,
+                5, 0, 0, 0, 3},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendShort((short)33)
+                .appendString("keystr2")
+                .appendNull()
+                .appendNull()
+                .build());
+
+        // No value.
+        assertRowBytesEquals(new byte[] {
+                42, 0, 27, 0, -110, -109, 94, -68,
+                12, 0, 0, 0, 33, 0, 107, 101, 121, 115, 116, 114},
+            new RowAssembler(schema, 0, 1, 0)
+                .appendShort((short)33)
+                .appendString("keystr")
+                .build());
+    }
+
+    /**
+     * @param expected Expected row bytes.
+     * @param actual Actual row bytes.
+     */
+    private void assertRowBytesEquals(byte[] expected, byte[] actual) {
+        assertArrayEquals(expected, actual, Arrays.toString(actual));
+    }
+}
diff --git a/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java b/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java
deleted file mode 100644
index 86edaef..0000000
--- a/modules/schema/src/test/java/org/apache/ignite/internal/schema/RowAssemblerTest.java
+++ /dev/null
@@ -1,738 +0,0 @@
-/*
- * 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.schema;
-
-import java.util.Arrays;
-import java.util.UUID;
-import org.junit.jupiter.api.Test;
-
-import static org.apache.ignite.internal.schema.NativeTypes.BYTE;
-import static org.apache.ignite.internal.schema.NativeTypes.BYTES;
-import static org.apache.ignite.internal.schema.NativeTypes.INTEGER;
-import static org.apache.ignite.internal.schema.NativeTypes.SHORT;
-import static org.apache.ignite.internal.schema.NativeTypes.STRING;
-import static org.apache.ignite.internal.schema.NativeTypes.UUID;
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-
-/**
- * Validate row layout for different schema configurations.
- */
-public class RowAssemblerTest {
-    /** Uuid test value. */
-    public final java.util.UUID uuidVal = new UUID(-5204230847775358097L, 4916207022290092939L);
-
-    /** Table ID test value. */
-    public final java.util.UUID tableId = java.util.UUID.randomUUID();
-
-    /**
-     * Validate row layout for schema of fix-len non-null key and fix-len nullable value.
-     */
-    @Test
-    public void fixedKeyFixedNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyIntCol", INTEGER, false)};
-        Column[] valCols = new Column[] {new Column("valIntCol", INTEGER, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendInt(33);
-            asm.appendInt(-71);
-
-            assertRowBytesEquals(new byte[] {42, 0, 26, 0, 33, 0, 0, 0, 8, 0, 0, 0, 33, 0, 0, 0, 9, 0, 0, 0, 0, -71, -1, -1, -1}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendInt(-33);
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 26, 0, -33, -1, -1, -1, 8, 0, 0, 0, -33, -1, -1, -1, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendInt(-33);
-
-            assertRowBytesEquals(new byte[] {42, 0, 27, 0, -33, -1, -1, -1, 8, 0, 0, 0, -33, -1, -1, -1}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of fix-len non-null key and fix-len non-null value.
-     */
-    @Test
-    public void fixedKeyFixedValue() {
-        Column[] keyCols = new Column[] {new Column("keyShortCol", SHORT, false)};
-        Column[] valCols = new Column[] {new Column("valShortCol", SHORT, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        { // With value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)33);
-            asm.appendShort((short)71L);
-
-            assertRowBytesEquals(new byte[] {42, 0, 30, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0, 6, 0, 0, 0, 71, 0}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)-33);
-
-            assertRowBytesEquals(new byte[] {42, 0, 31, 0, -33, -1, -1, -1, 6, 0, 0, 0, -33, -1}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of fix-len non-null key and var-len nullable value.
-     */
-    @Test
-    public void fixedKeyVarlenNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyShortCol", SHORT, false)};
-        Column[] valCols = new Column[] {new Column("valStrCol", STRING, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendShort((short)-33);
-            asm.appendString("val");
-
-            assertRowBytesEquals(new byte[] {42, 0, 10, 0, -33, -1, -1, -1, 6, 0, 0, 0, -33, -1, 12, 0, 0, 0, 0, 1, 0, 9, 0, 118, 97, 108}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)33);
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 26, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)33);
-
-            assertRowBytesEquals(new byte[] {42, 0, 27, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of fix-len non-null key and var-len non-null value.
-     */
-    @Test
-    public void fixedKeyVarlenValue() {
-        Column[] keyCols = new Column[] {new Column("keyShortCol", SHORT, false)};
-        Column[] valCols = new Column[] {new Column("valStrCol", STRING, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendShort((short)-33);
-            asm.appendString("val");
-
-            assertRowBytesEquals(new byte[] {42, 0, 14, 0, -33, -1, -1, -1, 6, 0, 0, 0, -33, -1, 11, 0, 0, 0, 1, 0, 8, 0, 118, 97, 108}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)33);
-
-            assertRowBytesEquals(new byte[] {42, 0, 31, 0, 33, 0, 0, 0, 6, 0, 0, 0, 33, 0}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of fix-len nullable key and fix-len non-null value.
-     */
-    @Test
-    public void fixedNullableKeyFixedValue() {
-        Column[] keyCols = new Column[] {new Column("keyShortCol", SHORT, true)};
-        Column[] valCols = new Column[] {new Column("valByteCol", BYTE, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)-33);
-            asm.appendByte((byte)71);
-
-            assertRowBytesEquals(new byte[] {42, 0, 28, 0, -33, -1, -1, -1, 7, 0, 0, 0, 0, -33, -1, 5, 0, 0, 0, 71}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendByte((byte)-71);
-
-            assertRowBytesEquals(new byte[] {42, 0, 28, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, -71}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)33);
-
-            assertRowBytesEquals(new byte[] {42, 0, 29, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 33, 0}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of fix-len nullable key and fix-len nullable value.
-     */
-    @Test
-    public void fixedNullableKeyFixedNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyShortCol", SHORT, true)};
-        Column[] valCols = new Column[] {new Column("valShortCol", SHORT, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)-1133);
-            asm.appendShort((short)-1071);
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, -109, -5, -1, -1, 7, 0, 0, 0, 0, -109, -5, 7, 0, 0, 0, 0, -47, -5}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendShort((short)1171);
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 7, 0, 0, 0, 0, -109, 4}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)1133);
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 109, 4, 0, 0, 7, 0, 0, 0, 0, 109, 4, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // Null both.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendShort((short)1133);
-
-            assertRowBytesEquals(new byte[] {42, 0, 25, 0, 109, 4, 0, 0, 7, 0, 0, 0, 0, 109, 4}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of fix-len nullable key and var-len nullable value.
-     */
-    @Test
-    public void fixedNullableKeyVarlenNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyIntCol", INTEGER, true)};
-        Column[] valCols = new Column[] {new Column("valStrCol", STRING, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendInt(-33);
-            asm.appendString("val");
-
-            assertRowBytesEquals(new byte[] {42, 0, 8, 0, -33, -1, -1, -1, 9, 0, 0, 0, 0, -33, -1, -1, -1, 12, 0, 0, 0, 0, 1, 0, 9, 0, 118, 97, 108}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendNull();
-            asm.appendString("val");
-
-            assertRowBytesEquals(new byte[] {42, 0, 8, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 12, 0, 0, 0, 0, 1, 0, 9, 0, 118, 97, 108}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendInt(33);
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 33, 0, 0, 0, 9, 0, 0, 0, 0, 33, 0, 0, 0, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // Null both.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendInt(33);
-
-            assertRowBytesEquals(new byte[] {42, 0, 25, 0, 33, 0, 0, 0, 9, 0, 0, 0, 0, 33, 0, 0, 0}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of fix-len nullable key and var-len non-null value.
-     */
-    @Test
-    public void fixedNullableKeyVarlenValue() {
-        Column[] keyCols = new Column[] {new Column("keyByteCol", BYTE, true)};
-        Column[] valCols = new Column[] {new Column("valStrCol", STRING, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendByte((byte)-33);
-            asm.appendString("val");
-
-            assertRowBytesEquals(new byte[] {42, 0, 12, 0, -33, -1, -1, -1, 6, 0, 0, 0, 0, -33, 11, 0, 0, 0, 1, 0, 8, 0, 118, 97, 108}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendNull();
-            asm.appendString("val");
-
-            assertRowBytesEquals(new byte[] {42, 0, 12, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 11, 0, 0, 0, 1, 0, 8, 0, 118, 97, 108}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendByte((byte)33);
-
-            assertRowBytesEquals(new byte[] {42, 0, 29, 0, 33, 0, 0, 0, 6, 0, 0, 0, 0, 33}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len non-null key and fix-len nullable value.
-     */
-    @Test
-    public void varlenKeyFixedNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, false)};
-        Column[] valCols = new Column[] {new Column("valUuidCol", UUID, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendUuid(uuidVal);
-
-            assertRowBytesEquals(new byte[] {
-                42, 0, 18, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121,
-                21, 0, 0, 0, 0, -117, -61, -31, 85, 61, -32, 57, 68, 111, 67, 56, -3, -99, -37, -58, -73}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 18, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 19, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len non-null key and fix-len non-null value.
-     */
-    @Test
-    public void varlenKeyFixedValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, false)};
-        Column[] valCols = new Column[] {new Column("valUuidCol", UUID, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendUuid(uuidVal);
-
-            assertRowBytesEquals(new byte[] {
-                42, 0, 22, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121,
-                20, 0, 0, 0, -117, -61, -31, 85, 61, -32, 57, 68, 111, 67, 56, -3, -99, -37, -58, -73}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 23, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len non-null key and var-len nullable value.
-     */
-    @Test
-    public void varlenKeyVarlenNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, false)};
-        Column[] valCols = new Column[] {new Column("valBytesCol", BYTES, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 1);
-
-            asm.appendString("key");
-            asm.appendBytes(new byte[] {-1, 1, 0, 120});
-
-            assertRowBytesEquals(new byte[] {42, 0, 2, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121, 13, 0, 0, 0, 0, 1, 0, 9, 0, -1, 1, 0, 120}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 18, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 19, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len non-null key and var-len non-null value.
-     */
-    @Test
-    public void varlenKeyVarlenValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, false)};
-        Column[] valCols = new Column[] {new Column("valBytesCol", BYTES, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 1);
-
-            asm.appendString("key");
-            asm.appendBytes(new byte[] {-1, 1, 0, 120});
-
-            assertRowBytesEquals(new byte[] {42, 0, 6, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121, 12, 0, 0, 0, 1, 0, 8, 0, -1, 1, 0, 120}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 23, 0, 95, -98, 1, 0, 11, 0, 0, 0, 1, 0, 8, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len nullable key and fix-len nullable value.
-     */
-    @Test
-    public void varlenNullableKeyFixedNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, true)};
-        Column[] valCols = new Column[] {new Column("valShortCol", SHORT, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendShort((short)-71);
-
-            assertRowBytesEquals(new byte[] {42, 0, 16, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121, 7, 0, 0, 0, 0, -71, -1}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendShort((short)71);
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 7, 0, 0, 0, 0, 71, 0}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 16, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // Null both.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 17, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len nullable key and fix-len non-null value.
-     */
-    @Test
-    public void varlenNullableKeyFixedValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, true)};
-        Column[] valCols = new Column[] {new Column("valShortCol", SHORT, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendShort((short)-71L);
-
-            assertRowBytesEquals(new byte[] {42, 0, 20, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121, 6, 0, 0, 0, -71, -1}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendShort((short)71);
-
-            assertRowBytesEquals(new byte[] {42, 0, 28, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 6, 0, 0, 0, 71, 0}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 21, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len nullable key and var-len nullable value.
-     */
-    @Test
-    public void varlenNullableKeyVarlenNullableValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, true)};
-        Column[] valCols = new Column[] {new Column("valBytesCol", BYTES, true)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 1);
-
-            asm.appendString("key");
-            asm.appendBytes(new byte[] {-1, 1, 0, 120});
-
-            assertRowBytesEquals(new byte[] {42, 0, 0, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121, 13, 0, 0, 0, 0, 1, 0, 9, 0, -1, 1, 0, 120}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendNull();
-            asm.appendBytes(new byte[] {-1, 1, 0, 120});
-
-            assertRowBytesEquals(new byte[] {42, 0, 8, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 13, 0, 0, 0, 0, 1, 0, 9, 0, -1, 1, 0, 120}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 16, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // Null both.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 0);
-
-            asm.appendNull();
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {42, 0, 24, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 5, 0, 0, 0, 1}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 17, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for schema of var-len nullable key and var-len non-null value.
-     */
-    @Test
-    public void varlenNullableKeyVarlenValue() {
-        Column[] keyCols = new Column[] {new Column("keyStrCol", STRING, true)};
-        Column[] valCols = new Column[] {new Column("valBytesCol", BYTES, false)};
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId, 42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 1);
-
-            asm.appendString("key");
-            asm.appendBytes(new byte[] {-1, 1, 0, 120});
-
-            assertRowBytesEquals(new byte[] {42, 0, 4, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121, 12, 0, 0, 0, 1, 0, 8, 0, -1, 1, 0, 120}, asm.build());
-        }
-
-        { // Null key.
-            RowAssembler asm = new RowAssembler(schema, 0, 0, 1);
-
-            asm.appendNull();
-            asm.appendBytes(new byte[] {-1, 1, 0, 120});
-
-            assertRowBytesEquals(new byte[] {42, 0, 12, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 12, 0, 0, 0, 1, 0, 8, 0, -1, 1, 0, 120}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendString("key");
-
-            assertRowBytesEquals(new byte[] {42, 0, 21, 0, 95, -98, 1, 0, 12, 0, 0, 0, 0, 1, 0, 9, 0, 107, 101, 121}, asm.build());
-        }
-    }
-
-    /**
-     * Validate row layout for key\value columns of different types.
-     */
-    @Test
-    public void mixedTypes() {
-        Column[] keyCols = new Column[] {
-            new Column("keyShortCol", SHORT, false),
-            new Column("keyStrCol", STRING, false)
-        };
-        Column[] valCols = new Column[] {
-            new Column("valIntCol", INTEGER, true),
-            new Column("valStrCol", STRING, true)
-        };
-
-        SchemaDescriptor schema = new SchemaDescriptor(tableId,42, keyCols, valCols);
-
-        {
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 1);
-
-            asm.appendShort((short)33);
-            asm.appendString("keystr");
-            asm.appendInt(73);
-            asm.appendString("valstr");
-
-            assertRowBytesEquals(new byte[] {
-                42, 0, 2, 0, -110, -109, 94, -68,
-                16, 0, 0, 0, 1, 0, 10, 0, 33, 0, 107, 101, 121, 115, 116, 114,
-                19, 0, 0, 0, 0, 1, 0, 13, 0, 73, 0, 0, 0, 118, 97, 108, 115, 116, 114}, asm.build());
-        }
-
-        { // Null value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendShort((short)33);
-            asm.appendString("keystr2");
-            asm.appendNull();
-            asm.appendNull();
-
-            assertRowBytesEquals(new byte[] {
-                42, 0, 18, 0, 32, 99, 115, -49,
-                17, 0, 0, 0, 1, 0, 10, 0, 33, 0, 107, 101, 121, 115, 116, 114, 50,
-                5, 0, 0, 0, 3}, asm.build());
-        }
-
-        { // No value.
-            RowAssembler asm = new RowAssembler(schema, 0, 1, 0);
-
-            asm.appendShort((short)33);
-            asm.appendString("keystr");
-
-            assertRowBytesEquals(new byte[] {
-                42, 0, 19, 0, -110, -109, 94, -68,
-                16, 0, 0, 0, 1, 0, 10, 0, 33, 0, 107, 101, 121, 115, 116, 114}, asm.build());
-
-        }
-    }
-
-    /**
-     * @param expected Expected row bytes.
-     * @param actual Actual row bytes.
-     */
-    private void assertRowBytesEquals(byte[] expected, byte[] actual) {
-        assertArrayEquals(expected, actual, Arrays.toString(actual));
-    }
-}