public Catalog build() throws MetaException { if (name == null) throw new MetaException("You must name the catalog"); if (location == null) throw new MetaException("You must give the catalog a location"); Catalog catalog = new Catalog(name, location); if (description != null) catalog.setDescription(description); return catalog; }
@VisibleForTesting public static void createDefaultCatalog(RawStore ms, Warehouse wh) throws MetaException, InvalidOperationException { try { Catalog defaultCat = ms.getCatalog(DEFAULT_CATALOG_NAME); // Null check because in some test cases we get a null from ms.getCatalog. if (defaultCat !=null && defaultCat.getLocationUri().equals("TBD")) { // One time update issue. When the new 'hive' catalog is created in an upgrade the // script does not know the location of the warehouse. So we need to update it. LOG.info("Setting location of default catalog, as it hasn't been done after upgrade"); defaultCat.setLocationUri(wh.getWhRoot().toString()); ms.alterCatalog(defaultCat.getName(), defaultCat); } } catch (NoSuchObjectException e) { Catalog cat = new Catalog(DEFAULT_CATALOG_NAME, wh.getWhRoot().toString()); long time = System.currentTimeMillis() / 1000; cat.setCreateTime((int) time); cat.setDescription(Warehouse.DEFAULT_CATALOG_COMMENT); ms.createCatalog(cat); } }
private Catalog mCatToCat(MCatalog mCat) { Catalog cat = new Catalog(mCat.getName(), mCat.getLocationUri()); if (mCat.getDescription() != null) { cat.setDescription(mCat.getDescription()); } cat.setCreateTime(mCat.getCreateTime()); return cat; }
unsetDescription(); } else { setDescription((String)value);
newCat.setDescription(newDescription); client.alterCatalog(catNames[1], newCat); fetchedNewCat = client.getCatalog(catNames[1]);
public Catalog build() throws MetaException { if (name == null) throw new MetaException("You must name the catalog"); if (location == null) throw new MetaException("You must give the catalog a location"); Catalog catalog = new Catalog(name, location); if (description != null) catalog.setDescription(description); return catalog; }
@VisibleForTesting public static void createDefaultCatalog(RawStore ms, Warehouse wh) throws MetaException, InvalidOperationException { try { Catalog defaultCat = ms.getCatalog(DEFAULT_CATALOG_NAME); // Null check because in some test cases we get a null from ms.getCatalog. if (defaultCat !=null && defaultCat.getLocationUri().equals("TBD")) { // One time update issue. When the new 'hive' catalog is created in an upgrade the // script does not know the location of the warehouse. So we need to update it. LOG.info("Setting location of default catalog, as it hasn't been done after upgrade"); defaultCat.setLocationUri(wh.getWhRoot().toString()); ms.alterCatalog(defaultCat.getName(), defaultCat); } } catch (NoSuchObjectException e) { Catalog cat = new Catalog(DEFAULT_CATALOG_NAME, wh.getWhRoot().toString()); cat.setDescription(Warehouse.DEFAULT_CATALOG_COMMENT); ms.createCatalog(cat); } }
private Catalog mCatToCat(MCatalog mCat) { Catalog cat = new Catalog(mCat.getName(), mCat.getLocationUri()); if (mCat.getDescription() != null) { cat.setDescription(mCat.getDescription()); } return cat; }