use of com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver in project pinot by linkedin.
the class SegmentPreProcessorTest method constructSegment.
private void constructSegment() throws Exception {
FileUtils.deleteQuietly(INDEX_DIR);
URL resourceUrl = getClass().getClassLoader().getResource(AVRO_DATA);
Assert.assertNotNull(resourceUrl);
File avroFile = new File(TestUtils.getFileFromResourceUrl(resourceUrl));
// NOTE: We create inverted index for 'column7' when constructing the segment.
// Intentionally changed this to TimeUnit.Hours to make it non-default for testing.
SegmentGeneratorConfig segmentGeneratorConfig = SegmentTestUtils.getSegmentGeneratorConfigWithSchema(avroFile, INDEX_DIR, "testTable", _schema);
segmentGeneratorConfig.setSegmentNamePostfix("1");
segmentGeneratorConfig.setInvertedIndexCreationColumns(Collections.singletonList(COLUMN7_NAME));
SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
driver.init(segmentGeneratorConfig);
driver.build();
_segmentDirectoryFile = new File(INDEX_DIR, driver.getSegmentName());
}
use of com.linkedin.pinot.core.segment.creator.SegmentIndexCreationDriver in project pinot by linkedin.
the class ColumnMetadataTest method testAllFieldsInitialized.
@Test
public void testAllFieldsInitialized() throws Exception {
// Build the Segment metadata.
SegmentGeneratorConfig config = createSegmentConfigWithCreator();
SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
driver.init(config);
driver.build();
// Load segment metadata.
IndexSegment segment = Loaders.IndexSegment.load(INDEX_DIR.listFiles()[0], ReadMode.mmap);
SegmentMetadataImpl metadata = (SegmentMetadataImpl) segment.getSegmentMetadata();
verifySegmentAfterLoading(metadata);
// Make sure we got the creator name as well.
String creatorName = metadata.getCreatorName();
Assert.assertEquals(creatorName, CREATOR_VERSION);
}
Aggregations