use of org.apache.hadoop.hive.ql.session.SessionState in project hive by apache.
the class SetProcessor method dumpOptions.
private void dumpOptions(Properties p) {
SessionState ss = SessionState.get();
SortedMap<String, String> sortedMap = new TreeMap<String, String>();
sortedMap.put("silent", (ss.getIsSilent() ? "on" : "off"));
for (Object one : p.keySet()) {
String oneProp = (String) one;
String oneValue = p.getProperty(oneProp);
if (ss.getConf().isHiddenConfig(oneProp)) {
continue;
}
sortedMap.put(oneProp, oneValue);
}
// Inserting hive variables
for (String s : ss.getHiveVariables().keySet()) {
sortedMap.put(HIVEVAR_PREFIX + s, ss.getHiveVariables().get(s));
}
for (Map.Entry<String, String> entries : sortedMap.entrySet()) {
ss.out.println(entries.getKey() + "=" + entries.getValue());
}
for (Map.Entry<String, String> entry : mapToSortedMap(System.getenv()).entrySet()) {
if (isHidden(entry.getKey())) {
continue;
}
ss.out.println(ENV_PREFIX + entry.getKey() + "=" + entry.getValue());
}
for (Map.Entry<String, String> entry : propertiesToSortedMap(System.getProperties()).entrySet()) {
if (isHidden(entry.getKey())) {
continue;
}
ss.out.println(SYSTEM_PREFIX + entry.getKey() + "=" + entry.getValue());
}
}
use of org.apache.hadoop.hive.ql.session.SessionState in project hive by apache.
the class ThriftCLIService method getProgressedPercentage.
private double getProgressedPercentage(OperationHandle opHandle) throws HiveSQLException {
checkArgument(OperationType.EXECUTE_STATEMENT.equals(opHandle.getOperationType()));
Operation operation = cliService.getSessionManager().getOperationManager().getOperation(opHandle);
SessionState state = operation.getParentSession().getSessionState();
ProgressMonitor monitor = state.getProgressMonitor();
return monitor == null ? 0.0 : monitor.progressedPercentage();
}
use of org.apache.hadoop.hive.ql.session.SessionState in project incubator-atlas by apache.
the class HiveITBase method setUp.
@BeforeClass
public void setUp() throws Exception {
//Set-up hive session
conf = new HiveConf();
conf.setClassLoader(Thread.currentThread().getContextClassLoader());
driver = new Driver(conf);
ss = new SessionState(conf);
ss = SessionState.start(ss);
SessionState.setCurrentSessionState(ss);
Configuration configuration = ApplicationProperties.get();
String[] atlasEndPoint = configuration.getStringArray(HiveMetaStoreBridge.ATLAS_ENDPOINT);
if (atlasEndPoint == null || atlasEndPoint.length == 0) {
atlasEndPoint = new String[] { DGI_URL };
}
if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) {
atlasClient = new AtlasClient(atlasEndPoint, new String[] { "admin", "admin" });
} else {
atlasClient = new AtlasClient(atlasEndPoint);
}
hiveMetaStoreBridge = new HiveMetaStoreBridge(configuration, conf, atlasClient);
HiveConf conf = new HiveConf();
conf.set("hive.exec.post.hooks", "");
SessionState ss = new SessionState(conf);
ss = SessionState.start(ss);
SessionState.setCurrentSessionState(ss);
driverWithoutContext = new Driver(conf);
}
use of org.apache.hadoop.hive.ql.session.SessionState in project incubator-atlas by apache.
the class HiveLiteralRewriterTest method setup.
@BeforeClass(enabled = false)
public void setup() {
conf = new HiveConf();
conf.addResource("/hive-site.xml");
SessionState ss = new SessionState(conf, "testuser");
SessionState.start(ss);
conf.set("hive.lock.manager", "org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager");
}
use of org.apache.hadoop.hive.ql.session.SessionState in project drill by apache.
the class TestStorageBasedHiveAuthorization method generateTestData.
private static void generateTestData() throws Exception {
// Generate Hive test tables
final SessionState ss = new SessionState(hiveConf);
SessionState.start(ss);
final Driver driver = new Driver(hiveConf);
executeQuery(driver, "CREATE DATABASE " + db_general);
createTable(driver, db_general, g_student_u0_700, studentDef, studentData, org1Users[0], org1Groups[0], (short) 0700);
createTable(driver, db_general, g_student_u0g0_750, studentDef, studentData, org1Users[0], org1Groups[0], (short) 0750);
createTable(driver, db_general, g_student_all_755, studentDef, studentData, org1Users[2], org1Groups[2], (short) 0755);
createTable(driver, db_general, g_voter_u1_700, voterDef, voterData, org1Users[1], org1Groups[1], (short) 0700);
createTable(driver, db_general, g_voter_u2g1_750, voterDef, voterData, org1Users[2], org1Groups[1], (short) 0750);
createTable(driver, db_general, g_voter_all_755, voterDef, voterData, org1Users[1], org1Groups[1], (short) 0755);
createPartitionedTable(driver, db_general, g_partitioned_student_u0_700, partitionStudentDef, "INSERT OVERWRITE TABLE %s.%s PARTITION(age) SELECT rownum, name, age, gpa, studentnum FROM %s.%s", g_student_all_755, org1Users[0], org1Groups[0], (short) 0700);
changeDBPermissions(db_general, (short) 0755, org1Users[0], org1Groups[0]);
executeQuery(driver, "CREATE DATABASE " + db_u1g1_only);
createTable(driver, db_u1g1_only, u1g1_student_all_755, studentDef, studentData, org1Users[1], org1Groups[1], (short) 0755);
createTable(driver, db_u1g1_only, u1g1_student_u1_700, studentDef, studentData, org1Users[1], org1Groups[1], (short) 0700);
createTable(driver, db_u1g1_only, u1g1_voter_all_755, voterDef, voterData, org1Users[1], org1Groups[1], (short) 0755);
createTable(driver, db_u1g1_only, u1g1_voter_u1_700, voterDef, voterData, org1Users[1], org1Groups[1], (short) 0700);
changeDBPermissions(db_u1g1_only, (short) 0750, org1Users[1], org1Groups[1]);
executeQuery(driver, "CREATE DATABASE " + db_u0_only);
createTable(driver, db_u0_only, u0_student_all_755, studentDef, studentData, org1Users[0], org1Groups[0], (short) 0755);
createTable(driver, db_u0_only, u0_voter_all_755, voterDef, voterData, org1Users[0], org1Groups[0], (short) 0755);
changeDBPermissions(db_u0_only, (short) 0700, org1Users[0], org1Groups[0]);
createView(org1Users[0], org1Groups[0], v_student_u0g0_750, String.format("SELECT rownum, name, age, studentnum FROM %s.%s.%s", hivePluginName, db_general, g_student_u0_700));
createView(org1Users[1], org1Groups[1], v_student_u1g1_750, String.format("SELECT rownum, name, age FROM %s.%s.%s", MINIDFS_STORAGE_PLUGIN_NAME, "tmp", v_student_u0g0_750));
createView(org1Users[0], org1Groups[0], v_partitioned_student_u0g0_750, String.format("SELECT rownum, name, age, studentnum FROM %s.%s.%s", hivePluginName, db_general, g_partitioned_student_u0_700));
createView(org1Users[1], org1Groups[1], v_partitioned_student_u1g1_750, String.format("SELECT rownum, name, age FROM %s.%s.%s", MINIDFS_STORAGE_PLUGIN_NAME, "tmp", v_partitioned_student_u0g0_750));
}
Aggregations