Java Code Examples for org.apache.hadoop.hive.conf.HiveConf#addResource()
The following examples show how to use
org.apache.hadoop.hive.conf.HiveConf#addResource() .
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: HiveMetaStore.java From streamx with Apache License 2.0 | 6 votes |
public HiveMetaStore(Configuration conf, HdfsSinkConnectorConfig connectorConfig) throws HiveMetaStoreException { HiveConf hiveConf = new HiveConf(conf, HiveConf.class); String hiveConfDir = connectorConfig.getString(HdfsSinkConnectorConfig.HIVE_CONF_DIR_CONFIG); String hiveMetaStoreURIs = connectorConfig.getString(HdfsSinkConnectorConfig.HIVE_METASTORE_URIS_CONFIG); if (hiveMetaStoreURIs.isEmpty()) { log.warn("hive.metastore.uris empty, an embedded Hive metastore will be " + "created in the directory the connector is started. " + "You need to start Hive in that specific directory to query the data."); } if (!hiveConfDir.equals("")) { String hiveSitePath = hiveConfDir + "/hive-site.xml"; File hiveSite = new File(hiveSitePath); if (!hiveSite.exists()) { log.warn("hive-site.xml does not exist in provided Hive configuration directory {}.", hiveConf); } hiveConf.addResource(new Path(hiveSitePath)); } hiveConf.set("hive.metastore.uris", hiveMetaStoreURIs); try { client = HCatUtil.getHiveMetastoreClient(hiveConf); } catch (IOException | MetaException e) { throw new HiveMetaStoreException(e); } }
Example 2
Source File: HiveConfigurator.java From localization_nifi with Apache License 2.0 | 5 votes |
public HiveConf getConfigurationFromFiles(final String configFiles) { final HiveConf hiveConfig = new HiveConf(); if (StringUtils.isNotBlank(configFiles)) { for (final String configFile : configFiles.split(",")) { hiveConfig.addResource(new Path(configFile.trim())); } } return hiveConfig; }
Example 3
Source File: HiveClientWrapper.java From pxf with Apache License 2.0 | 5 votes |
/** * Initializes HiveConf configuration object from request configuration. Since hive-site.xml * is not available on classpath due to multi-server support, it is added explicitly based * on location for a given PXF configuration server * * @param configuration request configuration * @return instance of HiveConf object */ private HiveConf getHiveConf(Configuration configuration) { // prepare hiveConf object and explicitly add this request's hive-site.xml file to it HiveConf hiveConf = new HiveConf(configuration, HiveConf.class); String hiveSiteUrl = configuration.get(String.format("%s.%s", PXF_CONFIG_RESOURCE_PATH_PROPERTY, "hive-site.xml")); if (hiveSiteUrl != null) { try { hiveConf.addResource(new URL(hiveSiteUrl)); } catch (MalformedURLException e) { throw new RuntimeException(String.format("Failed to add %s to hive configuration", hiveSiteUrl), e); } } return hiveConf; }
Example 4
Source File: HiveExec.java From streamx with Apache License 2.0 | 5 votes |
/** * HiveExec constructor * @param config HDFS Connector configuration */ public HiveExec(HdfsSinkConnectorConfig config) { hiveConf = new HiveConf(); String hiveConfDir = config.getString(HdfsSinkConnectorConfig.HIVE_CONF_DIR_CONFIG); hiveConf.addResource(new Path(hiveConfDir, "hive-site.xml")); SessionState.start(new CliSessionState(hiveConf)); cliDriver = new CliDriver(); }
Example 5
Source File: HiveSyncTool.java From hudi with Apache License 2.0 | 5 votes |
public static void main(String[] args) { // parse the params final HiveSyncConfig cfg = new HiveSyncConfig(); JCommander cmd = new JCommander(cfg, null, args); if (cfg.help || args.length == 0) { cmd.usage(); System.exit(1); } FileSystem fs = FSUtils.getFs(cfg.basePath, new Configuration()); HiveConf hiveConf = new HiveConf(); hiveConf.addResource(fs.getConf()); new HiveSyncTool(cfg, hiveConf, fs).syncHoodieTable(); }
Example 6
Source File: UtilitiesTestBase.java From hudi with Apache License 2.0 | 5 votes |
/** * Initialize Hive DB. * * @throws IOException */ private static void clearHiveDb() throws IOException { HiveConf hiveConf = new HiveConf(); // Create Dummy hive sync config HiveSyncConfig hiveSyncConfig = getHiveSyncConfig("/dummy", "dummy"); hiveConf.addResource(hiveServer.getHiveConf()); HoodieTableMetaClient.initTableType(dfs.getConf(), hiveSyncConfig.basePath, HoodieTableType.COPY_ON_WRITE, hiveSyncConfig.tableName, null); HoodieHiveClient client = new HoodieHiveClient(hiveSyncConfig, hiveConf, dfs); client.updateHiveSQL("drop database if exists " + hiveSyncConfig.databaseName); client.updateHiveSQL("create database " + hiveSyncConfig.databaseName); client.close(); }
Example 7
Source File: HiveLiteralRewriterTest.java From incubator-atlas with Apache License 2.0 | 5 votes |
@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"); }
Example 8
Source File: HiveConfigurator.java From nifi with Apache License 2.0 | 5 votes |
public HiveConf getConfigurationFromFiles(final String configFiles) { final HiveConf hiveConfig = new HiveConf(); if (StringUtils.isNotBlank(configFiles)) { for (final String configFile : configFiles.split(",")) { hiveConfig.addResource(new Path(configFile.trim())); } } return hiveConfig; }
Example 9
Source File: HiveConfigurator.java From nifi with Apache License 2.0 | 5 votes |
public HiveConf getConfigurationFromFiles(final String configFiles) { final HiveConf hiveConfig = new HiveConf(); if (StringUtils.isNotBlank(configFiles)) { for (final String configFile : configFiles.split(",")) { hiveConfig.addResource(new Path(configFile.trim())); } } return hiveConfig; }
Example 10
Source File: HiveConfigurator.java From nifi with Apache License 2.0 | 5 votes |
public HiveConf getConfigurationFromFiles(final String configFiles) { final HiveConf hiveConfig = new HiveConf(); if (StringUtils.isNotBlank(configFiles)) { for (final String configFile : configFiles.split(",")) { hiveConfig.addResource(new Path(configFile.trim())); } } return hiveConfig; }