use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class IndexLoadingConfigMetadataTest method getTestResourceMetadata.
private Configuration getTestResourceMetadata() {
Configuration resourceMetadata = new PropertiesConfiguration();
String columnNames = null;
for (int i = 0; i < 10; ++i) {
if (columnNames == null) {
columnNames = ("col" + i);
} else {
columnNames += (", col" + i);
}
}
resourceMetadata.addProperty(KEY_OF_LOADING_INVERTED_INDEX, columnNames);
resourceMetadata.addProperty(KEY_OF_ENABLE_DEFAULT_COLUMNS, true);
return resourceMetadata;
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class IndexLoadingConfigMetadataTest method testInvertedIndexConfig.
@Test
public void testInvertedIndexConfig() {
Configuration resourceMetadata = getTestResourceMetadata();
IndexLoadingConfigMetadata indexLoadingConfigMetadata = new IndexLoadingConfigMetadata(resourceMetadata);
Set<String> loadingInvertedIndexColumns = indexLoadingConfigMetadata.getLoadingInvertedIndexColumns();
// System.out.println("loadingInvertedIndexColumns is " + Arrays.toString(loadingInvertedIndexColumns.toArray(new String[0])));
Assert.assertEquals(10, loadingInvertedIndexColumns.size());
for (int j = 0; j < 10; ++j) {
String columnName = "col" + j;
Assert.assertTrue(indexLoadingConfigMetadata.isLoadingInvertedIndexForColumn(columnName));
}
for (int j = 10; j < 20; ++j) {
String columnName = "col" + j;
Assert.assertFalse(indexLoadingConfigMetadata.isLoadingInvertedIndexForColumn(columnName));
}
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class SegmentV1V2ToV3FormatConverterTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
INDEX_DIR = Files.createTempDirectory(SegmentV1V2ToV3FormatConverter.class.getName() + "_segmentDir").toFile();
final String filePath = TestUtils.getFileFromResourceUrl(SegmentV1V2ToV3FormatConverter.class.getClassLoader().getResource(AVRO_DATA));
// intentionally changed this to TimeUnit.Hours to make it non-default for testing
final SegmentGeneratorConfig config = SegmentTestUtils.getSegmentGenSpecWithSchemAndProjectedColumns(new File(filePath), INDEX_DIR, "daysSinceEpoch", TimeUnit.HOURS, "testTable");
config.setSegmentNamePostfix("1");
config.setTimeColumnName("daysSinceEpoch");
final SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
driver.init(config);
driver.build();
segmentDirectory = new File(INDEX_DIR, driver.getSegmentName());
File starTreeFile = new File(segmentDirectory, V1Constants.STAR_TREE_INDEX_FILE);
FileUtils.touch(starTreeFile);
FileUtils.writeStringToFile(starTreeFile, "This is a star tree index");
Configuration tableConfig = new PropertiesConfiguration();
tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v1");
v1LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);
tableConfig.clear();
tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v3");
v3LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class LoadersTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
INDEX_DIR = Files.createTempDirectory(LoadersTest.class.getName() + "_segmentDir").toFile();
final String filePath = TestUtils.getFileFromResourceUrl(Loaders.class.getClassLoader().getResource(AVRO_DATA));
final SegmentGeneratorConfig config = SegmentTestUtils.getSegmentGenSpecWithSchemAndProjectedColumns(new File(filePath), INDEX_DIR, "daysSinceEpoch", TimeUnit.HOURS, "testTable");
config.setSegmentNamePostfix("1");
config.setTimeColumnName("daysSinceEpoch");
final SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null);
driver.init(config);
driver.build();
segmentDirectory = new File(INDEX_DIR, driver.getSegmentName());
Configuration tableConfig = new PropertiesConfiguration();
tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v1");
v1LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);
tableConfig.clear();
tableConfig.addProperty(IndexLoadingConfigMetadata.KEY_OF_SEGMENT_FORMAT_VERSION, "v3");
v3LoadingConfig = new IndexLoadingConfigMetadata(tableConfig);
}
use of org.apache.commons.configuration.Configuration in project pinot by linkedin.
the class ClusterTest method startServers.
protected void startServers(int serverCount) {
try {
for (int i = 0; i < serverCount; i++) {
Configuration configuration = DefaultHelixStarterServerConfig.loadDefaultServerConf();
configuration.setProperty(Server.CONFIG_OF_INSTANCE_DATA_DIR, Server.DEFAULT_INSTANCE_DATA_DIR + "-" + i);
configuration.setProperty(Server.CONFIG_OF_INSTANCE_SEGMENT_TAR_DIR, Server.DEFAULT_INSTANCE_SEGMENT_TAR_DIR + "-" + i);
configuration.setProperty(Server.CONFIG_OF_ADMIN_API_PORT, Integer.toString(Integer.valueOf(Server.DEFAULT_ADMIN_API_PORT) - i));
configuration.setProperty(Server.CONFIG_OF_NETTY_PORT, Integer.toString(Integer.valueOf(Helix.DEFAULT_SERVER_NETTY_PORT) + i));
configuration.setProperty(Server.CONFIG_OF_SEGMENT_FORMAT_VERSION, "v3");
overrideOfflineServerConf(configuration);
_serverStarters.add(new HelixServerStarter(getHelixClusterName(), ZkStarter.DEFAULT_ZK_STR, configuration));
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations