Search in sources :

Example 1 with ColumnMetadataTest

use of com.linkedin.pinot.core.segment.index.ColumnMetadataTest in project pinot by linkedin.

the class DefaultSegmentNameGeneratorTest method testNullPostfix.

@Test
public void testNullPostfix() throws Exception {
    ColumnMetadataTest columnMetadataTest = new ColumnMetadataTest();
    // Build the Segment metadata.
    SegmentGeneratorConfig config = columnMetadataTest.CreateSegmentConfigWithoutCreator();
    SegmentNameGenerator segmentNameGenerator = new DefaultSegmentNameGenerator("daysSinceEpoch", "mytable", null, -1);
    config.setSegmentNameGenerator(segmentNameGenerator);
    SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
    driver.init(config);
    driver.build();
    Assert.assertEquals(driver.getSegmentName(), "mytable_1756015683_1756015683");
}
Also used : SegmentIndexCreationDriver(com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) SegmentGeneratorConfig(com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) Test(org.testng.annotations.Test)

Example 2 with ColumnMetadataTest

use of com.linkedin.pinot.core.segment.index.ColumnMetadataTest in project pinot by linkedin.

the class DefaultSegmentNameGeneratorTest method testPostfix.

@Test
public void testPostfix() throws Exception {
    ColumnMetadataTest columnMetadataTest = new ColumnMetadataTest();
    // Build the Segment metadata.
    SegmentGeneratorConfig config = columnMetadataTest.CreateSegmentConfigWithoutCreator();
    SegmentNameGenerator segmentNameGenerator = new DefaultSegmentNameGenerator("daysSinceEpoch", "mytable", "1", -1);
    config.setSegmentNameGenerator(segmentNameGenerator);
    SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
    driver.init(config);
    driver.build();
    Assert.assertEquals(driver.getSegmentName(), "mytable_1756015683_1756015683_1");
}
Also used : SegmentIndexCreationDriver(com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) SegmentGeneratorConfig(com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) Test(org.testng.annotations.Test)

Example 3 with ColumnMetadataTest

use of com.linkedin.pinot.core.segment.index.ColumnMetadataTest in project pinot by linkedin.

the class DefaultSegmentNameGeneratorTest method testAlreadyNamedSegment.

@Test
public void testAlreadyNamedSegment() throws Exception {
    ColumnMetadataTest columnMetadataTest = new ColumnMetadataTest();
    // Build the Segment metadata.
    SegmentGeneratorConfig config = columnMetadataTest.CreateSegmentConfigWithoutCreator();
    SegmentNameGenerator segmentNameGenerator = new DefaultSegmentNameGenerator("mytable_1");
    config.setSegmentNameGenerator(segmentNameGenerator);
    SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
    driver.init(config);
    driver.build();
    Assert.assertEquals(driver.getSegmentName(), "mytable_1");
}
Also used : SegmentIndexCreationDriver(com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) SegmentGeneratorConfig(com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) Test(org.testng.annotations.Test)

Example 4 with ColumnMetadataTest

use of com.linkedin.pinot.core.segment.index.ColumnMetadataTest in project pinot by linkedin.

the class DefaultSegmentNameGeneratorTest method testNullTimeColumn.

@Test
public void testNullTimeColumn() throws Exception {
    ColumnMetadataTest columnMetadataTest = new ColumnMetadataTest();
    // Build the Segment metadata.
    SegmentGeneratorConfig config = columnMetadataTest.CreateSegmentConfigWithoutCreator();
    config.setTableName("mytable");
    config.setSegmentNamePostfix("postfix");
    config.setTimeColumnName(null);
    SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
    driver.init(config);
    driver.build();
    Assert.assertEquals(driver.getSegmentName(), "mytable_postfix");
}
Also used : SegmentIndexCreationDriver(com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) SegmentGeneratorConfig(com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) Test(org.testng.annotations.Test)

Example 5 with ColumnMetadataTest

use of com.linkedin.pinot.core.segment.index.ColumnMetadataTest in project pinot by linkedin.

the class DefaultSegmentNameGeneratorTest method testNullTimeColumnThroughDefaultSegment.

@Test
public void testNullTimeColumnThroughDefaultSegment() throws Exception {
    ColumnMetadataTest columnMetadataTest = new ColumnMetadataTest();
    // Build the Segment metadata.
    SegmentGeneratorConfig config = columnMetadataTest.CreateSegmentConfigWithoutCreator();
    SegmentNameGenerator segmentNameGenerator = new DefaultSegmentNameGenerator(null, "mytable", "1", 2);
    config.setSegmentNameGenerator(segmentNameGenerator);
    SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
    driver.init(config);
    driver.build();
    Assert.assertEquals(driver.getSegmentName(), "mytable_1_2");
}
Also used : SegmentIndexCreationDriver(com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) SegmentGeneratorConfig(com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig) ColumnMetadataTest(com.linkedin.pinot.core.segment.index.ColumnMetadataTest) Test(org.testng.annotations.Test)

Aggregations

SegmentGeneratorConfig (com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig)7 SegmentIndexCreationDriver (com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver)7 ColumnMetadataTest (com.linkedin.pinot.core.segment.index.ColumnMetadataTest)7 Test (org.testng.annotations.Test)7