You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/05/26 11:02:05 UTC

[GitHub] [ignite-3] Berkof opened a new pull request #150: Ignite-14785: Configuration API to SchemaBuilders

Berkof opened a new pull request #150:
URL: https://github.com/apache/ignite-3/pull/150


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] AMashenkov commented on a change in pull request #150: Ignite-14785: Configuration API to SchemaBuilders

Posted by GitBox <gi...@apache.org>.
AMashenkov commented on a change in pull request #150:
URL: https://github.com/apache/ignite-3/pull/150#discussion_r640512998



##########
File path: modules/table/src/test/java/org/apache/ignite/internal/table/StrictSchemaOperationsTest.java
##########
@@ -105,4 +108,25 @@ public void stringTypeMatch() {
         // Chek string 3 char length and 9 bytes.
         tbl.tupleBuilder().set("valString", "我是谁");
     }
+
+    /**
+     *
+     */
+    @Test
+    public void bytesTypeMatch() {
+        SchemaTable scmTbl = SchemaBuilders.tableBuilder("PUBLIC", "TBL").columns(
+            SchemaBuilders.column("key", ColumnType.INT8).asNonNull().build(),
+            SchemaBuilders.column("valUnlimited", ColumnType.blobOf()).asNullable().build(),
+            SchemaBuilders.column("valLimited", ColumnType.blobOf(2)).asNullable().build()
+        ).withPrimaryKey("key").build();
+
+        SchemaDescriptor schema = SchemaDescriptorConverter.convert(tableId, 1, scmTbl);
+
+        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[0]);
+        tbl.tupleBuilder().set("valLimited", new byte[0]);

Review comment:
           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]));    




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #150: Ignite-14785: Configuration API to SchemaBuilders

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #150:
URL: https://github.com/apache/ignite-3/pull/150#discussion_r640565146



##########
File path: modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
##########
@@ -92,33 +96,26 @@ void testDynamicSimpleTableCreation() {
         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)

Review comment:
       It is only a test, we often use internal classes there.
   After this PR we will add a method which gets a SchemaTable instead of Changer.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] AMashenkov commented on a change in pull request #150: Ignite-14785: Configuration API to SchemaBuilders

Posted by GitBox <gi...@apache.org>.
AMashenkov commented on a change in pull request #150:
URL: https://github.com/apache/ignite-3/pull/150#discussion_r640545574



##########
File path: modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/DynamicTableCreationTest.java
##########
@@ -92,33 +96,26 @@ void testDynamicSimpleTableCreation() {
         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)

Review comment:
       SchemaConfigurationConverter is internal class.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] Berkof commented on a change in pull request #150: Ignite-14785: Configuration API to SchemaBuilders

Posted by GitBox <gi...@apache.org>.
Berkof commented on a change in pull request #150:
URL: https://github.com/apache/ignite-3/pull/150#discussion_r640594303



##########
File path: modules/table/src/test/java/org/apache/ignite/internal/table/StrictSchemaOperationsTest.java
##########
@@ -105,4 +108,25 @@ public void stringTypeMatch() {
         // Chek string 3 char length and 9 bytes.
         tbl.tupleBuilder().set("valString", "我是谁");
     }
+
+    /**
+     *
+     */
+    @Test
+    public void bytesTypeMatch() {
+        SchemaTable scmTbl = SchemaBuilders.tableBuilder("PUBLIC", "TBL").columns(
+            SchemaBuilders.column("key", ColumnType.INT8).asNonNull().build(),
+            SchemaBuilders.column("valUnlimited", ColumnType.blobOf()).asNullable().build(),
+            SchemaBuilders.column("valLimited", ColumnType.blobOf(2)).asNullable().build()
+        ).withPrimaryKey("key").build();
+
+        SchemaDescriptor schema = SchemaDescriptorConverter.convert(tableId, 1, scmTbl);
+
+        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[0]);
+        tbl.tupleBuilder().set("valLimited", new byte[0]);

Review comment:
       DONE




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] AMashenkov commented on a change in pull request #150: Ignite-14785: Configuration API to SchemaBuilders

Posted by GitBox <gi...@apache.org>.
AMashenkov commented on a change in pull request #150:
URL: https://github.com/apache/ignite-3/pull/150#discussion_r640512998



##########
File path: modules/table/src/test/java/org/apache/ignite/internal/table/StrictSchemaOperationsTest.java
##########
@@ -105,4 +108,25 @@ public void stringTypeMatch() {
         // Chek string 3 char length and 9 bytes.
         tbl.tupleBuilder().set("valString", "我是谁");
     }
+
+    /**
+     *
+     */
+    @Test
+    public void bytesTypeMatch() {
+        SchemaTable scmTbl = SchemaBuilders.tableBuilder("PUBLIC", "TBL").columns(
+            SchemaBuilders.column("key", ColumnType.INT8).asNonNull().build(),
+            SchemaBuilders.column("valUnlimited", ColumnType.blobOf()).asNullable().build(),
+            SchemaBuilders.column("valLimited", ColumnType.blobOf(2)).asNullable().build()
+        ).withPrimaryKey("key").build();
+
+        SchemaDescriptor schema = SchemaDescriptorConverter.convert(tableId, 1, scmTbl);
+
+        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[0]);
+        tbl.tupleBuilder().set("valLimited", new byte[0]);

Review comment:
           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]));
       }




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] AMashenkov merged pull request #150: Ignite-14785: Configuration API to SchemaBuilders

Posted by GitBox <gi...@apache.org>.
AMashenkov merged pull request #150:
URL: https://github.com/apache/ignite-3/pull/150


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org