org.apache.hadoop.hive.ql.metadata.HiveStorageHandler Java Examples
The following examples show how to use
org.apache.hadoop.hive.ql.metadata.HiveStorageHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiveMetaStoreClientFactory.java From incubator-gobblin with Apache License 2.0 | 7 votes |
private IMetaStoreClient createMetaStoreClient() throws MetaException { HiveMetaHookLoader hookLoader = new HiveMetaHookLoader() { @Override public HiveMetaHook getHook(Table tbl) throws MetaException { if (tbl == null) { return null; } try { HiveStorageHandler storageHandler = HiveUtils.getStorageHandler(hiveConf, tbl.getParameters().get(META_TABLE_STORAGE)); return storageHandler == null ? null : storageHandler.getMetaHook(); } catch (HiveException e) { LOG.error(e.toString()); throw new MetaException("Failed to get storage handler: " + e); } } }; return RetryingMetaStoreClient.getProxy(hiveConf, hookLoader, HiveMetaStoreClient.class.getName()); }
Example #2
Source File: HiveUtilities.java From dremio-oss with Apache License 2.0 | 6 votes |
/** * Get {@link InputFormat} class name for given table and partition definitions. We try to get the InputFormat class name * from inputFormat if explicitly specified in inputFormat, else we get the InputFormat class name from storageHandlerName. * @param jobConf * @param inputFormat * @param storageHandlerName * @return InputFormat * @throws Exception */ public static final Class<? extends InputFormat<?, ?>> getInputFormatClass(final JobConf jobConf, Optional<String> inputFormat, Optional<String> storageHandlerName) throws Exception { if (inputFormat.isPresent()) { return (Class<? extends InputFormat<?, ?>>) Class.forName(inputFormat.get()); } if (storageHandlerName.isPresent()) { try (final ContextClassLoaderSwapper swapper = ContextClassLoaderSwapper.newInstance()) { // HiveUtils.getStorageHandler() depends on the current context classloader if you query and HBase table, // and don't have an HBase session open. final HiveStorageHandler storageHandler = HiveUtils.getStorageHandler(jobConf, storageHandlerName.get()); return (Class<? extends InputFormat<?, ?>>) storageHandler.getInputFormatClass(); } } throw new ExecutionSetupException("Unable to get Hive table InputFormat class. There is neither " + "InputFormat class explicitly specified nor a StorageHandler class provided."); }
Example #3
Source File: HiveUtilities.java From dremio-oss with Apache License 2.0 | 6 votes |
/** * Get {@link InputFormat} class name for given table and partition definitions. We try to get the InputFormat class name * from inputFormat if explicitly specified in inputFormat, else we get the InputFormat class name from storageHandlerName. * @param jobConf * @param inputFormat * @param storageHandlerName * @return InputFormat * @throws Exception */ public static final Class<? extends InputFormat<?, ?>> getInputFormatClass(final JobConf jobConf, Optional<String> inputFormat, Optional<String> storageHandlerName) throws Exception { if (inputFormat.isPresent()) { return (Class<? extends InputFormat<?, ?>>) Class.forName(inputFormat.get()); } if (storageHandlerName.isPresent()) { try (final ContextClassLoaderSwapper swapper = ContextClassLoaderSwapper.newInstance()) { // HiveUtils.getStorageHandler() depends on the current context classloader if you query and HBase table, // and don't have an HBase session open. final HiveStorageHandler storageHandler = HiveUtils.getStorageHandler(jobConf, storageHandlerName.get()); return (Class<? extends InputFormat<?, ?>>) storageHandler.getInputFormatClass(); } } throw new ExecutionSetupException("Unable to get Hive table InputFormat class. There is neither " + "InputFormat class explicitly specified nor a StorageHandler class provided."); }