Search in sources :

Example 1 with TableConfig

use of com.indeed.mph.TableConfig in project invesdwin-context-persistence by subes.

the class MphTablePerformanceTest method testMphTablePerformance.

@Test
public void testMphTablePerformance() throws IOException {
    final File directory = new File(ContextProperties.getCacheDirectory(), MphTablePerformanceTest.class.getSimpleName());
    Files.deleteNative(directory);
    Files.forceMkdir(directory);
    final File file = new File(directory, "testMphTablePerformance");
    final Instant writesStart = new Instant();
    final TableConfig<Long, Long> config = new TableConfig<Long, Long>().withKeySerializer(new SmartLongSerializer()).withValueSerializer(new SmartVLongSerializer());
    final ATransformingIterable<FDate, com.indeed.util.core.Pair<Long, Long>> entries = new ATransformingIterable<FDate, com.indeed.util.core.Pair<Long, Long>>(newValues()) {

        @Override
        protected com.indeed.util.core.Pair<Long, Long> transform(final FDate value) {
            return com.indeed.util.core.Pair.of(value.millisValue(), value.millisValue());
        }
    };
    // can not append to an existing table
    TableWriter.write(file, config, entries);
    printProgress("WritesFinished", writesStart, VALUES, VALUES);
    readIterator(file);
    readGet(file);
}
Also used : ATransformingIterable(de.invesdwin.util.collections.iterable.ATransformingIterable) Instant(de.invesdwin.util.time.Instant) FDate(de.invesdwin.util.time.date.FDate) SmartLongSerializer(com.indeed.mph.serializers.SmartLongSerializer) SmartVLongSerializer(com.indeed.mph.serializers.SmartVLongSerializer) TableConfig(com.indeed.mph.TableConfig) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

TableConfig (com.indeed.mph.TableConfig)1 SmartLongSerializer (com.indeed.mph.serializers.SmartLongSerializer)1 SmartVLongSerializer (com.indeed.mph.serializers.SmartVLongSerializer)1 ATransformingIterable (de.invesdwin.util.collections.iterable.ATransformingIterable)1 Instant (de.invesdwin.util.time.Instant)1 FDate (de.invesdwin.util.time.date.FDate)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1