use of org.apache.ignite.schema.definition.builder.HashIndexDefinitionBuilder in project ignite-3 by apache.
the class SchemaConfigurationConverterTest method testConvertHashIndex.
/**
* Add/remove HashIndex into configuration and read it back.
*/
@Test
public void testConvertHashIndex() throws Exception {
HashIndexDefinitionBuilder builder = SchemaBuilders.hashIndex("testHI").withColumns("A", "B", "C").withHints(Collections.singletonMap("param", "value"));
HashIndexDefinition idx = builder.build();
getTbl().change(ch -> SchemaConfigurationConverter.addIndex(idx, ch)).get();
TableDefinition tbl = SchemaConfigurationConverter.convert(getTbl().value());
HashIndexDefinition idx2 = (HashIndexDefinition) getIdx(idx.name(), tbl.indices());
assertNotNull(idx2);
assertEquals("HASH", idx2.type());
assertEquals(3, idx2.columns().size());
}
use of org.apache.ignite.schema.definition.builder.HashIndexDefinitionBuilder in project ignite-3 by apache.
the class HashIndexDefinitionBuilderTest method testBuild.
/**
* Build index and check its parameters.
*/
@Test
public void testBuild() {
HashIndexDefinitionBuilder builder = SchemaBuilders.hashIndex("testHI").withColumns("A", "B", "C").withHints(Collections.singletonMap("param", "value"));
HashIndexDefinition idx = builder.build();
assertEquals("TESTHI", idx.name());
assertEquals(3, idx.columns().size());
}
use of org.apache.ignite.schema.definition.builder.HashIndexDefinitionBuilder in project ignite-3 by apache.
the class HashIndexDefinitionBuilderTest method testBuildNoColumns.
/**
* Try to create index without columns and check error.
*/
@Test
public void testBuildNoColumns() {
HashIndexDefinitionBuilder builder = SchemaBuilders.hashIndex("testHI");
assertThrows(AssertionError.class, builder::build);
}
Aggregations