Tabnine Logo
org.apache.hive.hcatalog.common
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.hive.hcatalog.common

Best Java code snippets using org.apache.hive.hcatalog.common (Showing top 20 results out of 315)

origin: apache/hive

@Override
void initialize(Configuration conf) throws HCatException {
 this.config = conf;
 try {
  hiveConfig = HCatUtil.getHiveConf(config);
  hmsClient = HCatUtil.getHiveMetastoreClient(hiveConfig);
 } catch (MetaException exp) {
  throw new HCatException("MetaException while creating HMS client",
   exp);
 } catch (IOException exp) {
  throw new HCatException("IOException while creating HMS client",
   exp);
 }
}
origin: apache/hive

/**
 * Decrement the user count and piggyback this to set expiry flag as well, then  teardown(), if conditions are met.
 * This *MUST* be called by anyone who uses this client.
 */
@Override
public synchronized void close() {
 release();
 tearDownIfUnused();
}
origin: apache/hive

/**
 * Gets the error code.
 * @return the error code
 */
public int getErrorCode() {
 return errorType.getErrorCode();
}
origin: apache/hive

 @Override
 public String run() throws IOException, TException, InterruptedException  {
  final IMetaStoreClient client = HCatUtil.getHiveMetastoreClient(c);
  return ugi.doAs(new PrivilegedExceptionAction<String>() {
   @Override
   public String run() throws IOException, TException, InterruptedException {
    String u = ugi.getUserName();
    return client.getDelegationToken(c.getUser(),u);
   }
  });
 }
});
origin: apache/hive

/**
 * Gets the HCatOuputJobInfo object by reading the Configuration and deserializing
 * the string. If InputJobInfo is not present in the configuration, throws an
 * exception since that means HCatOutputFormat.setOutput has not been called.
 * @param conf the job Configuration object
 * @return the OutputJobInfo object
 * @throws IOException the IO exception
 */
public static OutputJobInfo getJobInfo(Configuration conf) throws IOException {
 String jobString = conf.get(HCatConstants.HCAT_KEY_OUTPUT_INFO);
 if (jobString == null) {
  throw new HCatException(ErrorType.ERROR_NOT_INITIALIZED);
 }
 return (OutputJobInfo) HCatUtil.deserialize(jobString);
}
origin: apache/hive

@Test
public void testCloseAllClients() throws IOException, MetaException, LoginException {
 final HiveClientCache cache = new HiveClientCache(1000);
 HiveClientCache.ICacheableMetaStoreClient client1 = (HiveClientCache.ICacheableMetaStoreClient) cache.get(hiveConf);
 hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, " "); // URIs are checked for string equivalence, even spaces make them different
 HiveClientCache.ICacheableMetaStoreClient client2 = (HiveClientCache.ICacheableMetaStoreClient) cache.get(hiveConf);
 cache.closeAllClientsQuietly();
 assertTrue(client1.isClosed());
 assertTrue(client2.isClosed());
}
origin: apache/hive

private static void assertTypeInCategory(Type type, Category category, String fieldName) throws HCatException {
 Category typeCategory = Category.fromType(type);
 if (typeCategory != category) {
  throw new HCatException("Type category mismatch. Expected " + category + " but type " + type + " in category " + typeCategory + " (field " + fieldName + ")");
 }
}
origin: apache/hive

@Override
public String toString() {
 return getMessage();
}
origin: apache/hive

public static LinkedList<InputJobInfo> getInputJobInfosFromConf(Configuration conf)
    throws IOException {
 LinkedList<InputJobInfo> inputJobInfos = (LinkedList<InputJobInfo>) HCatUtil.deserialize(
     conf.get(HCatConstants.HCAT_KEY_JOB_INFO));
 return inputJobInfos;
}
origin: apache/hive

/**
 * Is this a retriable error.
 * @return is it retriable
 */
public boolean isRetriable() {
 return errorType.isRetriable();
}
origin: apache/hive

/**
 * Instantiates a new hcat exception.
 * @param errorType the error type
 * @param extraMessage extra messages to add to the message string
 * @param cause the cause
 */
public HCatException(ErrorType errorType, String extraMessage, Throwable cause) {
 super(buildErrorMessage(
  errorType,
  extraMessage,
  cause), cause);
 this.errorType = errorType;
}
origin: apache/hive

