use of com.mapr.db.Admin in project drill by apache.
the class IndexPlanTest method setupTableIndexes.
/**
* A sample row of this 10K table:
* ------------------+-----------------------------+--------+
* | 1012 | {"city":"pfrrs","state":"pc"} | {"email":"KfFzKUZwNk@gmail.com","phone":"6500005471"} |
* {"ssn":"100007423"} | {"fname":"KfFzK","lname":"UZwNk"} | {"age":53.0,"income":45.0} | 1012 |
*
* This test suite generate random content to fill all the rows, since the random function always start from
* the same seed for different runs, when the row count is not changed, the data in table will always be the same,
* thus the query result could be predicted and verified.
*/
@BeforeClass
public static void setupTableIndexes() throws Exception {
Properties overrideProps = new Properties();
overrideProps.setProperty("format-maprdb.json.useNumRegionsForDistribution", "true");
updateTestCluster(1, DrillConfig.create(overrideProps));
MaprDBTestsSuite.setupTests();
MaprDBTestsSuite.createPluginAndGetConf(getDrillbitContext());
test(incrnonCoveringSelectivityThreshold);
System.out.print("setupTableIndexes begins");
Admin admin = MaprDBTestsSuite.getAdmin();
if (admin != null) {
if (admin.tableExists(PRIMARY_TABLE_NAME)) {
admin.deleteTable(PRIMARY_TABLE_NAME);
}
}
LargeTableGen gen = new LargeTableGen(MaprDBTestsSuite.getAdmin());
/**
* indexDef is an array of string, LargeTableGen.generateTableWithIndex will take it as parameter to generate indexes
* for primary table.
* indexDef[3*i] defines i-th index's indexName, NOTE: IF the name begins with "hash", it is a hash index
* indexDef[3*i+1] indexed field,
* and indexDef[3*i+2] defines i-th index's non-indexed fields
*/
final String[] indexDef = { "i_ssn", "id.ssn", "contact.phone", // mainly for composite key test
"i_state_city", // mainly for composite key test
"address.state,address.city", // mainly for composite key test
"name.fname,name.lname", "i_age", "personal.age", "", "i_age_desc", "personal.age:desc", "", "i_income", "personal.income", "", "i_lic", "driverlicense", "reverseid", "i_state_city_dl", "address.state,address.city", "driverlicense", "i_cast_int_ssn", "$CAST(id.ssn@INT)", "contact.phone", "i_cast_vchar_lic", "$CAST(driverlicense@STRING)", "contact.email", "i_state_age_phone", "address.state,personal.age,contact.phone", "name.fname", "i_cast_age_income_phone", "$CAST(personal.age@INT),$CAST(personal.income@INT),contact.phone", "name.fname", "i_age_with_fname", "personal.age", "name.fname", "i_rowid_cast_date_birthdate", "rowid", "$CAST(personal.birthdate@DATE)", "hash_i_reverseid", "reverseid", "", "hash_i_cast_timestamp_firstlogin", "$CAST(activity.irs.firstlogin@TIMESTAMP)", "id.ssn" };
gen.generateTableWithIndex(PRIMARY_TABLE_NAME, PRIMARY_TABLE_SIZE, indexDef);
}
use of com.mapr.db.Admin in project drill by apache.
the class IndexPlanTest method cleanupTableIndexes.
@AfterClass
public static void cleanupTableIndexes() throws Exception {
Admin admin = MaprDBTestsSuite.getAdmin();
if (admin != null) {
if (admin.tableExists(PRIMARY_TABLE_NAME)) {
// admin.deleteTable(PRIMARY_TABLE_NAME);
}
}
test(defaultnonCoveringSelectivityThreshold);
}
use of com.mapr.db.Admin in project drill by apache.
the class MapRDBIndexDiscover method admin.
@SuppressWarnings("deprecation")
private Admin admin() {
assert getOriginalScan() instanceof MapRDBGroupScan;
final MapRDBGroupScan dbGroupScan = (MapRDBGroupScan) getOriginalScan();
final UserGroupInformation currentUser = ImpersonationUtil.createProxyUgi(dbGroupScan.getUserName());
final Configuration conf = dbGroupScan.getFormatPlugin().getFsConf();
final Admin admin;
try {
admin = currentUser.doAs((PrivilegedExceptionAction<Admin>) () -> MapRDB.getAdmin(conf));
} catch (Exception e) {
throw new DrillRuntimeException("Failed to get Admin instance for user: " + currentUser.getUserName(), e);
}
return admin;
}
Aggregations