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 2020/12/28 10:39:59 UTC

[GitHub] [ignite-3] alamar commented on a change in pull request #2: IGNITE-13748: Schema configuration public API.

alamar commented on a change in pull request #2:
URL: https://github.com/apache/ignite-3/pull/2#discussion_r549299897



##########
File path: modules/commons/src/test/java/org/apache/ignite/internal/schema/SchemaConfigurationTest.java
##########
@@ -0,0 +1,106 @@
+package org.apache.ignite.internal.schema;
+
+import org.apache.ignite.schema.ColumnType;
+import org.apache.ignite.schema.SchemaBuilders;
+import org.apache.ignite.schema.SchemaTable;
+import org.apache.ignite.schema.builder.SchemaTableBuilder;
+import org.junit.jupiter.api.Test;
+
+public class SchemaConfigurationTest {
+    @Test
+    public void testInitialSchema() {
+        //TODO: Do we need separate 'Schema builder' or left 'schema' name as kind of 'namespace'.
+        final SchemaTableBuilder builder = SchemaBuilders.tableBuilder("PUBLIC", "table1");
+
+        builder
+            .columns(
+                // Declaring columns in user order.
+                SchemaBuilders.column("id").withType(ColumnType.INT64).build(),
+                SchemaBuilders.column("label").withType(ColumnType.stringOf(2)).withDefaultValue("AI").build(),
+                SchemaBuilders.column("name").withType(ColumnType.string()).asNonNull().build(),
+                SchemaBuilders.column("data").withType(ColumnType.blobOf(255)).asNullable().build(),
+                SchemaBuilders.column("affId").withType(ColumnType.INT32).build()
+            )
+
+            // PK index type can't be changed as highly coupled core implementation.
+            .pk()
+            .withColumns("id", "affId", "label") // Declare index column in order.
+            .withAffinityColumns("affId") // Optional affinity declaration. If not set, all columns will be affinity cols.
+            //TODO: As we have affinity columns here,
+            //TODO: do we want to add affinity function config here???
+            .done()
+
+            // 'withIndex' single entry point allows extended index support.
+            // E.g. we may want to support GEO indices later with some plugin.
+            .withindex(

Review comment:
       Why lower case index?




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