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/05/27 13:10:09 UTC

[ignite-3] branch main updated: Ignite-14785: Use SchemaBuilders instead of Configuration API in tests (#150)

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 d70bfa5  Ignite-14785: Use SchemaBuilders instead of Configuration API in tests (#150)
d70bfa5 is described below

commit d70bfa50a9ffcd957434857aac6888d9ddc6639b
Author: Berkof <sa...@mail.ru>
AuthorDate: Thu May 27 20:10:04 2021 +0700

    Ignite-14785: Use SchemaBuilders instead of Configuration API in tests (#150)
---
 .../runner/app/DynamicTableCreationTest.java       | 87 ++++++++++------------
 .../SchemaConfigurationConverter.java              | 58 +++++++++------
 .../configuration/SchemaDescriptorConverter.java   | 26 +++++--
 .../SchemaConfigurationConverterTest.java          |  6 +-
 .../distributed/storage/InternalTableImpl.java     | 22 ++++--
 .../internal/table/StrictSchemaOperationsTest.java | 27 ++++++-
 .../ignite/internal/table/TableManagerTest.java    | 40 +++++-----
 7 files changed, 160 insertions(+), 106 deletions(-)

diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
index 9cf1e02..fa2eb95 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
@@ -23,7 +23,11 @@ import java.util.UUID;
 import org.apache.ignite.app.Ignite;
 import org.apache.ignite.app.IgnitionManager;
 import org.apache.ignite.internal.schema.SchemaManager;
+import org.apache.ignite.internal.schema.configuration.SchemaConfigurationConverter;
 import org.apache.ignite.lang.IgniteLogger;
+import org.apache.ignite.schema.ColumnType;
+import org.apache.ignite.schema.SchemaBuilders;
+import org.apache.ignite.schema.SchemaTable;
 import org.apache.ignite.table.KeyValueBinaryView;
 import org.apache.ignite.table.Table;
 import org.apache.ignite.table.Tuple;
@@ -92,33 +96,26 @@ class DynamicTableCreationTest {
         assertEquals(3, clusterNodes.size());
 
         // Create table on node 0.
-        clusterNodes.get(0).tables().createTable("tbl1", tbl -> tbl
-            .changeName("tbl1")
-            .changeReplicas(1)
-            .changePartitions(10)
-            .changeColumns(cols -> cols
-                .create("key", c -> c.changeName("key").changeNullable(false).changeType(t -> t.changeType("INT64")))
-                .create("val", c -> c.changeName("val").changeNullable(true).changeType(t -> t.changeType("INT32")))
-            )
-            .changeIndices(idxs -> idxs
-                .create("PK", idx -> idx
-                    .changeName("PK")
-                    .changeType("PRIMARY")
-                    .changeColNames(new String[] {"key"})
-                    .changeColumns(c -> c
-                        .create("key", t -> t.changeName("key")))
-                    .changeAffinityColumns(new String[] {"key"}))
-            ));
+        SchemaTable schTbl1 = SchemaBuilders.tableBuilder("PUBLIC", "tbl1").columns(
+            SchemaBuilders.column("key", ColumnType.INT64).asNonNull().build(),
+            SchemaBuilders.column("val", ColumnType.INT32).asNullable().build()
+        ).withPrimaryKey("key").build();
+
+        clusterNodes.get(0).tables().createTable(schTbl1.canonicalName(), tblCh ->
+            SchemaConfigurationConverter.convert(schTbl1, tblCh)
+                .changeReplicas(1)
+                .changePartitions(10)
+        );
 
         // Put data on node 1.
-        Table tbl1 = waitForTable(clusterNodes.get(1));
+        Table tbl1 = waitForTable(schTbl1.canonicalName(), clusterNodes.get(1));
         KeyValueBinaryView kvView1 = tbl1.kvView();
 
         tbl1.insert(tbl1.tupleBuilder().set("key", 1L).set("val", 111).build());
         kvView1.put(tbl1.tupleBuilder().set("key", 2L).build(), tbl1.tupleBuilder().set("val", 222).build());
 
         // Get data on node 2.
-        Table tbl2 = waitForTable(clusterNodes.get(2));
+        Table tbl2 = waitForTable(schTbl1.canonicalName(), clusterNodes.get(2));
         KeyValueBinaryView kvView2 = tbl2.kvView();
 
         final Tuple keyTuple1 = tbl2.tupleBuilder().set("key", 1L).build();
@@ -138,20 +135,21 @@ class DynamicTableCreationTest {
     /**
      * Waits for table, until it is initialized.
      *
+     * @param tableName Table name
      * @param ign Ignite.
      * @return Table.
      */
-    private Table waitForTable(Ignite ign) {
-        while (ign.tables().table("tbl1") == null) {
+    private Table waitForTable(String tableName, Ignite ign) {
+        while (ign.tables().table(tableName) == null) {
             try {
                 Thread.sleep(100);
             }
             catch (InterruptedException e) {
-                LOG.warn("Waiting for table is interrupted.");
+                LOG.warn("Waiting for table " + tableName + " is interrupted.");
             }
         }
 
-        return ign.tables().table("tbl1");
+        return ign.tables().table(tableName);
     }
 
     /**
@@ -167,33 +165,30 @@ class DynamicTableCreationTest {
         assertEquals(3, clusterNodes.size());
 
         // Create table on node 0.
-        clusterNodes.get(0).tables().createTable("tbl1", tbl -> tbl
-            .changeName("tbl1")
-            .changeReplicas(1)
-            .changePartitions(10)
-            .changeColumns(cols -> cols
-                .create("key", c -> c.changeName("key").changeNullable(false).changeType(t -> t.changeType("UUID")))
-                .create("affKey", c -> c.changeName("affKey").changeNullable(false).changeType(t -> t.changeType("INT64")))
-                .create("valStr", c -> c.changeName("valStr").changeNullable(true).changeType(t -> t.changeType("STRING")))
-                .create("valInt", c -> c.changeName("valInt").changeNullable(true).changeType(t -> t.changeType("INT32")))
-                .create("valNull", c -> c.changeName("valNull").changeNullable(true).changeType(t -> t.changeType("INT16")).changeNullable(true))
-            )
-            .changeIndices(idxs -> idxs
-                .create("PK", idx -> idx
-                    .changeName("PK")
-                    .changeType("PRIMARY")
-                    .changeColNames(new String[] {"key", "affKey"})
-                    .changeColumns(c -> c
-                        .create("key", t -> t.changeName("key").changeAsc(true))
-                        .create("affKey", t -> t.changeName("affKey").changeAsc(false)))
-                    .changeAffinityColumns(new String[] {"affKey"}))
-            ));
+        SchemaTable scmTbl1 = SchemaBuilders.tableBuilder("PUBLIC", "tbl1").columns(
+            SchemaBuilders.column("key", ColumnType.UUID).asNonNull().build(),
+            SchemaBuilders.column("affKey", ColumnType.INT64).asNonNull().build(),
+            SchemaBuilders.column("valStr", ColumnType.string()).asNullable().build(),
+            SchemaBuilders.column("valInt", ColumnType.INT32).asNullable().build(),
+            SchemaBuilders.column("valNull", ColumnType.INT16).asNullable().build()
+        ).withIndex(
+            SchemaBuilders.pkIndex()
+                .addIndexColumn("key").done()
+                .addIndexColumn("affKey").done()
+                .withAffinityColumns("affKey")
+                .build()
+        ).build();
+
+        clusterNodes.get(0).tables().createTable(scmTbl1.canonicalName(), tblCh ->
+            SchemaConfigurationConverter.convert(scmTbl1, tblCh)
+                .changeReplicas(1)
+                .changePartitions(10));
 
         final UUID uuid = UUID.randomUUID();
         final UUID uuid2 = UUID.randomUUID();
 
         // Put data on node 1.
-        Table tbl1 = waitForTable(clusterNodes.get(1));
+        Table tbl1 = waitForTable(scmTbl1.canonicalName(), clusterNodes.get(1));
         KeyValueBinaryView kvView1 = tbl1.kvView();
 
         tbl1.insert(tbl1.tupleBuilder().set("key", uuid).set("affKey", 42L)
@@ -203,7 +198,7 @@ class DynamicTableCreationTest {
             kvView1.tupleBuilder().set("valStr", "String value 2").set("valInt", 7373).set("valNull", null).build());
 
         // Get data on node 2.
-        Table tbl2 = waitForTable(clusterNodes.get(2));
+        Table tbl2 = waitForTable(scmTbl1.canonicalName(), clusterNodes.get(2));
         KeyValueBinaryView kvView2 = tbl2.kvView();
 
         final Tuple keyTuple1 = tbl2.tupleBuilder().set("key", uuid).set("affKey", 42L).build();
diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverter.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverter.java
index ba4237f..b943f83 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverter.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverter.java
@@ -98,11 +98,15 @@ public class SchemaConfigurationConverter {
     /**
      * Convert SortedIndexColumn to IndexColumnChange.
      * @param col IndexColumnChange.
-     * @param colInit IndexColumnChange to fullfill.
+     * @param colInit IndexColumnChange to fulfill.
+     * @return IndexColumnChange to get result from.
      */
-    public static void convert(SortedIndexColumn col, IndexColumnChange colInit) {
+    public static IndexColumnChange convert(SortedIndexColumn col, IndexColumnChange colInit) {
         colInit.changeName(col.name());
+
         colInit.changeAsc(col.sortOrder() == SortOrder.ASC);
+
+        return colInit;
     }
 
     /**
@@ -119,9 +123,10 @@ public class SchemaConfigurationConverter {
      * Convert TableIndex to TableIndexChange.
      *
      * @param idx TableIndex.
-     * @param idxChg TableIndexChange to fullfill.
+     * @param idxChg TableIndexChange to fulfill.
+     * @return TableIndexChange to get result from.
      */
-    public static void convert(TableIndex idx, TableIndexChange idxChg) {
+    public static TableIndexChange convert(TableIndex idx, TableIndexChange idxChg) {
         idxChg.changeName(idx.name());
         idxChg.changeType(idx.type());
 
@@ -181,6 +186,8 @@ public class SchemaConfigurationConverter {
             default:
                 throw new IllegalArgumentException("Unknown index type " + idx.type());
         }
+
+        return idxChg;
     }
 
     /**
@@ -203,10 +210,10 @@ public class SchemaConfigurationConverter {
                 boolean sortedUniq = idxView.uniq();
 
                 SortedMap<Integer, SortedIndexColumn> sortedCols = new TreeMap<>();
-                
+
                 for (String key : idxView.columns().namedListKeys()) {
                     SortedIndexColumn col = convert(idxView.columns().get(key));
-                    
+
                     sortedCols.put(Integer.valueOf(key), col);
                 }
 
@@ -218,10 +225,10 @@ public class SchemaConfigurationConverter {
 
                 NamedListView<? extends IndexColumnView> colsView = idxView.columns();
                 SortedMap<Integer, SortedIndexColumn> partialCols = new TreeMap<>();
-                
+
                 for (String key : idxView.columns().namedListKeys()) {
                     SortedIndexColumn col = convert(colsView.get(key));
-                    
+
                     partialCols.put(Integer.valueOf(key), col);
                 }
 
@@ -229,10 +236,10 @@ public class SchemaConfigurationConverter {
 
             case PK_TYPE:
                 SortedMap<Integer, SortedIndexColumn> cols = new TreeMap<>();
-                
+
                 for (String key : idxView.columns().namedListKeys()) {
                     SortedIndexColumn col = convert(idxView.columns().get(key));
-                    
+
                     cols.put(Integer.valueOf(key), col);
                 }
 
@@ -249,11 +256,12 @@ public class SchemaConfigurationConverter {
      * Convert ColumnType to ColumnTypeChange.
      *
      * @param colType ColumnType.
-     * @param colTypeChg ColumnTypeChange to fullfill.
+     * @param colTypeChg ColumnTypeChange to fulfill.
+     * @return ColumnTypeChange to get result from
      */
-    public static void convert(ColumnType colType, ColumnTypeChange colTypeChg) {
+    public static ColumnTypeChange convert(ColumnType colType, ColumnTypeChange colTypeChg) {
         String typeName = colType.typeSpec().name().toUpperCase();
-        
+
         if (types.containsKey(typeName))
             colTypeChg.changeType(typeName);
         else {
@@ -281,6 +289,8 @@ public class SchemaConfigurationConverter {
                     throw new IllegalArgumentException("Unknown type " + colType.typeSpec().name());
             }
         }
+
+        return colTypeChg;
     }
 
     /**
@@ -292,7 +302,7 @@ public class SchemaConfigurationConverter {
     public static ColumnType convert(ColumnTypeView colTypeView) {
         String typeName = colTypeView.type().toUpperCase();
         ColumnType res = types.get(typeName);
-        
+
         if (res != null)
             return res;
         else {
@@ -329,15 +339,18 @@ public class SchemaConfigurationConverter {
      *
      * @param col Column to convert.
      * @param colChg Column
+     * @return ColumnChange to get result from.
      */
-    public static void convert(Column col, ColumnChange colChg) {
+    public static ColumnChange convert(Column col, ColumnChange colChg) {
         colChg.changeName(col.name());
         colChg.changeType(colTypeInit -> convert(col.type(), colTypeInit));
-        
+
         if (col.defaultValue() != null)
             colChg.changeDefaultValue(col.defaultValue().toString());
-            
+
         colChg.changeNullable(col.nullable());
+
+        return colChg;
     }
 
     /**
@@ -358,9 +371,10 @@ public class SchemaConfigurationConverter {
      * Convert schema table to schema table change.
      *
      * @param tbl Schema table to convert.
-     * @param tblChg Change to fullfill.
+     * @param tblChg Change to fulfill.
+     * @return TableChange to get result from.
      */
-    public static void convert(SchemaTable tbl, TableChange tblChg) {
+    public static TableChange convert(SchemaTable tbl, TableChange tblChg) {
         tblChg.changeName(tbl.canonicalName());
 
         tblChg.changeIndices(idxsChg -> {
@@ -379,6 +393,8 @@ public class SchemaConfigurationConverter {
             for (Column col : tbl.valueColumns())
                 colsChg.create(String.valueOf(colIdx++), colChg -> convert(col, colChg));
         });
+
+        return tblChg;
     }
 
     /**
@@ -426,7 +442,7 @@ public class SchemaConfigurationConverter {
         }
 
         LinkedHashMap<String, Column> colsMap = new LinkedHashMap<>(colsView.size());
-        
+
         columns.forEach((i,v) -> colsMap.put(v.name(), v));
 
         return new SchemaTableImpl(schemaName, tableName, colsMap, indices);
@@ -458,7 +474,7 @@ public class SchemaConfigurationConverter {
      * Add index.
      *
      * @param idx Index to add.
-     * @param tblChange TableChange to fullfill.
+     * @param tblChange TableChange to fulfill.
      * @return TableChange to get result from.
      */
     public static TableChange addIndex(TableIndex idx, TableChange tblChange) {
diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaDescriptorConverter.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaDescriptorConverter.java
index 15f985d..29f288f 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaDescriptorConverter.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/configuration/SchemaDescriptorConverter.java
@@ -52,7 +52,7 @@ public class SchemaDescriptorConverter {
         assert colType != null;
 
         ColumnType.ColumnTypeSpec type = colType.typeSpec();
-        
+
         switch (type) {
             case INT8:
                 return BYTE;
@@ -89,12 +89,22 @@ public class SchemaDescriptorConverter {
                 return NativeTypes.bitmaskOf(((ColumnType.VarLenColumnType) colType).length());
 
             case STRING:
-                return NativeTypes.stringOf(((ColumnType.VarLenColumnType)colType).length());
+                int strLen = ((ColumnType.VarLenColumnType)colType).length();
+
+                if (strLen == 0)
+                    strLen = Integer.MAX_VALUE;
+
+                return NativeTypes.stringOf(strLen);
 
             case BLOB:
-                return NativeTypes.blobOf(((ColumnType.VarLenColumnType)colType).length());
+                int blobLen = ((ColumnType.VarLenColumnType)colType).length();
+
+                if (blobLen == 0)
+                    blobLen = Integer.MAX_VALUE;
+
+                return NativeTypes.blobOf(blobLen);
 
-                default:
+            default:
                 throw new InvalidTypeException("Unexpected type " + type);
         }
     }
@@ -119,9 +129,9 @@ public class SchemaDescriptorConverter {
      */
     public static SchemaDescriptor convert(UUID tblId, int schemaVer, SchemaTable tblCfg) {
         List<org.apache.ignite.schema.Column> keyColsCfg = new ArrayList<>(tblCfg.keyColumns());
-        
+
         Column[] keyCols = new Column[keyColsCfg.size()];
-        
+
         for (int i = 0;i < keyCols.length;i++)
             keyCols[i] = convert(keyColsCfg.get(i));
 
@@ -129,9 +139,9 @@ public class SchemaDescriptorConverter {
             .toArray(String[]::new);
 
         List<org.apache.ignite.schema.Column> valColsCfg = new ArrayList<>(tblCfg.valueColumns());
-        
+
         Column[] valCols = new Column[valColsCfg.size()];
-        
+
         for (int i = 0;i < valCols.length;i++)
             valCols[i] = convert(valColsCfg.get(i));
 
diff --git a/modules/schema/src/test/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverterTest.java b/modules/schema/src/test/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverterTest.java
index bb78ef2..1690b5a 100644
--- a/modules/schema/src/test/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverterTest.java
+++ b/modules/schema/src/test/java/org/apache/ignite/internal/schema/configuration/SchemaConfigurationConverterTest.java
@@ -82,9 +82,9 @@ public class SchemaConfigurationConverterTest {
 
         confRegistry.getConfiguration(TablesConfiguration.KEY).change(
             ch -> {
-                SchemaConfigurationConverter.createTable(tbl, ch);
-                ch.changeTables(tblsCh -> tblsCh.create(tbl.canonicalName(),
-                    tblCh -> tblCh.changeReplicas(1)));
+                SchemaConfigurationConverter.createTable(tbl, ch)
+                    .changeTables(tblsCh -> tblsCh.create(tbl.canonicalName(),
+                        tblCh -> tblCh.changeReplicas(1)));
             }).get();
     }
 
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
index 4953c15..ce67913 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
@@ -71,7 +71,7 @@ public class InternalTableImpl implements InternalTable {
 
     /** {@inheritDoc} */
     @Override public @NotNull CompletableFuture<BinaryRow> get(BinaryRow keyRow) {
-        return partitionMap.get(keyRow.hash() % partitions).<KVGetResponse>run(new GetCommand(keyRow))
+        return partitionMap.get(partId(keyRow)).<KVGetResponse>run(new GetCommand(keyRow))
             .thenApply(KVGetResponse::getValue);
     }
 
@@ -82,7 +82,7 @@ public class InternalTableImpl implements InternalTable {
 
     /** {@inheritDoc} */
     @Override public @NotNull CompletableFuture<Void> upsert(BinaryRow row) {
-        return partitionMap.get(row.hash() % partitions).run(new UpsertCommand(row));
+        return partitionMap.get(partId(row)).run(new UpsertCommand(row));
     }
 
     /** {@inheritDoc} */
@@ -97,7 +97,7 @@ public class InternalTableImpl implements InternalTable {
 
     /** {@inheritDoc} */
     @Override public @NotNull CompletableFuture<Boolean> insert(BinaryRow row) {
-        return partitionMap.get(row.hash() % partitions).run(new InsertCommand(row));
+        return partitionMap.get(partId(row)).run(new InsertCommand(row));
     }
 
     /** {@inheritDoc} */
@@ -112,7 +112,7 @@ public class InternalTableImpl implements InternalTable {
 
     /** {@inheritDoc} */
     @Override public @NotNull CompletableFuture<Boolean> replace(BinaryRow oldRow, BinaryRow newRow) {
-        return partitionMap.get(oldRow.hash() % partitions).run(new ReplaceCommand(oldRow, newRow));
+        return partitionMap.get(partId(oldRow)).run(new ReplaceCommand(oldRow, newRow));
     }
 
     /** {@inheritDoc} */
@@ -122,7 +122,7 @@ public class InternalTableImpl implements InternalTable {
 
     /** {@inheritDoc} */
     @Override public @NotNull CompletableFuture<Boolean> delete(BinaryRow keyRow) {
-        return partitionMap.get(keyRow.hash() % partitions).run(new DeleteCommand(keyRow));
+        return partitionMap.get(partId(keyRow)).run(new DeleteCommand(keyRow));
     }
 
     /** {@inheritDoc} */
@@ -144,4 +144,16 @@ public class InternalTableImpl implements InternalTable {
     @Override public @NotNull CompletableFuture<Collection<BinaryRow>> deleteAllExact(Collection<BinaryRow> rows) {
         return null;
     }
+
+    /**
+     * Get partition id by key row.
+     *
+     * @param row Key row.
+     * @return partition id.
+     */
+    private int partId(BinaryRow row) {
+        int partId = row.hash() % partitions;
+
+        return (partId < 0) ? -partId : partId;
+    }
 }
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/StrictSchemaOperationsTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/StrictSchemaOperationsTest.java
index 8d919ab..a32b403 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/StrictSchemaOperationsTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/StrictSchemaOperationsTest.java
@@ -89,8 +89,7 @@ public class StrictSchemaOperationsTest {
             1,
             new Column[] {new Column("id", NativeTypes.LONG, false)},
             new Column[] {
-                new Column("valString", NativeTypes.stringOf(3), true),
-                new Column("valBytes", NativeTypes.blobOf(3), true)
+                new Column("valString", NativeTypes.stringOf(3), true)
             }
         );
 
@@ -105,4 +104,28 @@ public class StrictSchemaOperationsTest {
         // Chek string 3 char length and 9 bytes.
         tbl.tupleBuilder().set("valString", "我是谁");
     }
+
+    /**
+     *
+     */
+    @Test
+    public void bytesTypeMatch() {
+        SchemaDescriptor schema = new SchemaDescriptor(
+            tableId,
+            1,
+            new Column[] {new Column("id", NativeTypes.LONG, false)},
+            new Column[] {
+                new Column("valUnlimited", NativeTypes.BYTES, true),
+                new Column("valLimited", NativeTypes.blobOf(2), true)
+            });
+
+        Table tbl = new TableImpl(new DummyInternalTableImpl(), new DummySchemaManagerImpl(schema));
+
+        tbl.tupleBuilder().set("valUnlimited", null);
+        tbl.tupleBuilder().set("valLimited", null);
+        tbl.tupleBuilder().set("valUnlimited", new byte[2]);
+        tbl.tupleBuilder().set("valLimited", new byte[2]);
+        tbl.tupleBuilder().set("valUnlimited", new byte[3]);
+        assertThrows(InvalidTypeException.class, () -> tbl.tupleBuilder().set("valLimited", new byte[3]));
+    }
 }
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/TableManagerTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/TableManagerTest.java
index 7ffb1a0..8c8a800 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/TableManagerTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/TableManagerTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.metastorage.MetaStorageManager;
 import org.apache.ignite.internal.raft.Loza;
 import org.apache.ignite.internal.schema.SchemaManager;
 import org.apache.ignite.internal.schema.SchemaRegistry;
+import org.apache.ignite.internal.schema.configuration.SchemaConfigurationConverter;
 import org.apache.ignite.internal.schema.event.SchemaEvent;
 import org.apache.ignite.internal.schema.event.SchemaEventParameters;
 import org.apache.ignite.internal.table.distributed.TableManager;
@@ -47,6 +48,9 @@ import org.apache.ignite.lang.IgniteLogger;
 import org.apache.ignite.metastorage.client.Condition;
 import org.apache.ignite.metastorage.client.Operation;
 import org.apache.ignite.network.ClusterNode;
+import org.apache.ignite.schema.ColumnType;
+import org.apache.ignite.schema.SchemaBuilders;
+import org.apache.ignite.schema.SchemaTable;
 import org.apache.ignite.table.Table;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
@@ -195,7 +199,7 @@ public class TableManagerTest {
 
         TableManager tableManager = mockManagersAndCreateTable(DYNAMIC_TABLE_NAME, mm, sm, am, rm, vm, node, tblIdFut);
 
-        assertNotNull(tableManager.table(DYNAMIC_TABLE_NAME));
+        assertNotNull(tableManager.table("PUBLIC." + DYNAMIC_TABLE_NAME));
     }
 
     /**
@@ -215,7 +219,7 @@ public class TableManagerTest {
 
         TableManager tableManager = mockManagersAndCreateTable(DYNAMIC_TABLE_FOR_DROP_NAME, mm, sm, am, rm, vm, node, tblIdFut);
 
-        assertNotNull(tableManager.table(DYNAMIC_TABLE_FOR_DROP_NAME));
+        assertNotNull(tableManager.table("PUBLIC." + DYNAMIC_TABLE_FOR_DROP_NAME));
 
         when(sm.unregisterSchemas(any())).thenReturn(CompletableFuture.completedFuture(true));
 
@@ -253,9 +257,9 @@ public class TableManagerTest {
             return null;
         }).when(am).listen(same(AffinityEvent.REMOVED), any());
 
-        tableManager.dropTable(DYNAMIC_TABLE_FOR_DROP_NAME);
+        tableManager.dropTable("PUBLIC." + DYNAMIC_TABLE_FOR_DROP_NAME);
 
-        assertNull(tableManager.table(DYNAMIC_TABLE_FOR_DROP_NAME));
+        assertNull(tableManager.table("PUBLIC." + DYNAMIC_TABLE_FOR_DROP_NAME));
     }
 
     /**
@@ -290,7 +294,8 @@ public class TableManagerTest {
 
             byte[] metastorageKeyBytes = (byte[])ReflectionUtils.invokeMethod(getKeyMethod, internalCondition);
 
-            tblIdFut.complete(UUID.fromString(new String(metastorageKeyBytes, StandardCharsets.UTF_8).substring(INTERNAL_PREFIX.length())));
+            tblIdFut.complete(UUID.fromString(new String(metastorageKeyBytes, StandardCharsets.UTF_8)
+                .substring(INTERNAL_PREFIX.length())));
 
             return CompletableFuture.completedFuture(true);
         });
@@ -335,22 +340,15 @@ public class TableManagerTest {
 
         int tablesBeforeCreation = tableManager.tables().size();
 
-        Table tbl2 = tableManager.createTable(tableName, change ->
-            change.changeName(tableName)
-                .changePartitions(PARTITIONS)
-                .changeReplicas(1)
-                .changeColumns(cols -> cols
-                    .create("key", c -> c.changeName("key").changeType(t -> t.changeType("INT64")).changeNullable(false))
-                    .create("val", c -> c.changeName("val").changeType(t -> t.changeType("INT64")).changeNullable(true))
-                )
-                .changeIndices(idxs -> idxs
-                    .create("PK", idx -> idx
-                        .changeName("PK")
-                        .changeType("PRIMARY")
-                        .changeColumns(c -> c
-                            .create("key", t -> t.changeName("key").changeAsc(true)))
-                        .changeAffinityColumns(new String[] {"key"}))
-                ));
+        SchemaTable scmTbl2 = SchemaBuilders.tableBuilder("PUBLIC", tableName).columns(
+            SchemaBuilders.column("key", ColumnType.INT64).asNonNull().build(),
+            SchemaBuilders.column("val", ColumnType.INT64).asNullable().build()
+        ).withPrimaryKey("key").build();
+
+        Table tbl2 = tableManager.createTable(scmTbl2.canonicalName(), tblCh -> SchemaConfigurationConverter.convert(scmTbl2, tblCh)
+            .changeReplicas(1)
+            .changePartitions(10)
+        );
 
         assertNotNull(tbl2);