public static HiveClientCacheKey fromHiveConf(HiveConf hiveConf, final int threadId) throws IOException, LoginException {
 return new HiveClientCacheKey(hiveConf, threadId);
}
origin: apache/hive

public static HiveStorageHandler getStorageHandler(Configuration conf, PartInfo partitionInfo) throws IOException {
 return HCatUtil.getStorageHandler(
  conf,
  partitionInfo.getStorageHandlerClassName(),
  partitionInfo.getSerdeClassName(),
  partitionInfo.getInputFormatClassName(),
  partitionInfo.getOutputFormatClassName());
}
origin: apache/hive

public static InputJobInfo getLastInputJobInfosFromConf(Configuration conf)
    throws IOException {
 LinkedList<InputJobInfo> inputJobInfos = getInputJobInfosFromConf(conf);
 if (inputJobInfos == null || inputJobInfos.isEmpty()) {
  return null;
 } else {
  return getInputJobInfosFromConf(conf).getLast();
 }
}
origin: apache/hive

static public Pair<String, String> getDBTableNames(String location) throws IOException {
 // the location string will be of the form:
 // <database name>.<table name> - parse it and
 // communicate the information to HCatInputFormat
 try {
  return HCatUtil.getDbAndTableName(location);
 } catch (IOException e) {
  String locationErrMsg = "The input location in load statement " +
   "should be of the form " +
   "<databasename>.<table name> or <table name>. Got " + location;
  throw new PigException(locationErrMsg, PIG_EXCEPTION_CODE);
 }
}
origin: apache/hive

private static Properties getHiveSiteOverrides(Configuration jobConf) {
 return getHiveSiteOverrides(getHiveSiteContentsFromClasspath(), jobConf);
}
origin: apache/hive

 @Override
 public void run() {
  cleanup();
 }
};
origin: apache/hive

@Test
public void testValidateMorePermissive() {
 assertConsistentFsPermissionBehaviour(FsAction.ALL, true, true, true, true, true, true, true, true);
 assertConsistentFsPermissionBehaviour(FsAction.READ, false, true, false, true, false, false, false, false);
 assertConsistentFsPermissionBehaviour(FsAction.WRITE, false, true, false, false, true, false, false, false);
 assertConsistentFsPermissionBehaviour(FsAction.EXECUTE, false, true, true, false, false, false, false, false);
 assertConsistentFsPermissionBehaviour(FsAction.READ_EXECUTE, false, true, true, true, false, true, false, false);
 assertConsistentFsPermissionBehaviour(FsAction.READ_WRITE, false, true, false, true, true, false, true, false);
 assertConsistentFsPermissionBehaviour(FsAction.WRITE_EXECUTE, false, true, true, false, true, false, false, true);
 assertConsistentFsPermissionBehaviour(FsAction.NONE, false, true, false, false, false, false, false, false);
}
origin: apache/hive

private static void assertTypeNotInCategory(Type type, Category category) throws HCatException {
 Category typeCategory = Category.fromType(type);
 if (typeCategory == category) {
  throw new HCatException("Type category mismatch. Expected type " + type + " not in category " + category + " but was so.");
 }
}
origin: apache/hive

/**
 * Setter for the "root" location of the HCatPartitionSpec.
 * @param location The new "root" location of the HCatPartitionSpec.
 * @throws HCatException On failure to set a new location.
 */
public void setRootLocation(String location) throws HCatException {
 try {
  partitionSpecProxy.setRootLocation(location);
 }
 catch (MetaException metaException) {
  throw new HCatException("Unable to set root-path!", metaException);
 }
}
org.apache.hive.hcatalog.common

Most used classes

  • HCatUtil
  • HCatException
    Class representing exceptions thrown by HCat.
  • HCatContext
    HCatContext is a singleton that provides global access to configuration data. HCatalog provides a va
  • ErrorType
    Enum type representing the various errors throws by HCat.
  • HiveClientCache$CacheableHiveMetaStoreClient
    Add # of current users on HiveMetaStoreClient, so that the client can be cleaned when no one is usin
  • HiveClientCache,
  • HiveClientCache$HiveClientCacheKey,
  • TestHCatUtil,
  • TestHiveClientCache$LocalMetaServer
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now