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

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

commit d4020a9da8836b7be65bfbd55c6ef631d00a4bb9
Author: amashenkov <[email protected]>
AuthorDate: Tue Dec 2 18:16:39 2025 +0300

    wip
---
 .../client/proto/ClientBinaryTupleUtils.java       |   5 +-
 .../requests/table/ClientHandlerTupleTests.java    |   6 +-
 .../internal/client/compute/ClientCompute.java     |   3 +-
 .../client/table/ClientKeyValueBinaryView.java     |   4 +-
 .../client/table/ClientRecordBinaryView.java       |   2 +-
 .../client/table/ClientTupleSerializer.java        |  23 +++-
 .../ignite/internal/rebalance/ItRebalanceTest.java |   2 +-
 .../internal/marshaller/ValidationUtils.java       |   3 +-
 .../internal/marshaller/FieldAccessorTest.java     |   4 +-
 .../Table/SchemaValidationTest.cs                  |  14 +--
 .../ItRaftCommandLeftInLogUntilRestartTest.java    |   2 +-
 .../runner/app/PlatformTestNodeRunner.java         |   4 +-
 .../app/client/ItThinClientMarshallingTest.java    | 136 +++++++++++----------
 .../ItThinClientSchemaSynchronizationTest.java     |  28 ++---
 .../internal/table/ItThinClientColocationTest.java |   2 +-
 .../internal/schema/SchemaMismatchException.java   |  10 ++
 .../schema/marshaller/KvMarshallerTest.java        |   2 +-
 .../schema/marshaller/RecordMarshallerTest.java    |   2 +-
 .../ignite/internal/table/ItColocationTest.java    |   2 +-
 .../table/ItKeyValueBinaryViewApiTest.java         |   6 +-
 .../internal/table/ItRecordBinaryViewApiTest.java  |   4 +-
 ...bstractHighAvailablePartitionsRecoveryTest.java |   2 +-
 .../schema/marshaller/TupleMarshallerImpl.java     |  36 ++++--
 .../internal/table/KeyValueBinaryViewImpl.java     |   2 +-
 .../internal/table/RecordBinaryViewImpl.java       |   2 +-
 .../apache/ignite/internal/table/TableImpl.java    |   2 +-
 .../internal/table/TupleMarshallerCache.java       |   7 +-
 .../table/partition/HashPartitionManagerImpl.java  |   2 +-
 .../TupleMarshallerFixlenOnlyBenchmark.java        |   4 +-
 .../TupleMarshallerVarlenOnlyBenchmark.java        |   4 +-
 .../marshaller/TupleMarshallerStatisticsTest.java  |   3 +-
 .../table/ColocationHashCalculationTest.java       |   5 +-
 .../internal/table/MutableRowTupleAdapterTest.java |  33 +++--
 .../table/TableKvOperationsMockedTest.java         |   6 +-
 .../table/type/NumericTypesSerializerTest.java     |  29 ++---
 .../ignite/internal/table/KeyValueTestUtils.java   |   9 ++
 .../ignite/internal/table/TxAbstractTest.java      |   3 +-
 37 files changed, 232 insertions(+), 181 deletions(-)

diff --git 
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
 
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
index 3b74cb57dcc..73bc9cb2c33 100644
--- 
a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
+++ 
b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientBinaryTupleUtils.java
@@ -32,7 +32,6 @@ import 
org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
 import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
 import org.apache.ignite.internal.type.NativeType;
 import org.apache.ignite.internal.type.NativeTypes;
-import org.apache.ignite.lang.ErrorGroups.Marshalling;
 import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.lang.MarshallerException;
 import org.apache.ignite.sql.ColumnType;
