use of org.apache.ignite.schema.definition.builder.PartialIndexDefinitionBuilder in project ignite-3 by apache.
the class SchemaConfigurationConverterTest method testPartialIndex.
/**
* Add/remove PartialIndex into configuration and read it back.
*/
@Test
public void testPartialIndex() throws Exception {
PartialIndexDefinitionBuilder builder = SchemaBuilders.partialIndex("TEST");
builder.addIndexColumn("A").done();
builder.withExpression("WHERE A > 0");
PartialIndexDefinition idx = builder.build();
getTbl().change(ch -> SchemaConfigurationConverter.addIndex(idx, ch)).get();
TableDefinition tbl = SchemaConfigurationConverter.convert(getTbl().value());
PartialIndexDefinition idx2 = (PartialIndexDefinition) getIdx(idx.name(), tbl.indices());
assertNotNull(idx2);
assertEquals("PARTIAL", idx2.type());
assertEquals(idx.columns().size(), idx2.columns().size());
}
use of org.apache.ignite.schema.definition.builder.PartialIndexDefinitionBuilder in project ignite-3 by apache.
the class PartialIndexDefinitionBuilderTest method testPartialIndexCreate.
/**
* Test partial index parameters.
*/
@Test
public void testPartialIndexCreate() {
PartialIndexDefinitionBuilder builder = SchemaBuilders.partialIndex("TEST");
builder.addIndexColumn("A").done();
builder.withExpression("WHERE A > 0");
PartialIndexDefinition idx = builder.build();
assertEquals(1, idx.columns().size());
assertEquals("WHERE A > 0", idx.expr());
}
Aggregations