Search in sources :

Example 6 with TableDefinitionBuilder

use of org.apache.ignite.schema.definition.builder.TableDefinitionBuilder in project ignite-3 by apache.

the class SchemaConfigurationTest method invalidColocationColumns.

/**
 * TestInitialSchema.
 * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
 */
@Test
public void invalidColocationColumns() {
    final TableDefinitionBuilder builder = SchemaBuilders.tableBuilder(SchemaObject.DEFAULT_DATABASE_SCHEMA_NAME, "table1");
    assertThrows(IllegalStateException.class, () -> // Declare index column in order.
    SchemaBuilders.primaryKey().withColumns("id0", "id1", "id2").withColocationColumns("val").build(), "Schema definition error: All colocation columns must be part of key.");
    assertThrows(IllegalStateException.class, () -> // Declare index column in order.
    SchemaBuilders.primaryKey().withColumns("id0", "id1", "id2").withColocationColumns("id0, id1, id0").build(), "Schema definition error: Colocation columns must not be duplicated.");
}
Also used : TableDefinitionBuilder(org.apache.ignite.schema.definition.builder.TableDefinitionBuilder) Test(org.junit.jupiter.api.Test)

Aggregations

TableDefinitionBuilder (org.apache.ignite.schema.definition.builder.TableDefinitionBuilder)6 Test (org.junit.jupiter.api.Test)6 TableDefinition (org.apache.ignite.schema.definition.TableDefinition)4 SchemaDescriptor (org.apache.ignite.internal.schema.SchemaDescriptor)3 Arrays (java.util.Arrays)1 Function (java.util.function.Function)1 Column (org.apache.ignite.internal.schema.Column)1 Columns (org.apache.ignite.internal.schema.Columns)1 NativeTypeSpec (org.apache.ignite.internal.schema.NativeTypeSpec)1 SchemaBuilders (org.apache.ignite.schema.SchemaBuilders)1 ColumnDefinition (org.apache.ignite.schema.definition.ColumnDefinition)1 ColumnType (org.apache.ignite.schema.definition.ColumnType)1 ColumnDefinitionBuilder (org.apache.ignite.schema.definition.builder.ColumnDefinitionBuilder)1 Assertions.assertArrayEquals (org.junit.jupiter.api.Assertions.assertArrayEquals)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1