Search in sources :

Example 1 with SegmentWithHllIndexCreateHelper

use of com.linkedin.pinot.core.startree.hll.SegmentWithHllIndexCreateHelper in project pinot by linkedin.

the class ColumnMetadataTest method testHllIndexRelatedMetadata.

@Test
public void testHllIndexRelatedMetadata() throws Exception {
    SegmentWithHllIndexCreateHelper helper = null;
    try {
        // Build the Segment metadata.
        helper = new SegmentWithHllIndexCreateHelper("testHllIndexRelatedMetadata", getClass().getClassLoader().getResource("data/test_data-sv.avro"), "daysSinceEpoch", TimeUnit.DAYS, "starTreeSegment");
        helper.build(true, new HllConfig(9, new HashSet<String>(Arrays.asList("column7")), "_hllSuffix"));
        // Load segment metadata.
        IndexSegment segment = Loaders.IndexSegment.load(helper.getSegmentDirectory(), ReadMode.mmap);
        SegmentMetadataImpl metadata = (SegmentMetadataImpl) segment.getSegmentMetadata();
        Assert.assertEquals(metadata.getHllLog2m(), 9);
        // Verify Hll Related Info
        StarTreeMetadata starTreeMetadata = metadata.getStarTreeMetadata();
        Assert.assertNotNull(starTreeMetadata);
        ColumnMetadata column = metadata.getColumnMetadataFor("column7_hllSuffix");
        Assert.assertEquals(column.getDerivedMetricType(), MetricFieldSpec.DerivedMetricType.HLL);
        Assert.assertEquals(column.getOriginColumnName(), "column7");
    } finally {
        if (helper != null) {
            helper.cleanTempDir();
        }
    }
}
Also used : StarTreeMetadata(com.linkedin.pinot.common.segment.StarTreeMetadata) IndexSegment(com.linkedin.pinot.core.indexsegment.IndexSegment) HllConfig(com.linkedin.pinot.core.startree.hll.HllConfig) SegmentWithHllIndexCreateHelper(com.linkedin.pinot.core.startree.hll.SegmentWithHllIndexCreateHelper) HashSet(java.util.HashSet) Test(org.testng.annotations.Test)

Example 2 with SegmentWithHllIndexCreateHelper

use of com.linkedin.pinot.core.startree.hll.SegmentWithHllIndexCreateHelper in project pinot by linkedin.

the class TestHelper method buildLoadDefaultHllSegment.

SegmentWithHllIndexCreateHelper buildLoadDefaultHllSegment(HllConfig hllConfig) throws Exception {
    SegmentWithHllIndexCreateHelper helper = buildDefaultHllSegment(hllConfig);
    loadSegment(helper.getSegmentDirectory());
    return helper;
}
Also used : SegmentWithHllIndexCreateHelper(com.linkedin.pinot.core.startree.hll.SegmentWithHllIndexCreateHelper)

Example 3 with SegmentWithHllIndexCreateHelper

use of com.linkedin.pinot.core.startree.hll.SegmentWithHllIndexCreateHelper in project pinot by linkedin.

the class TestHelper method buildHllSegment.

SegmentWithHllIndexCreateHelper buildHllSegment(String tableName, String avroData, String timeColumn, TimeUnit timeUnit, String testSegment, HllConfig hllConfig, boolean enableStarTree) throws Exception {
    SegmentWithHllIndexCreateHelper helper = new SegmentWithHllIndexCreateHelper(tableName, avroData, timeColumn, timeUnit, testSegment);
    helper.build(enableStarTree, hllConfig);
    return helper;
}
Also used : SegmentWithHllIndexCreateHelper(com.linkedin.pinot.core.startree.hll.SegmentWithHllIndexCreateHelper)

Aggregations

SegmentWithHllIndexCreateHelper (com.linkedin.pinot.core.startree.hll.SegmentWithHllIndexCreateHelper)3 StarTreeMetadata (com.linkedin.pinot.common.segment.StarTreeMetadata)1 IndexSegment (com.linkedin.pinot.core.indexsegment.IndexSegment)1 HllConfig (com.linkedin.pinot.core.startree.hll.HllConfig)1 HashSet (java.util.HashSet)1 Test (org.testng.annotations.Test)1