use of com.linkedin.pinot.core.indexsegment.IndexSegment in project pinot by linkedin.
the class ColumnMetadataTest method testPaddingCharacter.
@Test
public void testPaddingCharacter() throws Exception {
// Build the Segment metadata.
SegmentGeneratorConfig config = CreateSegmentConfigWithoutCreator();
config.setPaddingCharacter('\0');
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 get null for creator name.
char paddingCharacter = metadata.getPaddingCharacter();
Assert.assertEquals(paddingCharacter, '\0');
}
use of com.linkedin.pinot.core.indexsegment.IndexSegment 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();
}
}
}
use of com.linkedin.pinot.core.indexsegment.IndexSegment in project pinot by linkedin.
the class QueriesSentinelTest method setup.
@BeforeClass
public void setup() throws Exception {
serverMetrics = new ServerMetrics(new MetricsRegistry());
TableDataManagerProvider.setServerMetrics(serverMetrics);
CONFIG_BUILDER = new TestingServerPropertiesBuilder("testTable");
setupSegmentFor("testTable");
setUpTestQueries("testTable");
final PropertiesConfiguration serverConf = CONFIG_BUILDER.build();
serverConf.setDelimiterParsingDisabled(false);
final FileBasedInstanceDataManager instanceDataManager = FileBasedInstanceDataManager.getInstanceDataManager();
instanceDataManager.init(new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
instanceDataManager.start();
// System.out.println("************************** : " + new File(INDEX_DIR, "segment").getAbsolutePath());
File segmentFile = new File(INDEX_DIR, "segment").listFiles()[0];
segmentName = segmentFile.getName();
final IndexSegment indexSegment = ColumnarSegmentLoader.load(segmentFile, ReadMode.heap);
instanceDataManager.getTableDataManager("testTable");
instanceDataManager.getTableDataManager("testTable").addSegment(indexSegment);
QUERY_EXECUTOR = new ServerQueryExecutorV1Impl(false);
QUERY_EXECUTOR.init(serverConf.subset("pinot.server.query.executor"), instanceDataManager, new ServerMetrics(new MetricsRegistry()));
}
use of com.linkedin.pinot.core.indexsegment.IndexSegment in project pinot by linkedin.
the class QueryExceptionTest method setup.
@BeforeClass
public void setup() throws Exception {
TableDataManagerProvider.setServerMetrics(new ServerMetrics(new MetricsRegistry()));
CONFIG_BUILDER = new TestingServerPropertiesBuilder("testTable");
setupSegmentFor("testTable");
final PropertiesConfiguration serverConf = CONFIG_BUILDER.build();
serverConf.setDelimiterParsingDisabled(false);
final FileBasedInstanceDataManager instanceDataManager = FileBasedInstanceDataManager.getInstanceDataManager();
instanceDataManager.init(new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
instanceDataManager.start();
// System.out.println("************************** : " + new File(INDEX_DIR, "segment").getAbsolutePath());
File segmentFile = new File(INDEX_DIR, "segment").listFiles()[0];
segmentName = segmentFile.getName();
final IndexSegment indexSegment = ColumnarSegmentLoader.load(segmentFile, ReadMode.heap);
instanceDataManager.getTableDataManager("testTable");
instanceDataManager.getTableDataManager("testTable").addSegment(indexSegment);
QUERY_EXECUTOR = new ServerQueryExecutorV1Impl(false);
QUERY_EXECUTOR.init(serverConf.subset("pinot.server.query.executor"), instanceDataManager, new ServerMetrics(new MetricsRegistry()));
}
use of com.linkedin.pinot.core.indexsegment.IndexSegment in project pinot by linkedin.
the class QueryExecutorTest method testCountQuery.
@Test
public void testCountQuery() {
BrokerRequest brokerRequest = getCountQuery();
QuerySource querySource = new QuerySource();
querySource.setTableName("midas");
brokerRequest.setQuerySource(querySource);
InstanceRequest instanceRequest = new InstanceRequest(0, brokerRequest);
instanceRequest.setSearchSegments(new ArrayList<String>());
for (IndexSegment segment : _indexSegmentList) {
instanceRequest.getSearchSegments().add(segment.getSegmentName());
}
QueryRequest queryRequest = new QueryRequest(instanceRequest, serverMetrics);
DataTable instanceResponse = _queryExecutor.processQuery(queryRequest, queryRunners);
LOGGER.info("InstanceResponse is " + instanceResponse.getLong(0, 0));
Assert.assertEquals(instanceResponse.getLong(0, 0), 400002L);
LOGGER.info("Time used for instanceResponse is " + instanceResponse.getMetadata().get(DataTable.TIME_USED_MS_METADATA_KEY));
}
Aggregations