use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class SemanticAnalyzer method isPathReadOnly.
/**
* Checks if a given path has read-only access permissions.
*
* @param path The path to check for read-only permissions.
* @return True if the path is read-only; False otherwise.
* @throws HiveException If an error occurs while checking file permissions.
*/
private boolean isPathReadOnly(Path path) throws HiveException {
HiveConf conf = SessionState.get().getConf();
try {
FileSystem fs = path.getFileSystem(conf);
UserGroupInformation ugi = Utils.getUGI();
FileStatus status = fs.getFileStatus(path);
// We just check for writing permissions. If it fails with AccessControException, then it
// means the location may be read-only.
FileUtils.checkFileAccessWithImpersonation(fs, status, FsAction.WRITE, ugi.getUserName());
// Path has writing permissions
return false;
} catch (AccessControlException e) {
// but we take it as if our path is read-only
return true;
} catch (Exception e) {
throw new HiveException("Unable to determine if " + path + " is read only: " + e, e);
}
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestHBaseStoreCached method init.
@Before
public void init() throws IOException {
MockitoAnnotations.initMocks(this);
HiveConf conf = new HiveConf();
store = MockUtils.init(conf, htable, rows);
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class Task method cloneConf.
protected void cloneConf() {
if (!clonedConf) {
clonedConf = true;
conf = new HiveConf(conf);
}
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TezSessionPoolManager method reopenSession.
/** Reopens the session that was found to not be running. */
public void reopenSession(TezSessionState sessionState, HiveConf conf, String[] additionalFiles, boolean keepTmpDir) throws Exception {
HiveConf sessionConf = sessionState.getConf();
if (sessionConf != null && sessionConf.get(TezConfiguration.TEZ_QUEUE_NAME) != null) {
// user has explicitly specified queue name
conf.set(TezConfiguration.TEZ_QUEUE_NAME, sessionConf.get(TezConfiguration.TEZ_QUEUE_NAME));
} else {
// default queue name when the initial session was created
if (sessionState.getQueueName() != null) {
conf.set(TezConfiguration.TEZ_QUEUE_NAME, sessionState.getQueueName());
}
}
// TODO: close basically resets the object to a bunch of nulls.
// We should ideally not reuse the object because it's pointless and error-prone.
// Clean up stuff.
sessionState.close(keepTmpDir);
sessionState.open(conf, additionalFiles);
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TezSessionPoolManager method startInitialSession.
private void startInitialSession(TezSessionPoolSession sessionState) throws Exception {
// TODO Why is this configuration management not happening inside TezSessionPool.
HiveConf newConf = new HiveConf(initConf);
// Makes no senses for it to be mixed up like this.
boolean isUsable = sessionState.tryUse();
if (!isUsable)
throw new IOException(sessionState + " is not usable at pool startup");
newConf.set(TezConfiguration.TEZ_QUEUE_NAME, sessionState.getQueueName());
sessionState.open(newConf);
if (sessionState.returnAfterUse()) {
defaultQueuePool.put(sessionState);
}
}
Aggregations