@Override public IMetaStoreClient create() { try { return createMetaStoreClient(); } catch (MetaException e) { throw new RuntimeException("Unable to create " + IMetaStoreClient.class.getSimpleName(), e); } }
public HiveMetaStoreClientFactory(Optional<String> hcatURI) { this(getHiveConf(hcatURI)); }
/** * Constructor for {@link HiveMetastoreClientPool}. * @deprecated It is recommended to use the static {@link #get} method instead. Use this constructor only if you * different pool configurations are required. */ @Deprecated public HiveMetastoreClientPool(Properties properties, Optional<String> metastoreURI) { this.hiveRegProps = new HiveRegProps(new State(properties)); GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(this.hiveRegProps.getNumThreads()); config.setMaxIdle(this.hiveRegProps.getNumThreads()); this.factory = new HiveMetaStoreClientFactory(metastoreURI); this.pool = new GenericObjectPool<>(this.factory, config); this.hiveConf = this.factory.getHiveConf(); }
@Test public void testCreate() throws TException { HiveConf hiveConf = new HiveConf(); HiveMetaStoreClientFactory factory = new HiveMetaStoreClientFactory(hiveConf); // Since we havE a specified hive-site in the classpath, so have to null it out here to proceed the test // The original value it will get if no local hive-site is placed, will be an empty string. hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, ""); hiveConf.set(HIVE_METASTORE_TOKEN_SIGNATURE, ""); IMetaStoreClient msc = factory.create(); String dbName = "test_db"; String description = "test database"; String location = "file:/tmp/" + dbName; Database db = new Database(dbName, description, location, null); msc.dropDatabase(dbName, true, true); msc.createDatabase(db); db = msc.getDatabase(dbName); Assert.assertEquals(db.getName(), dbName); Assert.assertEquals(db.getDescription(), description); Assert.assertEquals(db.getLocationUri(), location); } }
/** * Constructor for {@link HiveMetastoreClientPool}. * @deprecated It is recommended to use the static {@link #get} method instead. Use this constructor only if you * different pool configurations are required. */ @Deprecated public HiveMetastoreClientPool(Properties properties, Optional<String> metastoreURI) { this.hiveRegProps = new HiveRegProps(new State(properties)); GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(this.hiveRegProps.getNumThreads()); config.setMaxIdle(this.hiveRegProps.getNumThreads()); this.factory = new HiveMetaStoreClientFactory(metastoreURI); this.pool = new GenericObjectPool<>(this.factory, config); this.hiveConf = this.factory.getHiveConf(); }
@Override public IMetaStoreClient create() { try { return createMetaStoreClient(); } catch (MetaException e) { throw new RuntimeException("Unable to create " + IMetaStoreClient.class.getSimpleName(), e); } }
public HiveMetaStoreClientFactory(Optional<String> hcatURI) { this(getHiveConf(hcatURI)); }