@Override public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb) throws NoSuchObjectException, InvalidOperationException, MetaException, TException { dropDatabase(getDefaultCatalog(conf), name, deleteData, ignoreUnknownDb, false); }
@Override public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade) throws NoSuchObjectException, InvalidOperationException, MetaException, TException { dropDatabase(getDefaultCatalog(conf), name, deleteData, ignoreUnknownDb, cascade); }
@Override public List<Partition> dropPartitions(String dbName, String tblName, List<ObjectPair<Integer, byte[]>> partExprs, PartitionDropOptions options) throws TException { return dropPartitions(getDefaultCatalog(conf), dbName, tblName, partExprs, options); }
@Override public Partition getPartitionWithAuthInfo(String db_name, String tbl_name, List<String> part_vals, String user_name, List<String> group_names) throws TException { return getPartitionWithAuthInfo(getDefaultCatalog(conf), db_name, tbl_name, part_vals, user_name, group_names); }
@Override public List<String> listPartitionNames(String dbName, String tblName, short max) throws NoSuchObjectException, MetaException, TException { return listPartitionNames(getDefaultCatalog(conf), dbName, tblName, max); }
@Override public List<String> listPartitionNames(String db_name, String tbl_name, List<String> part_vals, short max_parts) throws TException { return listPartitionNames(getDefaultCatalog(conf), db_name, tbl_name, part_vals, max_parts); }
@Override public void alter_partition(String dbName, String tblName, Partition newPart) throws InvalidOperationException, MetaException, TException { alter_partition(getDefaultCatalog(conf), dbName, tblName, newPart, null); }
@Override public void alter_partitions(String dbName, String tblName, List<Partition> newParts, EnvironmentContext environmentContext, String writeIdList, long writeId) throws InvalidOperationException, MetaException, TException { alter_partitions(getDefaultCatalog(conf), dbName, tblName, newParts, environmentContext, writeIdList, writeId); }
@Override public List<ColumnStatisticsObj> getTableColumnStatistics(String dbName, String tableName, List<String> colNames, String validWriteIdList) throws TException { return getTableColumnStatistics(getDefaultCatalog(conf), dbName, tableName, colNames, validWriteIdList); }
@Override List<Partition> getPartitionsByNames(CompactionInfo ci) throws MetaException { try { return msc.getPartitionsByNames(getDefaultCatalog(conf), ci.dbname, ci.tableName, Collections.singletonList(ci.partName)); } catch (TException e) { LOG.error("Unable to get partitions by name for CompactionInfo=" + ci); throw new MetaException(e.toString()); } } }
@Override public void addForeignKey(List<SQLForeignKey> foreignKeyCols) throws TException { if (!foreignKeyCols.isEmpty() && !foreignKeyCols.get(0).isSetCatName()) { String defaultCat = getDefaultCatalog(conf); foreignKeyCols.forEach(fk -> fk.setCatName(defaultCat)); } client.add_foreign_key(new AddForeignKeyRequest(foreignKeyCols)); }
@Override public PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) throws MetaException, TException, NoSuchObjectException { if (!request.isSetCatName()) { request.setCatName(getDefaultCatalog(conf)); } String catName = request.isSetCatName() ? request.getCatName() : getDefaultCatalog(conf); String dbName = request.getDbName(); String tblName = request.getTblName(); checkDbAndTableFilters(catName, dbName, tblName); return client.get_partition_values(request); }
@Override public List<SQLDefaultConstraint> getDefaultConstraints(DefaultConstraintsRequest req) throws MetaException, NoSuchObjectException, TException { if (!req.isSetCatName()) { req.setCatName(getDefaultCatalog(conf)); } return client.get_default_constraints(req).getDefaultConstraints(); }
public List<SQLCheckConstraint> getCheckConstraintList(String dbName, String tblName) throws HiveException, NoSuchObjectException { try { return getMSC().getCheckConstraints(new CheckConstraintsRequest(getDefaultCatalog(conf), dbName, tblName)); } catch (NoSuchObjectException e) { throw e; } catch (Exception e) { throw new HiveException(e); } }
@Override public List<SQLCheckConstraint> getCheckConstraints(CheckConstraintsRequest req) throws MetaException, NoSuchObjectException, TException { if (!req.isSetCatName()) { req.setCatName(getDefaultCatalog(conf)); } return client.get_check_constraints(req).getCheckConstraints(); }
@Override public int add_partitions_pspec(PartitionSpecProxy partitionSpec) throws TException { if (partitionSpec == null) { throw new MetaException("PartitionSpec cannot be null."); } if (partitionSpec.getCatName() == null) { partitionSpec.setCatName(getDefaultCatalog(conf)); } return client.add_partitions_pspec(partitionSpec.toPartitionSpec()); }
/** {@inheritDoc} */ @Override public boolean updateTableColumnStatistics(ColumnStatistics statsObj) throws TException { if (!statsObj.getStatsDesc().isSetCatName()) { statsObj.getStatsDesc().setCatName(getDefaultCatalog(conf)); } // Note: currently this method doesn't set txn properties and thus won't work on txn tables. SetPartitionsStatsRequest req = new SetPartitionsStatsRequest(); req.addToColStats(statsObj); req.setNeedMerge(false); return client.update_table_column_statistics_req(req).isResult(); }
@Override public GetTableResult get_table_req(GetTableRequest req) throws MetaException, NoSuchObjectException { String catName = req.isSetCatName() ? req.getCatName() : getDefaultCatalog(conf); return new GetTableResult(getTableInternal(catName, req.getDbName(), req.getTblName(), req.getCapabilities(), req.getValidWriteIdList(), req.isGetColumnStats())); }
@Override public boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) throws TException { if (!statsObj.getStatsDesc().isSetCatName()) { statsObj.getStatsDesc().setCatName(getDefaultCatalog(conf)); } // Note: currently this method doesn't set txn properties and thus won't work on txn tables. SetPartitionsStatsRequest req = new SetPartitionsStatsRequest(); req.addToColStats(statsObj); req.setNeedMerge(false); return client.update_partition_column_statistics_req(req).isResult(); }
private MNotificationLog translateThriftToDb(NotificationEvent entry) { MNotificationLog dbEntry = new MNotificationLog(); dbEntry.setEventId(entry.getEventId()); dbEntry.setEventTime(entry.getEventTime()); dbEntry.setEventType(entry.getEventType()); dbEntry.setCatalogName(entry.isSetCatName() ? entry.getCatName() : getDefaultCatalog(conf)); dbEntry.setDbName(entry.getDbName()); dbEntry.setTableName(entry.getTableName()); dbEntry.setMessage(entry.getMessage()); dbEntry.setMessageFormat(entry.getMessageFormat()); return dbEntry; }