Search in sources :

Example 56 with IndexSample

use of org.neo4j.kernel.api.index.IndexSample in project neo4j by neo4j.

the class NativeUniqueIndexPopulatorTest method shouldSampleUpdates.

@Test
void shouldSampleUpdates() throws Exception {
    // GIVEN
    populator.create();
    IndexEntryUpdate<IndexDescriptor>[] updates = valueCreatorUtil.someUpdates(random);
    // WHEN
    populator.add(asList(updates), NULL);
    for (IndexEntryUpdate<IndexDescriptor> update : updates) {
        populator.includeSample(update);
    }
    populator.scanCompleted(nullInstance, populationWorkScheduler, NULL);
    IndexSample sample = populator.sample(NULL);
    // THEN
    assertEquals(updates.length, sample.sampleSize());
    assertEquals(updates.length, sample.uniqueValues());
    assertEquals(updates.length, sample.indexSize());
    populator.close(true, NULL);
}
Also used : IndexEntryUpdate(org.neo4j.storageengine.api.IndexEntryUpdate) IndexSample(org.neo4j.kernel.api.index.IndexSample) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) Test(org.junit.jupiter.api.Test)

Aggregations

IndexSample (org.neo4j.kernel.api.index.IndexSample)56 Test (org.junit.jupiter.api.Test)43 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)14 CursorContext (org.neo4j.io.pagecache.context.CursorContext)13 IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)10 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)8 IndexEntryUpdate (org.neo4j.storageengine.api.IndexEntryUpdate)8 NodePropertyAccessor (org.neo4j.storageengine.api.NodePropertyAccessor)8 IndexProvider (org.neo4j.kernel.api.index.IndexProvider)7 IndexSampler (org.neo4j.kernel.api.index.IndexSampler)7 ArrayList (java.util.ArrayList)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Config (org.neo4j.configuration.Config)6 Transaction (org.neo4j.graphdb.Transaction)6 IOException (java.io.IOException)5 Path (java.nio.file.Path)4 Arrays.asList (java.util.Arrays.asList)4 HashSet (java.util.HashSet)4 Set (java.util.Set)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4