@@ -269,8 +268,6 @@ public class ClientBinaryTupleUtils {
             if (nativeType == null) {
                 // Unsupported type (does not map to any Ignite type) - throw 
(same behavior as embedded).
                 throw new MarshallerException(
-                        UUID.randomUUID(),
-                        Marshalling.COMMON_ERR,
                         String.format(
                                 "Invalid value type provided for column 
[name='%s', expected='%s', actual='%s']",
                                 name,
@@ -287,7 +284,7 @@ public class ClientBinaryTupleUtils {
                     name, type.name(), actualType.name()
             );
 
-            throw new IgniteException(PROTOCOL_ERR, error, e);
+            throw new MarshallerException(error, e);
         }
     }
 
diff --git 
a/modules/client-handler/src/test/java/org/apache/ignite/client/handler/requests/table/ClientHandlerTupleTests.java
 
b/modules/client-handler/src/test/java/org/apache/ignite/client/handler/requests/table/ClientHandlerTupleTests.java
index 8afb162e810..4a75aad34b3 100644
--- 
a/modules/client-handler/src/test/java/org/apache/ignite/client/handler/requests/table/ClientHandlerTupleTests.java
+++ 
b/modules/client-handler/src/test/java/org/apache/ignite/client/handler/requests/table/ClientHandlerTupleTests.java
@@ -42,7 +42,7 @@ import java.util.UUID;
 import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
 import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
+import org.apache.ignite.internal.table.KeyValueTestUtils;
 import org.apache.ignite.internal.testframework.IgniteTestUtils;
 import org.apache.ignite.internal.type.NativeTypes;
 import org.apache.ignite.table.Tuple;
@@ -87,7 +87,7 @@ public class ClientHandlerTupleTests {
     public void testTupleEquality() {
         Tuple tuple = createTuple();
 
-        BinaryTupleReader binaryTuple = new 
TupleMarshallerImpl(fullSchema).marshal(tuple).binaryTuple();
+        BinaryTupleReader binaryTuple = 
KeyValueTestUtils.createMarshaller(fullSchema).marshal(tuple).binaryTuple();
         Tuple clientHandlerTuple = new ClientHandlerTuple(fullSchema, null, 
binaryTuple, false);
 
         assertEquals(tuple, clientHandlerTuple);
@@ -97,7 +97,7 @@ public class ClientHandlerTupleTests {
     public void testTupleEqualityKeyOnly() {
         Tuple tuple = createKeyTuple();
 
-        BinaryTupleReader binaryTuple = new 
TupleMarshallerImpl(fullSchema).marshalKey(tuple).binaryTuple();
+        BinaryTupleReader binaryTuple = 
KeyValueTestUtils.createMarshaller(fullSchema).marshalKey(tuple).binaryTuple();
         Tuple clientHandlerTuple = new ClientHandlerTuple(fullSchema, null, 
binaryTuple, true);
 
         assertEquals(tuple, clientHandlerTuple);
diff --git 
a/modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java
 
b/modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java
index f0ddd57e267..5f64e7261e3 100644
--- 
a/modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java
+++ 
b/modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java
@@ -386,9 +386,10 @@ public class ClientCompute implements IgniteCompute {
             JobDescriptor<T, R> descriptor,
             T arg
     ) {
+        ClientTupleSerializer ser = new ClientTupleSerializer(t.tableId(), 
t::qualifiedName);
         return executeColocatedInternal(
                 t,
-                (outputChannel, schema) -> 
ClientTupleSerializer.writeTupleRaw(key, schema, outputChannel, true),
+                (outputChannel, schema) -> ser.writeTupleRaw(key, schema, 
outputChannel, true),
                 ClientTupleSerializer.getPartitionAwarenessProvider(key),
                 descriptor,
                 arg
diff --git 
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientKeyValueBinaryView.java
 
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientKeyValueBinaryView.java
index c5c65c11e79..4e8aaed9b27 100644
--- 
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientKeyValueBinaryView.java
+++ 
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientKeyValueBinaryView.java
@@ -74,7 +74,7 @@ public class ClientKeyValueBinaryView extends 
AbstractClientView<Entry<Tuple, Tu
     ClientKeyValueBinaryView(ClientTable tbl, ClientSql sql) {
         super(tbl, sql);
 
-        ser = new ClientTupleSerializer(tbl.tableId());
+        ser = new ClientTupleSerializer(tbl.tableId(), tbl::qualifiedName);
     }
 
     /** {@inheritDoc} */
@@ -91,7 +91,7 @@ public class ClientKeyValueBinaryView extends 
AbstractClientView<Entry<Tuple, Tu
         return tbl.doSchemaOutInOpAsync(
                 ClientOp.TUPLE_GET,
                 (s, w, n) -> ser.writeTuple(tx, key, s, w, n, true),
-                (s, r) -> ClientTupleSerializer.readValueTuple(s, r.in()),
+                (s, r) -> ser.readValueTuple(s, r.in()),
                 null,
                 getPartitionAwarenessProvider(key),
                 tx);
diff --git 
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientRecordBinaryView.java
 
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientRecordBinaryView.java
index 426532278ef..9e9604561ae 100644
--- 
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientRecordBinaryView.java
+++ 
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientRecordBinaryView.java
@@ -62,7 +62,7 @@ public class ClientRecordBinaryView extends 
AbstractClientView<Tuple> implements
     ClientRecordBinaryView(ClientTable tbl, ClientSql sql) {
         super(tbl, sql);
 
-        ser = new ClientTupleSerializer(tbl.tableId());
+        ser = new ClientTupleSerializer(tbl.tableId(), tbl::qualifiedName);
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
 
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
index 7b52ccb4f66..0d8a93e08d4 100644
--- 
a/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
+++ 
b/modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleSerializer.java
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.function.Supplier;
 import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
 import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
 import org.apache.ignite.internal.client.PayloadOutputChannel;
@@ -38,8 +39,11 @@ import 
org.apache.ignite.internal.client.proto.ClientMessagePacker;
 import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
 import org.apache.ignite.internal.client.proto.TuplePart;
 import org.apache.ignite.internal.lang.IgniteBiTuple;
+import org.apache.ignite.internal.lang.IgniteStringFormatter;
 import org.apache.ignite.internal.marshaller.UnmappedColumnsException;
 import org.apache.ignite.internal.util.HashCalculator;
+import org.apache.ignite.lang.MarshallerException;
+import org.apache.ignite.table.QualifiedName;
 import org.apache.ignite.table.Tuple;
 import org.apache.ignite.table.TupleHelper;
 import org.apache.ignite.table.mapper.Mapper;
@@ -53,13 +57,18 @@ public class ClientTupleSerializer {
     /** Table ID. */
     private final int tableId;
 
+    /** Table name resolver. */
+    private final Supplier<QualifiedName> tableNameSupplier;
+
     /**
      * Constructor.
      *
      * @param tableId Table id.
+     * @param tableNameSupplier Supplier of table name.
      */
-    ClientTupleSerializer(int tableId) {
+    public ClientTupleSerializer(int tableId, Supplier<QualifiedName> 
tableNameSupplier) {
         this.tableId = tableId;
+        this.tableNameSupplier = tableNameSupplier;
     }
 
     /**
@@ -136,7 +145,7 @@ public class ClientTupleSerializer {
      * @param out Out.
      * @param keyOnly Key only.
      */
-    public static void writeTupleRaw(Tuple tuple, ClientSchema schema, 
PayloadOutputChannel out, boolean keyOnly) {
+    public void writeTupleRaw(Tuple tuple, ClientSchema schema, 
PayloadOutputChannel out, boolean keyOnly) {
         var columns = keyOnly ? schema.keyColumns() : schema.columns();
 
         var builder = new BinaryTupleBuilder(columns.length);
@@ -483,7 +492,7 @@ public class ClientTupleSerializer {
         return hashCalc.hash();
     }
 
-    private static void throwSchemaMismatchException(Tuple tuple, ClientSchema 
schema, TuplePart part) {
+    private void throwSchemaMismatchException(Tuple tuple, ClientSchema 
schema, TuplePart part) {
         Set<String> extraColumns = new HashSet<>();
 
         for (int i = 0; i < tuple.columnCount(); i++) {
@@ -502,7 +511,11 @@ public class ClientTupleSerializer {
             prefix = "Value tuple";
         }
 
-        throw new IllegalArgumentException(String.format("%s doesn't match 
schema: schemaVersion=%s, extraColumns=%s",
-                prefix, schema.version(), extraColumns), new 
UnmappedColumnsException());
+        QualifiedName tableName = tableNameSupplier.get();
+
+        String message = IgniteStringFormatter.format("Failed to serialize 
tuple for table {}:"
+                        + " {} doesn't match schema: schemaVersion={}, 
extraColumns={}",
+                tableName.toCanonicalForm(), prefix, schema.version(), 
extraColumns);
+        throw new MarshallerException(message, new UnmappedColumnsException());
     }
 }
diff --git 
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
 
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
index 704b4ebadb6..33878a2c2d0 100644
--- 
a/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
+++ 
b/modules/distribution-zones/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceTest.java
@@ -148,7 +148,7 @@ public class ItRebalanceTest extends 
ClusterPerTestIntegrationTest {
 
     private static Row marshalTuple(TableViewInternal table, Tuple tuple) {
         SchemaRegistry schemaReg = table.schemaView();
-        var marshaller = new TupleMarshallerImpl(schemaReg.lastKnownSchema());
+        var marshaller = new TupleMarshallerImpl(table::qualifiedName, 
schemaReg.lastKnownSchema());
 
         return marshaller.marshal(tuple);
     }
diff --git 
a/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/ValidationUtils.java
 
b/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/ValidationUtils.java
index bb7f1ac56c0..f76bd26a1dd 100644
--- 
a/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/ValidationUtils.java
+++ 
b/modules/marshaller-common/src/main/java/org/apache/ignite/internal/marshaller/ValidationUtils.java
@@ -25,6 +25,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.UUID;
+import org.apache.ignite.lang.MarshallerException;
 import org.apache.ignite.table.mapper.Mapper;
 import org.jetbrains.annotations.Nullable;
 
@@ -42,7 +43,7 @@ public class ValidationUtils {
     public static void validateColumnType(MarshallerColumn col, Class<?> cls) {
         if (!isColumnCompatible(col.type(), cls)) {
             // Exception message is similar to embedded mode - see 
o.a.i.i.schema.Column#validate
-            throw new ClassCastException("Column's type mismatch ["
+            throw new MarshallerException("Column's type mismatch ["
                     + "column=" + col.name()
                     + ", expectedType=" + col.type()
                     + ", actualType=" + cls + ']');
diff --git 
a/modules/marshaller-common/src/test/java/org/apache/ignite/internal/marshaller/FieldAccessorTest.java
 
b/modules/marshaller-common/src/test/java/org/apache/ignite/internal/marshaller/FieldAccessorTest.java
index 8fb1a74c077..79ef9e4d1b2 100644
--- 
a/modules/marshaller-common/src/test/java/org/apache/ignite/internal/marshaller/FieldAccessorTest.java
+++ 
b/modules/marshaller-common/src/test/java/org/apache/ignite/internal/marshaller/FieldAccessorTest.java
@@ -297,7 +297,7 @@ public class FieldAccessorTest extends 
BaseIgniteAbstractTest {
     public void wrongAccessor() {
         // Incompatible types.
         assertThrows(
-                ClassCastException.class,
+                MarshallerException.class,
                 () -> FieldAccessor.create(
                         TestObjectWrapper.class,
                         "data",
@@ -308,7 +308,7 @@ public class FieldAccessorTest extends 
BaseIgniteAbstractTest {
 
         // Implicit serialization is not supported yet.
         assertThrows(
-                ClassCastException.class,
+                MarshallerException.class,
                 () -> FieldAccessor.create(
                         TestObjectWrapper.class,
                         "data",
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs
index fdc13f9785a..51431b95c98 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs
@@ -120,7 +120,7 @@ public class SchemaValidationTest : IgniteTestsBase
         };
 
         var ex = Assert.ThrowsAsync<MarshallerException>(async () => await 
TableRequiredVal.RecordBinaryView.UpsertAsync(null, igniteTuple));
-        StringAssert.StartsWith("Column 'VAL' does not allow NULLs", 
ex!.Message);
+        StringAssert.Contains("Column 'VAL' does not allow NULLs", 
ex!.Message);
     }
 
     [Test]
@@ -134,7 +134,7 @@ public class SchemaValidationTest : IgniteTestsBase
         };
 
         var ex = Assert.ThrowsAsync<MarshallerException>(async () => await 
Table.KeyValueBinaryView.PutAsync(null, keyTuple, valTuple));
-        Assert.AreEqual("Missed key column: KEY", ex!.Message);
+        StringAssert.Contains("Missed key column: KEY", ex!.Message);
     }
 
     [Test]
@@ -149,7 +149,7 @@ public class SchemaValidationTest : IgniteTestsBase
 
         var ex = Assert.ThrowsAsync<MarshallerException>(
             async () => await 
TableRequiredVal.KeyValueBinaryView.PutAsync(null, keyTuple, valTuple));
-        StringAssert.StartsWith("Column 'VAL' does not allow NULLs", 
ex!.Message);
+        StringAssert.Contains("Column 'VAL' does not allow NULLs", 
ex!.Message);
     }
 
     [Test]
@@ -249,7 +249,7 @@ public class SchemaValidationTest : IgniteTestsBase
     {
         var ex = Assert.ThrowsAsync<MarshallerException>(async () => await 
Table.GetRecordView<ValPoco>().UpsertAsync(null, new ValPoco()));
 
-        Assert.AreEqual("Missed key column: KEY", ex!.Message);
+        StringAssert.Contains("Missed key column: KEY", ex!.Message);
     }
 
     [Test]
@@ -258,7 +258,7 @@ public class SchemaValidationTest : IgniteTestsBase
         var ex = Assert.ThrowsAsync<MarshallerException>(
             async () => await 
TableRequiredVal.GetRecordView<KeyPoco>().UpsertAsync(null, new KeyPoco()));
 
-        StringAssert.StartsWith("Column 'VAL' does not allow NULLs", 
ex!.Message);
+        StringAssert.Contains("Column 'VAL' does not allow NULLs", 
ex!.Message);
     }
 
     [Test]
@@ -267,7 +267,7 @@ public class SchemaValidationTest : IgniteTestsBase
         var ex = Assert.ThrowsAsync<MarshallerException>(
             async () => await Table.GetKeyValueView<ValPoco, 
string>().PutAsync(null, new ValPoco(), "x"));
 
-        Assert.AreEqual("Missed key column: KEY", ex!.Message);
+        StringAssert.Contains("Missed key column: KEY", ex!.Message);
     }
 
     [Test]
@@ -276,7 +276,7 @@ public class SchemaValidationTest : IgniteTestsBase
         var ex = Assert.ThrowsAsync<MarshallerException>(
             async () => await TableRequiredVal.GetKeyValueView<long, 
KeyPoco>().PutAsync(null, 1L, new KeyPoco()));
 
-        StringAssert.StartsWith("Column 'VAL' does not allow NULLs", 
ex!.Message);
+        StringAssert.Contains("Column 'VAL' does not allow NULLs", 
ex!.Message);
     }
 
     [Test]
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItRaftCommandLeftInLogUntilRestartTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItRaftCommandLeftInLogUntilRestartTest.java
index 894f88f4588..3bfb333d8cf 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItRaftCommandLeftInLogUntilRestartTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItRaftCommandLeftInLogUntilRestartTest.java
@@ -233,7 +233,7 @@ public class ItRaftCommandLeftInLogUntilRestartTest extends 
ClusterPerClassInteg
 
     private static Row marshalKey(TableViewInternal table, Tuple tuple) {
         SchemaRegistry schemaReg = table.schemaView();
-        var marshaller = new TupleMarshallerImpl(schemaReg.lastKnownSchema());
+        var marshaller = new TupleMarshallerImpl(table::qualifiedName, 
schemaReg.lastKnownSchema());
 
         return marshaller.marshalKey(tuple);
     }
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
index 5cfecff7be7..6fde10ceb1d 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/PlatformTestNodeRunner.java
@@ -91,12 +91,12 @@ import 
org.apache.ignite.internal.runner.app.Jobs.JsonMarshaller;
 import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.schema.row.Row;
 import 
org.apache.ignite.internal.security.authentication.basic.BasicAuthenticationProviderChange;
 import org.apache.ignite.internal.security.configuration.SecurityChange;
 import 
org.apache.ignite.internal.security.configuration.SecurityExtensionChange;
 import org.apache.ignite.internal.sql.SqlCommon;
+import org.apache.ignite.internal.table.KeyValueTestUtils;
 import org.apache.ignite.internal.table.RecordBinaryViewImpl;
 import org.apache.ignite.internal.table.partition.HashPartition;
 import org.apache.ignite.internal.testframework.TestIgnitionManager;
@@ -714,7 +714,7 @@ public class PlatformTestNodeRunner {
             List<String> colocationColumns = 
columns.stream().map(Column::name).collect(toList());
             var schema = new SchemaDescriptor(1, columns, colocationColumns, 
null);
 
-            var marsh = new TupleMarshallerImpl(schema);
+            var marsh = KeyValueTestUtils.createMarshaller(schema);
 
             Row row = marsh.marshal(tuple);
 
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientMarshallingTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientMarshallingTest.java
index 0f440378272..4a75d938796 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientMarshallingTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientMarshallingTest.java
@@ -17,17 +17,16 @@
 
 package org.apache.ignite.internal.runner.app.client;
 
-import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
+import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCode;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.endsWith;
-import static org.hamcrest.Matchers.startsWith;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.math.BigDecimal;
 import org.apache.ignite.Ignite;
-import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.lang.ErrorGroups.Marshalling;
 import org.apache.ignite.lang.MarshallerException;
 import org.apache.ignite.table.RecordView;
 import org.apache.ignite.table.Table;
@@ -35,6 +34,7 @@ import org.apache.ignite.table.Tuple;
 import org.apache.ignite.table.mapper.Mapper;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.function.Executable;
 
 /**
  * Tests marshaller, ensures consistent behavior across client and embedded 
modes.
@@ -55,11 +55,11 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         pojo.val = "val";
         pojo.unmapped = "unmapped";
 
-        Throwable ex = assertThrowsWithCause(() -> pojoView.upsert(null, 
pojo), MarshallerException.class);
-        assertEquals(
+        assertThrowsMarshallerException(
+                () -> pojoView.upsert(null, pojo),
                 "Fields [unmapped, unmapped2] of type "
-                        + 
"org.apache.ignite.internal.runner.app.client.ItThinClientMarshallingTest$TestPojo2
 are not mapped to columns",
-                ex.getMessage());
+                        + 
"org.apache.ignite.internal.runner.app.client.ItThinClientMarshallingTest$TestPojo2
 are not mapped to columns"
+        );
     }
 
     @Test
@@ -69,11 +69,10 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
 
         var pojo = new TestPojo();
 
-        Throwable ex = assertThrowsWithCause(() -> kvPojoView.put(null, pojo, 
pojo), MarshallerException.class);
-        assertEquals(
+        assertThrowsMarshallerException(
+                () -> kvPojoView.put(null, pojo, pojo),
                 "Fields [val] of type 
org.apache.ignite.internal.runner.app.client.ItAbstractThinClientTest$TestPojo "
-                        + "are not mapped to columns",
-                ex.getMessage());
+                        + "are not mapped to columns");
     }
 
     @Test
@@ -83,11 +82,11 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
 
         var pojo = new TestPojo();
 
-        Throwable ex = assertThrowsWithCause(() -> kvPojoView.put(null, 1, 
pojo), MarshallerException.class);
-        assertEquals(
+        assertThrowsMarshallerException(
+                () -> kvPojoView.put(null, 1, pojo),
                 "Fields [key] of type 
org.apache.ignite.internal.runner.app.client.ItAbstractThinClientTest$TestPojo "
-                        + "are not mapped to columns",
-                ex.getMessage());
+                        + "are not mapped to columns"
+        );
     }
 
     @Test
@@ -97,8 +96,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
 
         var tuple = Tuple.create().set("key", 1).set("val", 
"val").set("unmapped", "unmapped");
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.upsert(null, 
tuple), IgniteException.class);
-        assertEquals("Tuple doesn't match schema: schemaVersion=1, 
extraColumns=[UNMAPPED]", ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> tupleView.upsert(null, tuple),
+                "Tuple doesn't match schema: schemaVersion=1, 
extraColumns=[UNMAPPED]");
     }
 
     @Test
@@ -108,8 +108,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
 
         var tuple = Tuple.create().set("key", 1).set("val", "val");
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.put(null, tuple, 
tuple), IgniteException.class);
-        assertEquals("Key tuple doesn't match schema: schemaVersion=1, 
extraColumns=[VAL]", ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> tupleView.put(null, tuple, tuple),
+                "Key tuple doesn't match schema: schemaVersion=1, 
extraColumns=[VAL]");
     }
 
     @Test
@@ -120,8 +121,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         var key = Tuple.create().set("key", 1);
         var tuple = Tuple.create().set("key", 1).set("val", "val");
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.put(null, key, 
tuple), IgniteException.class);
-        assertEquals("Value tuple doesn't match schema: schemaVersion=1, 
extraColumns=[KEY]", ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> tupleView.put(null, key, tuple),
+                "Value tuple doesn't match schema: schemaVersion=1, 
extraColumns=[KEY]");
     }
 
     @Test
@@ -129,8 +131,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(TABLE_NAME);
         var pojoView = table.recordView(MissingFieldPojo.class);
 
-        Throwable ex = assertThrowsWithCause(() -> pojoView.upsert(null, new 
MissingFieldPojo()), MarshallerException.class);
-        assertEquals("No mapped object field found for column 'KEY'", 
ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> pojoView.upsert(null, new MissingFieldPojo()),
+                "No mapped object field found for column 'KEY'");
     }
 
     @Test
@@ -138,8 +141,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(TABLE_NAME);
         var kvPojoView = table.keyValueView(MissingFieldPojo.class, 
String.class);
 
-        Throwable ex = assertThrowsWithCause(() -> kvPojoView.put(null, new 
MissingFieldPojo(), ""), MarshallerException.class);
-        assertEquals("No mapped object field found for column 'KEY'", 
ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> kvPojoView.put(null, new MissingFieldPojo(), ""),
+                "No mapped object field found for column 'KEY'");
     }
 
     @Test
@@ -161,8 +165,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(TABLE_NAME);
         var tupleView = table.recordView();
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.upsert(null, 
Tuple.create()), IgniteException.class);
-        assertEquals("Missed key column: KEY", ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> tupleView.upsert(null, Tuple.create()),
+                "Missed key column: KEY");
     }
 
     @Test
@@ -173,8 +178,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(tableName);
         var tupleView = table.recordView();
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.upsert(null, 
Tuple.create().set("KEY", 1)), IgniteException.class);
-        assertThat(ex.getMessage(), containsString("Column 'VAL' does not 
allow NULLs"));
+        assertThrowsMarshallerException(
+                () -> tupleView.upsert(null, Tuple.create().set("KEY", 1)),
+                "Column 'VAL' does not allow NULLs");
     }
 
     @Test
@@ -182,8 +188,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(TABLE_NAME);
         var tupleView = table.keyValueView();
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.put(null, 
Tuple.create(), Tuple.create()), IgniteException.class);
-        assertEquals("Missed key column: KEY", ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> tupleView.put(null, Tuple.create(), Tuple.create()),
+                "Missed key column: KEY");
     }
 
     @Test
@@ -194,11 +201,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(tableName);
         var tupleView = table.keyValueView();
 
-        Throwable ex = assertThrowsWithCause(
+        assertThrowsMarshallerException(
                 () -> tupleView.put(null, Tuple.create().set("KEY", 1), 
Tuple.create()),
-                IgniteException.class);
-
-        assertThat(ex.getMessage(), containsString("Column 'VAL' does not 
allow NULLs"));
+                "Column 'VAL' does not allow NULLs");
     }
 
     @Test
@@ -223,8 +228,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         rec.key = "1";
         rec.val = BigDecimal.ONE;
 
-        Throwable ex = assertThrows(IgniteException.class, () -> 
pojoView.upsert(null, rec));
-        assertThat(ex.getMessage(), startsWith("Column's type mismatch"));
+        assertThrowsMarshallerException(
+                () -> pojoView.upsert(null, rec),
+                "Column's type mismatch");
     }
 
     @Test
@@ -236,8 +242,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         rec.key = -1;
         rec.val = "f";
 
-        Throwable ex = assertThrows(IgniteException.class, () -> 
pojoView.upsert(null, rec));
-        assertThat(ex.getMessage(), startsWith("Column's type mismatch"));
+        assertThrowsMarshallerException(
+                () -> pojoView.upsert(null, rec),
+                "Column's type mismatch");
     }
 
     @Test
@@ -253,8 +260,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         // TODO: https://issues.apache.org/jira/browse/IGNITE-22965.
         // The validation done on a client side (for a thin client), and 
messages may differ between embedded clients and thin clients.
         // For an embedded client the message include type precision, but for 
a thin client it doesn't.
-        Throwable ex = assertThrows(IgniteException.class, () -> 
tupleView.upsert(null, rec));
-        assertThat(ex.getMessage(), startsWith("Value type does not match 
[column='VAL', expected=STRING"));
+        MarshallerException ex = assertThrows(MarshallerException.class, () -> 
tupleView.upsert(null, rec));
+        assertEquals(Marshalling.COMMON_ERR, ex.code());
+        assertThat(ex.getMessage(), containsString("Value type does not match 
[column='VAL', expected=STRING"));
         assertThat(ex.getMessage(), endsWith(", actual=INT64]"));
     }
 
@@ -288,8 +296,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(TABLE_NAME);
         var tupleView = table.recordView();
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.upsert(null, 
Tuple.create().set("KEY", null)), IgniteException.class);
-        assertThat(ex.getMessage(), containsString("Column 'KEY' does not 
allow NULLs"));
+        assertThrowsMarshallerException(
+                () -> tupleView.upsert(null, Tuple.create().set("KEY", null)),
+                "Column 'KEY' does not allow NULLs");
     }
 
     @Test
@@ -301,8 +310,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         var tupleView = table.recordView();
 
         Tuple rec = Tuple.create().set("KEY", 1).set("VAL", null);
-        Throwable ex = assertThrowsWithCause(() -> tupleView.upsert(null, 
rec), IgniteException.class);
-        assertThat(ex.getMessage(), containsString("Column 'VAL' does not 
allow NULLs"));
+        assertThrowsMarshallerException(
+                () -> tupleView.upsert(null, rec),
+                "Column 'VAL' does not allow NULLs");
     }
 
     @Test
@@ -310,8 +320,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(TABLE_NAME);
         var tupleView = table.keyValueView();
 
-        Throwable ex = assertThrowsWithCause(() -> tupleView.put(null, 
Tuple.create(), Tuple.create()), IgniteException.class);
-        assertEquals("Missed key column: KEY", ex.getMessage());
+        assertThrowsMarshallerException(
+                () -> tupleView.put(null, Tuple.create(), Tuple.create()),
+                "Missed key column: KEY");
     }
 
     @Test
@@ -322,11 +333,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(tableName);
         var tupleView = table.keyValueView();
 
-        Throwable ex = assertThrowsWithCause(
+        assertThrowsMarshallerException(
                 () -> tupleView.put(null, Tuple.create().set("KEY", 1), 
Tuple.create().set("VAL", null)),
-                IgniteException.class);
-
-        assertThat(ex.getMessage(), containsString("Column 'VAL' does not 
allow NULLs"));
+                "Column 'VAL' does not allow NULLs");
     }
 
     @Test
@@ -338,11 +347,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(tableName);
         var tupleView = table.keyValueView();
 
-        Throwable ex = assertThrowsWithCause(
+        assertThrowsMarshallerException(
                 () -> tupleView.put(null, Tuple.create().set("KEY", 1), 
Tuple.create().set("VAL", "1".repeat(20))),
-                IgniteException.class);
-
-        assertThat(ex.getMessage(), containsString("Value too long 
[column='VAL', type=STRING(10)]"));
+                "Value too long [column='VAL', type=STRING(10)]");
     }
 
     @Test
@@ -355,11 +362,9 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
         Table table = ignite().tables().table(tableName);
         var tupleView = table.keyValueView();
 
-        Throwable ex = assertThrowsWithCause(
+        assertThrowsMarshallerException(
                 () -> tupleView.put(null, Tuple.create().set("KEY", 1), 
Tuple.create().set("VAL", new BigDecimal("12345.1"))),
-                IgniteException.class);
-
-        assertThat(ex.getMessage(), containsString("Numeric field overflow in 
column 'VAL'"));
+                "Numeric field overflow in column 'VAL'");
     }
 
     @Test
@@ -371,12 +376,15 @@ public class ItThinClientMarshallingTest extends 
ItAbstractThinClientTest {
                 .set("KEY", 1)
                 .set("VAL", new TestPojo2());
 
-        MarshallerException ex = assertThrows(MarshallerException.class, () -> 
tupleView.upsert(null, rec));
-
-        assertEquals(
+        assertThrowsMarshallerException(
+                () -> tupleView.upsert(null, rec),
                 "Invalid value type provided for column [name='VAL', 
expected='java.lang.String', actual='"
-                        + TestPojo2.class.getName() + "']",
-                ex.getMessage());
+                        + TestPojo2.class.getName() + "']"
+        );
+    }
+
+    private static void assertThrowsMarshallerException(Executable run, String 
messageFragment) {
+        assertThrowsWithCode(MarshallerException.class, 
Marshalling.COMMON_ERR, run, messageFragment);
     }
 
     private static class TestPojo2 {
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSchemaSynchronizationTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSchemaSynchronizationTest.java
index 08b3199cc25..0176fdb91b6 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSchemaSynchronizationTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientSchemaSynchronizationTest.java
@@ -20,11 +20,12 @@ package org.apache.ignite.internal.runner.app.client;
 import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.internal.testframework.IgniteTestUtils;
 import org.apache.ignite.lang.IgniteException;
+import org.apache.ignite.lang.MarshallerException;
 import org.apache.ignite.sql.IgniteSql;
 import org.apache.ignite.sql.ResultSet;
 import org.apache.ignite.sql.SqlRow;
@@ -63,8 +64,8 @@ public class ItThinClientSchemaSynchronizationTest extends 
ItAbstractThinClientT
         sql.execute(null, "ALTER TABLE " + tableName + " DROP COLUMN NAME");
 
         Tuple rec2 = Tuple.create().set("ID", id).set("NAME", "name2");
-        Throwable ex = assertThrowsWithCause(() -> recordView.upsert(null, 
rec2), IllegalArgumentException.class);
-        assertEquals("Tuple doesn't match schema: schemaVersion=2, 
extraColumns=[NAME]", ex.getMessage());
+        assertThrowsWithCause(() -> recordView.upsert(null, rec2), 
MarshallerException.class,
+                "Tuple doesn't match schema: schemaVersion=2, 
extraColumns=[NAME]");
     }
 
     @Test
@@ -145,8 +146,8 @@ public class ItThinClientSchemaSynchronizationTest extends 
ItAbstractThinClientT
                 : () -> recordView.insert(null, rec);
 
         // Insert fails, because there is no NAME column.
-        var ex = assertThrows(IgniteException.class, action::run);
-        assertEquals("Tuple doesn't match schema: schemaVersion=1, 
extraColumns=[NAME]", ex.getMessage());
+        IgniteTestUtils.assertThrows(IgniteException.class, action::run,
+                "Tuple doesn't match schema: schemaVersion=1, 
extraColumns=[NAME]");
 
         // Modify table, insert again - client will use old schema, throw 
ClientSchemaMismatchException,
         // reload schema, retry with new schema and succeed.
@@ -175,8 +176,8 @@ public class ItThinClientSchemaSynchronizationTest extends 
ItAbstractThinClientT
                 ? () -> kvView.getAndPut(null, key, val)
                 : () -> kvView.put(null, key, val);
 
-        var ex = assertThrows(IgniteException.class, action::run);
-        assertEquals("Value tuple doesn't match schema: schemaVersion=1, 
extraColumns=[NAME]", ex.getMessage());
+        IgniteTestUtils.assertThrows(IgniteException.class, action::run,
+                "Value tuple doesn't match schema: schemaVersion=1, 
extraColumns=[NAME]");
 
         // Modify table, insert again - client will use old schema, throw 
ClientSchemaMismatchException,
         // reload schema, retry with new schema and succeed.
@@ -203,11 +204,9 @@ public class ItThinClientSchemaSynchronizationTest extends 
ItAbstractThinClientT
                 ? () -> recordView.getAndUpsert(null, rec)
                 : () -> recordView.insert(null, rec);
 
-        var ex = assertThrows(IgniteException.class, action::run);
-        assertEquals(
+        IgniteTestUtils.assertThrows(IgniteException.class, action::run,
                 "Fields [name] of type 
org.apache.ignite.internal.runner.app.client.ItThinClientSchemaSynchronizationTest$Pojo
 "
-                        + "are not mapped to columns",
-                ex.getMessage());
+                        + "are not mapped to columns");
 
         // Modify table, insert again - client will use old schema, throw 
ClientSchemaMismatchException,
         // reload schema, retry with new schema and succeed.
@@ -237,12 +236,9 @@ public class ItThinClientSchemaSynchronizationTest extends 
ItAbstractThinClientT
                 ? () -> kvView.getAndPut(null, key, val)
                 : () -> kvView.put(null, key, val);
 
-        var ex = assertThrows(IgniteException.class, action::run);
-        assertEquals(
-                "Fields [name] of type "
+        IgniteTestUtils.assertThrows(IgniteException.class, action::run, 
"Fields [name] of type "
                         + 
"org.apache.ignite.internal.runner.app.client.ItThinClientSchemaSynchronizationTest$ValPojo
 "
-                        + "are not mapped to columns",
-                ex.getMessage());
+                        + "are not mapped to columns");
 
         // Modify table, insert again - client will use old schema, throw 
ClientSchemaMismatchException,
         // reload schema, retry with new schema and succeed.
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
index 970b8d174cc..d26421e1d41 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItThinClientColocationTest.java
@@ -127,7 +127,7 @@ public class ItThinClientColocationTest extends 
ClusterPerClassIntegrationTest {
         var colocationColumns = List.of(columnName);
         var schema = new SchemaDescriptor(1, columns, colocationColumns, 
colocationColumns);
 
-        return new TupleMarshallerImpl(schema);
+        return KeyValueTestUtils.createMarshaller(schema);
     }
 
     private static Stream<Arguments> nativeTypes() {
diff --git 
a/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaMismatchException.java
 
b/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaMismatchException.java
index 267cc699dca..89fd94dd136 100644
--- 
a/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaMismatchException.java
+++ 
b/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaMismatchException.java
@@ -29,4 +29,14 @@ public class SchemaMismatchException extends SchemaException 
{
     public SchemaMismatchException(String msg) {
         super(msg);
     }
+
+    /**
+     * Constructor with error message and cause.
+     *
+     * @param msg   Message.
+     * @param cause Cause.
+     */
+    public SchemaMismatchException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
 }
diff --git 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/KvMarshallerTest.java
 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/KvMarshallerTest.java
index ebbab334c6d..9c807825776 100644
--- 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/KvMarshallerTest.java
+++ 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/KvMarshallerTest.java
@@ -329,7 +329,7 @@ public class KvMarshallerTest {
         );
 
         Throwable ex = assertThrows(
-                ClassCastException.class,
+                MarshallerException.class,
                 () -> factory.create(schema, TestSimpleObjectKey.class, 
TestSimpleObjectVal.class));
 
         assertThat(
diff --git 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/RecordMarshallerTest.java
 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/RecordMarshallerTest.java
index 821bbaa8e3a..20fb7f00da9 100644
--- 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/RecordMarshallerTest.java
+++ 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/marshaller/RecordMarshallerTest.java
@@ -215,7 +215,7 @@ public class RecordMarshallerTest {
                 }
         );
 
-        Throwable ex = assertThrows(ClassCastException.class, () -> 
factory.create(schema, TestSimpleObject.class));
+        Throwable ex = assertThrows(MarshallerException.class, () -> 
factory.create(schema, TestSimpleObject.class));
 
         assertThat(
                 ex.getMessage(),
diff --git 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java
 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java
index 3f20527a039..086d608930a 100644
--- 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java
+++ 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItColocationTest.java
@@ -478,7 +478,7 @@ public class ItColocationTest extends 
BaseIgniteAbstractTest {
 
         tbl = new TableImpl(intTable, schemaRegistry, lockManager(), new 
ConstantSchemaVersions(1), mock(IgniteSql.class), -1);
 
-        marshaller = new TupleMarshallerImpl(schema);
+        marshaller = new TupleMarshallerImpl(tbl::qualifiedName, schema);
     }
 
     private static LockManager lockManager() {
diff --git 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItKeyValueBinaryViewApiTest.java
 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItKeyValueBinaryViewApiTest.java
index 32986d57373..ae050ee5b57 100644
--- 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItKeyValueBinaryViewApiTest.java
+++ 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItKeyValueBinaryViewApiTest.java
@@ -39,7 +39,7 @@ import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.SchemaMismatchException;
 import org.apache.ignite.internal.testframework.IgniteTestUtils;
 import org.apache.ignite.internal.type.NativeTypes;
-import org.apache.ignite.lang.ErrorGroups.Client;
+import org.apache.ignite.lang.ErrorGroups.Marshalling;
 import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.lang.MarshallerException;
 import org.apache.ignite.table.KeyValueView;
@@ -684,9 +684,9 @@ public class ItKeyValueBinaryViewApiTest extends 
ItKeyValueViewApiBaseTest {
             String expectedMessage = "Value type does not match [column='ID', 
expected=INT64, actual=INT32]";
 
             if (thin) {
-                IgniteException ex = (IgniteException) 
IgniteTestUtils.assertThrows(IgniteException.class, run, expectedMessage);
+                MarshallerException ex = (MarshallerException) 
assertThrows(MarshallerException.class, run, expectedMessage);
 
-                assertThat(ex.code(), is(Client.PROTOCOL_ERR));
+                assertThat(ex.code(), is(Marshalling.COMMON_ERR));
             } else {
                 //noinspection ThrowableNotThrown
                 IgniteTestUtils.assertThrowsWithCause(run::execute, 
SchemaMismatchException.class, expectedMessage);
diff --git 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItRecordBinaryViewApiTest.java
 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItRecordBinaryViewApiTest.java
index 613c98d8bed..94cd7865261 100644
--- 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItRecordBinaryViewApiTest.java
+++ 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItRecordBinaryViewApiTest.java
@@ -35,7 +35,7 @@ import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.SchemaMismatchException;
 import org.apache.ignite.internal.testframework.IgniteTestUtils;
 import org.apache.ignite.internal.type.NativeTypes;
-import org.apache.ignite.lang.ErrorGroups.Client;
+import org.apache.ignite.lang.ErrorGroups.Marshalling;
 import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.lang.MarshallerException;
 import org.apache.ignite.lang.util.IgniteNameUtils;
@@ -896,7 +896,7 @@ public class ItRecordBinaryViewApiTest extends 
ItRecordViewApiBaseTest {
             if (thin) {
                 IgniteException ex = (IgniteException) 
IgniteTestUtils.assertThrows(IgniteException.class, run, expectedMessage);
 
-                assertThat(ex.code(), is(Client.PROTOCOL_ERR));
+                assertThat(ex.code(), is(Marshalling.COMMON_ERR));
             } else {
                 //noinspection ThrowableNotThrown
                 IgniteTestUtils.assertThrowsWithCause(run::execute, 
SchemaMismatchException.class, expectedMessage);
diff --git 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/distributed/disaster/AbstractHighAvailablePartitionsRecoveryTest.java
 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/distributed/disaster/AbstractHighAvailablePartitionsRecoveryTest.java
index 53aca4b1589..ddaf871103a 100644
--- 
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/distributed/disaster/AbstractHighAvailablePartitionsRecoveryTest.java
+++ 
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/table/distributed/disaster/AbstractHighAvailablePartitionsRecoveryTest.java
@@ -583,7 +583,7 @@ public abstract class 
AbstractHighAvailablePartitionsRecoveryTest extends Cluste
     private static Row marshalKey(TableViewInternal table, Tuple key) {
         SchemaRegistry schemaReg = table.schemaView();
 
-        var marshaller = new TupleMarshallerImpl(schemaReg.lastKnownSchema());
+        var marshaller = new TupleMarshallerImpl(table::qualifiedName, 
schemaReg.lastKnownSchema());
 
         return marshaller.marshal(key, null);
     }
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerImpl.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerImpl.java
index 2c99f96e87c..c58d58de9f7 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerImpl.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerImpl.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.schema.marshaller;
 
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
 import static 
org.apache.ignite.internal.schema.marshaller.MarshallerUtil.getValueSize;
 import static org.apache.ignite.internal.util.IgniteUtils.newHashMap;
 
@@ -25,7 +26,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
+import java.util.function.Supplier;
 import org.apache.ignite.internal.binarytuple.BinaryTupleCommon;
 import org.apache.ignite.internal.binarytuple.BinaryTupleContainer;
 import org.apache.ignite.internal.binarytuple.BinaryTupleReader;
@@ -39,9 +40,9 @@ import org.apache.ignite.internal.schema.row.Row;
 import org.apache.ignite.internal.schema.row.RowAssembler;
 import org.apache.ignite.internal.type.DecimalNativeType;
 import org.apache.ignite.internal.type.NativeType;
-import org.apache.ignite.lang.ErrorGroups.Marshalling;
 import org.apache.ignite.lang.MarshallerException;
 import org.apache.ignite.sql.ColumnType;
+import org.apache.ignite.table.QualifiedName;
 import org.apache.ignite.table.Tuple;
 import org.apache.ignite.table.TupleHelper;
 import org.jetbrains.annotations.Nullable;
@@ -54,6 +55,7 @@ public class TupleMarshallerImpl implements TupleMarshaller {
     private static final Object POISON_OBJECT = new Object();
 
     private final SchemaDescriptor schema;
+    private final Supplier<QualifiedName> tableNameSupplier;
 
     private final int keyOnlyFixedLengthColumnSize;
     private final int valueOnlyFixedLengthColumnSize;
@@ -61,10 +63,12 @@ public class TupleMarshallerImpl implements TupleMarshaller 
{
     /**
      * Creates marshaller for given schema.
      *
+     * @param tableNameSupplier Table name supplier.
      * @param schema Schema.
      */
-    public TupleMarshallerImpl(SchemaDescriptor schema) {
+    public TupleMarshallerImpl(Supplier<QualifiedName> tableNameSupplier, 
SchemaDescriptor schema) {
         this.schema = schema;
+        this.tableNameSupplier = tableNameSupplier;
 
         keyOnlyFixedLengthColumnSize = schema.keyColumns().stream()
                 .map(Column::type)
@@ -121,13 +125,19 @@ public class TupleMarshallerImpl implements 
TupleMarshaller {
 
             return buildRow(part, valuesWithStatistics);
         } catch (Exception ex) {
-            throw new MarshallerException(ex.getMessage(), ex);
+            String msg = format("Failed to serialize row for table {}. {}",
+                    tableNameSupplier.get().toCanonicalForm(),
+                    ex.getMessage());
+
+            throw new MarshallerException(msg, ex);
         }
     }
 
     /** {@inheritDoc} */
     @Override
     public Row marshal(Tuple keyTuple, @Nullable Tuple valTuple) throws 
MarshallerException {
+        boolean keyOnly = valTuple == null;
+
         try {
             var valuesWithStatistics = new ValuesWithStatistics(valTuple == 
null ? schema.keyColumns().size() : schema.length());
 
@@ -139,7 +149,6 @@ public class TupleMarshallerImpl implements TupleMarshaller 
{
                                 schema.version(), extraColumnNames(keyTuple, 
true, schema)));
             }
 
-            boolean keyOnly = valTuple == null;
             if (!keyOnly) {
                 gatherStatistics(TuplePart.VALUE, valTuple, 
valuesWithStatistics);
 
@@ -152,7 +161,12 @@ public class TupleMarshallerImpl implements 
TupleMarshaller {
 
             return buildRow(keyOnly ? TuplePart.KEY : TuplePart.KEY_VALUE, 
valuesWithStatistics);
         } catch (Exception ex) {
-            throw new MarshallerException(ex.getMessage(), ex);
+            String msg = format("Failed to serialize {} for table {}. {}",
+                    keyOnly ? "key tuple" : "row",
+                    tableNameSupplier.get().toCanonicalForm(),
+                    ex.getMessage());
+
+            throw new MarshallerException(msg, ex);
         }
     }
 
@@ -172,7 +186,11 @@ public class TupleMarshallerImpl implements 
TupleMarshaller {
 
             return buildRow(part, valuesWithStatistics);
         } catch (Exception ex) {
-            throw new MarshallerException(ex.getMessage(), ex);
+            String msg = format("Failed to serialize key tuple for table {}. 
{}",
+                    tableNameSupplier.get().toCanonicalForm(),
+                    ex.getMessage());
+
+            throw new MarshallerException(msg, ex);
         }
     }
 
@@ -223,9 +241,7 @@ public class TupleMarshallerImpl implements TupleMarshaller 
{
 
                         estimatedValueSize += getValueSize(val, colType);
                     } catch (ClassCastException e) {
-                        throw new MarshallerException(
-                                UUID.randomUUID(),
-                                Marshalling.COMMON_ERR,
+                        throw new SchemaMismatchException(
                                 String.format(
                                         "Invalid value type provided for 
column [name='%s', expected='%s', actual='%s']",
                                         col.name(),
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/KeyValueBinaryViewImpl.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/KeyValueBinaryViewImpl.java
index 958c48d3a11..e47242d107e 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/KeyValueBinaryViewImpl.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/KeyValueBinaryViewImpl.java
@@ -477,7 +477,7 @@ public class KeyValueBinaryViewImpl extends 
AbstractTableView<Entry<Tuple, Tuple
      * @throws MarshallerException If failed to marshal key and/or value.
      */
     private Row marshal(Tuple key, @Nullable Tuple val, int schemaVersion) {
-        return marshallerCache.marshaller(schemaVersion).marshal(key, val);
+        return marshallerCache.marshaller(tbl::name, 
schemaVersion).marshal(key, val);
     }
 
     /**
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/RecordBinaryViewImpl.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/RecordBinaryViewImpl.java
index fdbbe6162a3..caf76c3f74e 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/RecordBinaryViewImpl.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/RecordBinaryViewImpl.java
@@ -107,7 +107,7 @@ public class RecordBinaryViewImpl extends 
AbstractTableView<Tuple> implements Re
      * @param schemaVersion Schema version for which to obtain a marshaller.
      */
     public TupleMarshaller marshaller(int schemaVersion) {
-        return marshallerCache.marshaller(schemaVersion);
+        return marshallerCache.marshaller(tbl::name, schemaVersion);
     }
 
     @Override
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java 
b/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java
index 36202a26f3b..732f6d61167 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/TableImpl.java
@@ -223,7 +223,7 @@ public class TableImpl implements TableViewInternal {
 
         // Taking latest schema version for marshaller here because it's only 
used to calculate colocation hash, and colocation
         // columns never change (so they are the same for all schema versions 
of the table),
-        Row keyRow = new 
TupleMarshallerImpl(schemaReg.lastKnownSchema()).marshalKey(key);
+        Row keyRow = new TupleMarshallerImpl(tbl::name, 
schemaReg.lastKnownSchema()).marshalKey(key);
 
         return tbl.partitionId(keyRow);
     }
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/TupleMarshallerCache.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/TupleMarshallerCache.java
index 282881dab64..399af7df8ed 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/TupleMarshallerCache.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/TupleMarshallerCache.java
@@ -17,9 +17,11 @@
 
 package org.apache.ignite.internal.table;
 
+import java.util.function.Supplier;
 import org.apache.ignite.internal.schema.SchemaRegistry;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
+import org.apache.ignite.table.QualifiedName;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -37,16 +39,17 @@ class TupleMarshallerCache {
     /**
      * Returns a {@link TupleMarshaller} for the given schema version.
      *
+     * @param tableNameSupplier Supplier of table name.
      * @param schemaVersion Version for which to return a marshaller.
      */
-    TupleMarshaller marshaller(int schemaVersion) {
+    TupleMarshaller marshaller(Supplier<QualifiedName> tableNameSupplier, int 
schemaVersion) {
         TupleMarshaller marshaller = cachedMarshaller;
 
         if (marshaller != null && marshaller.schemaVersion() == schemaVersion) 
{
             return marshaller;
         }
 
-        marshaller = new 
TupleMarshallerImpl(schemaRegistry.schema(schemaVersion));
+        marshaller = new TupleMarshallerImpl(tableNameSupplier, 
schemaRegistry.schema(schemaVersion));
 
         cachedMarshaller = marshaller;
 
diff --git 
a/modules/table/src/main/java/org/apache/ignite/internal/table/partition/HashPartitionManagerImpl.java
 
b/modules/table/src/main/java/org/apache/ignite/internal/table/partition/HashPartitionManagerImpl.java
index a1bdc2da23a..e287854411b 100644
--- 
a/modules/table/src/main/java/org/apache/ignite/internal/table/partition/HashPartitionManagerImpl.java
+++ 
b/modules/table/src/main/java/org/apache/ignite/internal/table/partition/HashPartitionManagerImpl.java
@@ -115,7 +115,7 @@ public class HashPartitionManagerImpl implements 
PartitionManager {
 
         // Taking latest schema version for marshaller here because it's only 
used to calculate colocation hash, and colocation
         // columns never change (so they are the same for all schema versions 
of the table),
-        Row keyRow = new 
TupleMarshallerImpl(schemaReg.lastKnownSchema()).marshalKey(key);
+        Row keyRow = new TupleMarshallerImpl(table::name, 
schemaReg.lastKnownSchema()).marshalKey(key);
 
         return completedFuture(new HashPartition(table.partitionId(keyRow)));
     }
diff --git 
a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java
 
b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java
index 6871c88ff84..ce14fcbec11 100644
--- 
a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java
+++ 
b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerFixlenOnlyBenchmark.java
@@ -24,8 +24,8 @@ import java.util.stream.IntStream;
 import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.schema.row.Row;
+import org.apache.ignite.internal.table.KeyValueTestUtils;
 import org.apache.ignite.internal.type.NativeTypes;
 import org.apache.ignite.table.Tuple;
 import org.openjdk.jmh.annotations.Benchmark;
@@ -103,7 +103,7 @@ public class TupleMarshallerFixlenOnlyBenchmark {
                         .toArray(Column[]::new)
         );
 
-        marshaller = new TupleMarshallerImpl(schema);
+        marshaller = KeyValueTestUtils.createMarshaller(schema);
 
         vals = new Object[schema.valueColumns().size()];
 
diff --git 
a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java
 
b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java
index 1b839cbe674..597b5f8c82a 100644
--- 
a/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java
+++ 
b/modules/table/src/test/java/org/apache/ignite/internal/benchmarks/TupleMarshallerVarlenOnlyBenchmark.java
@@ -30,8 +30,8 @@ import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.DefaultValueProvider;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.schema.row.Row;
+import org.apache.ignite.internal.table.KeyValueTestUtils;
 import org.apache.ignite.table.Tuple;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -124,7 +124,7 @@ public class TupleMarshallerVarlenOnlyBenchmark {
                         .toArray(Column[]::new)
         );
 
-        marshaller = new TupleMarshallerImpl(schema);
+        marshaller = KeyValueTestUtils.createMarshaller(schema);
 
         switch (type) {
             case RANDOM_STRING: {
diff --git 
a/modules/table/src/test/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerStatisticsTest.java
 
b/modules/table/src/test/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerStatisticsTest.java
index 2a818a5c371..89d51858072 100644
--- 
a/modules/table/src/test/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerStatisticsTest.java
+++ 
b/modules/table/src/test/java/org/apache/ignite/internal/schema/marshaller/TupleMarshallerStatisticsTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
 import 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.TuplePart;
 import 
org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl.ValuesWithStatistics;
+import org.apache.ignite.internal.table.KeyValueTestUtils;
 import org.apache.ignite.internal.table.impl.TestTupleBuilder;
 import org.apache.ignite.internal.type.NativeTypes;
 import org.apache.ignite.table.Tuple;
@@ -55,7 +56,7 @@ public class TupleMarshallerStatisticsTest {
                 new Column[]{new Column("KEY", 
NativeTypes.decimalOf(PRECISION, columnScale), false)},
                 new Column[]{new Column("UNUSED", NativeTypes.INT32, true)});
 
-        TupleMarshallerImpl marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshallerImpl marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         BigDecimal hugeScaledDecimal = new BigDecimal(1, new 
MathContext(PRECISION))
                 .setScale(HUGE_DECIMAL_SCALE, RoundingMode.HALF_UP);
diff --git 
a/modules/table/src/test/java/org/apache/ignite/internal/table/ColocationHashCalculationTest.java
 
b/modules/table/src/test/java/org/apache/ignite/internal/table/ColocationHashCalculationTest.java
index d6801262b93..1aa36fe8774 100644
--- 
a/modules/table/src/test/java/org/apache/ignite/internal/table/ColocationHashCalculationTest.java
+++ 
b/modules/table/src/test/java/org/apache/ignite/internal/table/ColocationHashCalculationTest.java
@@ -33,7 +33,6 @@ import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.SchemaTestUtils;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.schema.row.Row;
 import org.apache.ignite.internal.schema.row.RowAssembler;
 import org.apache.ignite.internal.type.DecimalNativeType;
@@ -150,7 +149,7 @@ public class ColocationHashCalculationTest {
         Row r = generateRandomRow(rnd, schema);
         assertEquals(colocationHash(r), r.colocationHash());
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
         for (int i = 0; i < 10; ++i) {
             Column rndCol = schema.column(rnd.nextInt(schema.length()));
 
@@ -220,7 +219,7 @@ public class ColocationHashCalculationTest {
     }
 
     private static Row generateRandomRow(Random rnd, SchemaDescriptor schema) {
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         Tuple t = Tuple.create();
 
diff --git 
a/modules/table/src/test/java/org/apache/ignite/internal/table/MutableRowTupleAdapterTest.java
 
b/modules/table/src/test/java/org/apache/ignite/internal/table/MutableRowTupleAdapterTest.java
index 1c3292a2b00..7f2a015aa44 100644
--- 
a/modules/table/src/test/java/org/apache/ignite/internal/table/MutableRowTupleAdapterTest.java
+++ 
b/modules/table/src/test/java/org/apache/ignite/internal/table/MutableRowTupleAdapterTest.java
@@ -56,7 +56,6 @@ import org.apache.ignite.internal.schema.SchemaAware;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.SchemaMismatchException;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.schema.row.Row;
 import org.apache.ignite.internal.type.NativeType;
 import org.apache.ignite.internal.type.NativeTypes;
@@ -129,7 +128,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
                 .set("price", 5.99d)
                 .set("id2", 33L);
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         Row row = marshaller.marshal(original);
 
@@ -158,7 +157,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
     @Test
     public void testRowTupleMutability() {
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         Row row = marshaller.marshal(Tuple.create().set("id", 
1L).set("simpleName", "Shirt"));
 
@@ -185,7 +184,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
     @Test
     public void testKeyValueTupleMutability() {
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         Row row = marshaller.marshal(Tuple.create().set("id", 
1L).set("simpleName", "Shirt"));
 
@@ -214,7 +213,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
     @Test
     public void testRowTupleSchemaAwareness() {
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         Row row = marshaller.marshal(Tuple.create().set("id", 
1L).set("simpleName", "Shirt"));
 
@@ -237,7 +236,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
     @Test
     public void testKeyValueTupleSchemaAwareness() {
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         Row row = marshaller.marshal(Tuple.create().set("id", 
1L).set("simpleName", "Shirt"));
 
@@ -285,7 +284,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
         Tuple tuple = Tuple.copy(valTuple).set(keyTuple.columnName(0), 
keyTuple.value(0));
 
         // Check tuples backed with Row.
-        TupleMarshaller marshaller = new TupleMarshallerImpl(fullSchema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(fullSchema);
 
         Row row = marshaller.marshal(keyTuple, valTuple);
 
@@ -355,7 +354,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
         Tuple key1 = Tuple.create().set("keyUuidCol", UUID.randomUUID());
         Tuple val1 = addColumnOfAllTypes(Tuple.create());
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(fullSchema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(fullSchema);
 
         Row row = marshaller.marshal(key1, val1);
 
@@ -368,7 +367,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
     @Test
     public void testTupleNetworkSerialization() throws Exception {
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         Row row = marshaller.marshal(Tuple.create().set("id", 
1L).set("simpleName", "Shirt"));
 
@@ -404,7 +403,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
                 .set("datetime", LocalDateTime.of(2022, 1, 2, 3, 4, 5, 
670_000_000))
                 .set("timestamp", Instant.ofEpochSecond(123, 450_000_000));
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schemaDescriptor);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schemaDescriptor);
 
         Row row = marshaller.marshal(tuple);
 
@@ -423,7 +422,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
                 }
         );
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schemaDescriptor);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schemaDescriptor);
 
         Tuple tuple1 = Tuple.create().set("key", 1)
                 .set("string", "abcef")
@@ -457,7 +456,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
                 }
         );
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schemaDescriptor);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schemaDescriptor);
 
         Tuple tuple1 = Tuple.create().set("key", 1).set("decimal", new 
BigDecimal("123456.7"));
 
@@ -474,7 +473,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
                 }
         );
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schemaDescriptor);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schemaDescriptor);
 
         Tuple tuple = Tuple.create().set("key", 1).set("decimal", new 
BigDecimal("123.458"));
         Tuple expected = Tuple.create().set("key", 1).set("decimal", new 
BigDecimal("123.46")); // Rounded.
@@ -502,7 +501,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
         tuple = transformer.apply(tuple);
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         return TableRow.tuple(marshaller.marshal(tuple));
     }
@@ -513,7 +512,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
         tuple = addColumnsForDefaultSchema(tuple);
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         return TableRow.tuple(marshaller.marshal(tuple));
     }
@@ -524,7 +523,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
         tuple = addColumnOfAllTypes(tuple);
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(fullSchema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(fullSchema);
 
         return TableRow.tuple(marshaller.marshal(tuple));
     }
@@ -539,7 +538,7 @@ public class MutableRowTupleAdapterTest extends 
AbstractMutableTupleTest {
 
         Tuple tuple = Tuple.create().set(columnName, value);
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = 
KeyValueTestUtils.createMarshaller(schema);
 
         return TableRow.tuple(marshaller.marshal(tuple));
     }
diff --git 
a/modules/table/src/test/java/org/apache/ignite/internal/table/TableKvOperationsMockedTest.java
 
b/modules/table/src/test/java/org/apache/ignite/internal/table/TableKvOperationsMockedTest.java
index 356c0a52c9b..ef6a3bd5a75 100644
--- 
a/modules/table/src/test/java/org/apache/ignite/internal/table/TableKvOperationsMockedTest.java
+++ 
b/modules/table/src/test/java/org/apache/ignite/internal/table/TableKvOperationsMockedTest.java
@@ -154,7 +154,8 @@ public class TableKvOperationsMockedTest extends 
BaseIgniteAbstractTest {
                 marshallers
         );
 
-        BinaryRow resultRow = new 
TupleMarshallerImpl(simpleSchema).marshal(Tuple.create().set("ID", 
1L).set("VAL", 2L));
+        BinaryRow resultRow = new TupleMarshallerImpl(internalTable::name, 
simpleSchema)
+                .marshal(Tuple.create().set("ID", 1L).set("VAL", 2L));
 
         doReturn(failedFuture(new InternalSchemaVersionMismatchException()))
                 .doReturn(completedFuture(resultRow))
@@ -182,7 +183,8 @@ public class TableKvOperationsMockedTest extends 
BaseIgniteAbstractTest {
                 marshallers
         );
 
-        BinaryRow resultRow = new 
TupleMarshallerImpl(simpleSchema).marshal(Tuple.create().set("id", 
1L).set("val", 2L));
+        BinaryRow resultRow = new TupleMarshallerImpl(internalTable::name, 
simpleSchema)
+                .marshal(Tuple.create().set("id", 1L).set("val", 2L));
 
         doReturn(failedFuture(new InternalSchemaVersionMismatchException()))
                 .doReturn(completedFuture(resultRow))
diff --git 
a/modules/table/src/test/java/org/apache/ignite/internal/table/type/NumericTypesSerializerTest.java
 
b/modules/table/src/test/java/org/apache/ignite/internal/table/type/NumericTypesSerializerTest.java
index dda677d91c6..e1330e9675b 100644
--- 
a/modules/table/src/test/java/org/apache/ignite/internal/table/type/NumericTypesSerializerTest.java
+++ 
b/modules/table/src/test/java/org/apache/ignite/internal/table/type/NumericTypesSerializerTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.table.type;
 
+import static 
org.apache.ignite.internal.table.KeyValueTestUtils.createMarshaller;
 import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.assertThrowsWithCause;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
@@ -30,7 +31,6 @@ import 
org.apache.ignite.internal.catalog.commands.CatalogUtils;
 import org.apache.ignite.internal.schema.Column;
 import org.apache.ignite.internal.schema.SchemaDescriptor;
 import org.apache.ignite.internal.schema.marshaller.TupleMarshaller;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.schema.row.Row;
 import org.apache.ignite.internal.type.NativeTypes;
 import org.apache.ignite.internal.util.Pair;
@@ -49,9 +49,6 @@ public class NumericTypesSerializerTest {
     /** Random. */
     private Random rnd = new Random();
 
-    /** Schema descriptor. */
-    private SchemaDescriptor schema;
-
     /**
      * Returns list of string decimal representations for test.
      */
@@ -91,7 +88,7 @@ public class NumericTypesSerializerTest {
 
     @Test
     public void testPrecisionRestrictionsForDecimal() {
-        schema = new SchemaDescriptor(
+        SchemaDescriptor schema = new SchemaDescriptor(
                 42,
                 new Column[]{new Column("KEY", NativeTypes.INT64, false)},
                 new Column[]{
@@ -101,7 +98,7 @@ public class NumericTypesSerializerTest {
 
         final Tuple badTup = createTuple().set("key", rnd.nextLong());
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = createMarshaller(schema);
 
         assertThrowsWithCause(
                 () -> marshaller.marshal(badTup.set("decimalCol", new 
BigDecimal("123456789.0123"))),
@@ -127,7 +124,7 @@ public class NumericTypesSerializerTest {
 
     @Test
     public void testStringDecimalSpecialCase() {
-        schema = new SchemaDescriptor(
+        SchemaDescriptor schema = new SchemaDescriptor(
                 42,
                 new Column[]{new Column("KEY", NativeTypes.INT64, false)},
                 new Column[]{
@@ -138,7 +135,7 @@ public class NumericTypesSerializerTest {
         // representation of "0000" value.
         final Tuple tup = createTuple().set("key", 
rnd.nextLong()).set("decimalCol", new BigDecimal("0E+3"));
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = createMarshaller(schema);
 
         final Row row = marshaller.marshal(tup);
 
@@ -151,7 +148,7 @@ public class NumericTypesSerializerTest {
     @ParameterizedTest
     @MethodSource("stringDecimalRepresentation")
     public void testUpscaleForDecimal(String decimalStr) {
-        schema = new SchemaDescriptor(
+        SchemaDescriptor schema = new SchemaDescriptor(
                 42,
                 new Column[]{new Column("KEY", NativeTypes.INT64, false)},
                 new Column[]{
@@ -163,7 +160,7 @@ public class NumericTypesSerializerTest {
                 .set("key", rnd.nextLong())
                 .set("decimalCol1", new BigDecimal(decimalStr));
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = createMarshaller(schema);
 
         final Row row = marshaller.marshal(tup);
 
@@ -174,7 +171,7 @@ public class NumericTypesSerializerTest {
     public void testDecimalMaxScale() {
         int maxScale = CatalogUtils.MAX_DECIMAL_SCALE;
 
-        schema = new SchemaDescriptor(
+        SchemaDescriptor schema = new SchemaDescriptor(
                 42,
                 new Column[]{new Column("KEY", NativeTypes.INT64, false)},
                 new Column[]{
@@ -186,7 +183,7 @@ public class NumericTypesSerializerTest {
                 .set("key", rnd.nextLong())
                 .set("decimalCol", BigDecimal.valueOf(123, maxScale));
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = createMarshaller(schema);
 
         final Row row = marshaller.marshal(tup);
 
@@ -199,7 +196,7 @@ public class NumericTypesSerializerTest {
             "-32769, Decimal scale is too small: -32769 < -32768",
     })
     public void testDecimalScaleTooLarge(int scale, String message) {
-        schema = new SchemaDescriptor(
+        SchemaDescriptor schema = new SchemaDescriptor(
                 42,
                 new Column[]{new Column("KEY", NativeTypes.INT64, false)},
                 new Column[]{
@@ -211,7 +208,7 @@ public class NumericTypesSerializerTest {
                 .set("key", rnd.nextLong())
                 .set("decimalCol", BigDecimal.valueOf(123, scale));
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = createMarshaller(schema);
 
         assertThrowsWithCause(
                 () -> marshaller.marshal(badTup),
@@ -226,7 +223,7 @@ public class NumericTypesSerializerTest {
     @ParameterizedTest
     @MethodSource("sameDecimals")
     public void testSameBinaryRepresentation(Pair<BigDecimal, BigDecimal> 
pair) {
-        schema = new SchemaDescriptor(
+        SchemaDescriptor schema = new SchemaDescriptor(
                 42,
                 new Column[]{new Column("KEY", NativeTypes.INT64, false)},
                 new Column[]{
@@ -234,7 +231,7 @@ public class NumericTypesSerializerTest {
                 }
         );
 
-        TupleMarshaller marshaller = new TupleMarshallerImpl(schema);
+        TupleMarshaller marshaller = createMarshaller(schema);
 
         long randomKey = rnd.nextLong();
 
diff --git 
a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/KeyValueTestUtils.java
 
b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/KeyValueTestUtils.java
index 0ff719b6f21..569b9d23b82 100644
--- 
a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/KeyValueTestUtils.java
+++ 
b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/KeyValueTestUtils.java
@@ -35,12 +35,17 @@ import java.util.Objects;
 import java.util.Random;
 import 
org.apache.ignite.internal.marshaller.testobjects.TestObjectWithAllTypes;
 import org.apache.ignite.internal.schema.Column;
+import org.apache.ignite.internal.schema.SchemaDescriptor;
+import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.type.NativeTypes;
+import org.apache.ignite.table.QualifiedName;
 
 /**
  * Key-value view test utilities.
  */
 public class KeyValueTestUtils {
+    public static final QualifiedName TEST_TABLE_NAME = 
QualifiedName.of("default", "table");
+
     public static final Column[] ALL_TYPES_COLUMNS = {
             new Column("primitiveBooleanCol".toUpperCase(), BOOLEAN, false),
             new Column("primitiveByteCol".toUpperCase(), INT8, false),
@@ -83,6 +88,10 @@ public class KeyValueTestUtils {
         return TestObjectWithAllTypes.randomObject(rnd);
     }
 
+    public static TupleMarshallerImpl createMarshaller(SchemaDescriptor 
schema) {
+        return new TupleMarshallerImpl(() -> TEST_TABLE_NAME, schema);
+    }
+
     /**
      * Test object.
      */
diff --git 
a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java
 
b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java
index 08b345b4939..b0bb2dcc259 100644
--- 
a/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java
+++ 
b/modules/table/src/testFixtures/java/org/apache/ignite/internal/table/TxAbstractTest.java
@@ -75,7 +75,6 @@ import 
org.apache.ignite.internal.replicator.ReplicationGroupId;
 import org.apache.ignite.internal.schema.BinaryRow;
 import org.apache.ignite.internal.schema.BinaryTuple;
 import org.apache.ignite.internal.schema.SchemaRegistry;
-import org.apache.ignite.internal.schema.marshaller.TupleMarshallerImpl;
 import org.apache.ignite.internal.schema.row.Row;
 import org.apache.ignite.internal.storage.RowId;
 import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
@@ -2214,7 +2213,7 @@ public abstract class TxAbstractTest extends 
TxInfrastructureTest {
         var accountRecordsView = accounts.recordView();
 
         SchemaRegistry schemaRegistry = accounts.schemaView();
-        var marshaller = new 
TupleMarshallerImpl(schemaRegistry.lastKnownSchema());
+        var marshaller = 
KeyValueTestUtils.createMarshaller(schemaRegistry.lastKnownSchema());
 
         int partId = 
accounts.internalTable().partitionId(marshaller.marshalKey(makeKey(0)));
 

Reply via email to