private TableDto getTableDto(final String dbName, final String tblName) { final String databaseName = normalizeIdentifier(dbName); final String tableName = normalizeIdentifier(tblName); return v1.getTable(catalogName, databaseName, tableName, true, false, false); }
private TableDto getTableDto(final String dbName, final String tblName) { final String databaseName = normalizeIdentifier(dbName); final String tableName = normalizeIdentifier(tblName); return v1.getTable(catalogName, databaseName, tableName, true, false, false); }
/** * {@inheritDoc} */ @Override public void alter_partitions(final String dbName, final String tblName, final List<Partition> newParts) throws TException { final String databaseName = normalizeIdentifier(dbName); final String tableName = normalizeIdentifier(tblName); requestWrapper("add_partition", new Object[]{databaseName, tableName}, () -> { addPartitionsCore(dbName, tableName, newParts, false); return null; }); }
/** * {@inheritDoc} */ @Override public void alter_partitions(final String dbName, final String tblName, final List<Partition> newParts) throws TException { final String databaseName = normalizeIdentifier(dbName); final String tableName = normalizeIdentifier(tblName); requestWrapper("add_partition", new Object[]{databaseName, tableName}, () -> { addPartitionsCore(dbName, tableName, newParts, false); return null; }); }
/** * {@inheritDoc} */ @Override public List<Table> get_table_objects_by_name(final String dbname, final List<String> tblNames) throws TException { return requestWrapper("get_table_objects_by_name", new Object[]{dbname, tblNames}, () -> { final String databaseName = normalizeIdentifier(dbname); return tblNames.stream() .map(CatalogThriftHiveMetastore::normalizeIdentifier) .map(name -> v1.getTable(catalogName, databaseName, name, true, true, true)) .map(this.hiveConverters::metacatToHiveTable) .collect(Collectors.toList()); }); }
/** * {@inheritDoc} */ @Override public Table get_table(final String dbname, final String tblName) throws TException { return requestWrapper("get_table", new Object[]{dbname, tblName}, () -> { final String databaseName = normalizeIdentifier(dbname); final String tableName = normalizeIdentifier(tblName); final TableDto dto = v1.getTable(catalogName, databaseName, tableName, true, true, true); return hiveConverters.metacatToHiveTable(dto); }); }
/** * {@inheritDoc} */ @Override public List<Table> get_table_objects_by_name(final String dbname, final List<String> tblNames) throws TException { return requestWrapper("get_table_objects_by_name", new Object[]{dbname, tblNames}, () -> { final String databaseName = normalizeIdentifier(dbname); return tblNames.stream() .map(CatalogThriftHiveMetastore::normalizeIdentifier) .map(name -> v1.getTable(catalogName, databaseName, name, true, true, true)) .map(this.hiveConverters::metacatToHiveTable) .collect(Collectors.toList()); }); }
/** * {@inheritDoc} */ @Override public Table get_table(final String dbname, final String tblName) throws TException { return requestWrapper("get_table", new Object[]{dbname, tblName}, () -> { final String databaseName = normalizeIdentifier(dbname); final String tableName = normalizeIdentifier(tblName); final TableDto dto = v1.getTable(catalogName, databaseName, tableName, true, true, true); return hiveConverters.metacatToHiveTable(dto); }); }
/** * {@inheritDoc} */ @Override public List<String> get_partition_names(final String dbName, final String tblName, final short maxParts) throws TException { final String databaseName = normalizeIdentifier(dbName); final String tableName = normalizeIdentifier(tblName); final Integer maxValues = maxParts > 0 ? Short.toUnsignedInt(maxParts) : null; return requestWrapper("get_partition_names", new Object[]{databaseName, tableName, maxParts}, () -> partV1 .getPartitionKeys(catalogName, databaseName, tableName, null, null, null, null, maxValues)); }
/** * {@inheritDoc} */ @Override public List<String> get_partition_names(final String dbName, final String tblName, final short maxParts) throws TException { final String databaseName = normalizeIdentifier(dbName); final String tableName = normalizeIdentifier(tblName); final Integer maxValues = maxParts > 0 ? Short.toUnsignedInt(maxParts) : null; return requestWrapper("get_partition_names", new Object[]{databaseName, tableName, maxParts}, () -> partV1 .getPartitionKeys(catalogName, databaseName, tableName, null, null, null, null, maxValues)); }
/** * {@inheritDoc} */ @Override public Partition add_partition_with_environment_context( final Partition newPart, @Nullable final EnvironmentContext ec ) throws TException { final String dbName = normalizeIdentifier(newPart.getDbName()); final String tableName = normalizeIdentifier(newPart.getTableName()); return requestWrapper("add_partition_with_environment_context", new Object[]{dbName, tableName, ec}, () -> { addPartitionsCore(dbName, tableName, ImmutableList.of(newPart), false); return newPart; }); }
private List<Partition> getPartitionsByFilter(final String dbName, final String tblName, @Nullable final String filter, final short maxParts) { final String databaseName = normalizeIdentifier(dbName); final String tableName = normalizeIdentifier(tblName); final TableDto tableDto = v1.getTable(catalogName, databaseName, tableName, true, false, false); final Integer maxValues = maxParts > 0 ? Short.toUnsignedInt(maxParts) : null; final GetPartitionsRequestDto dto = new GetPartitionsRequestDto(filter, null, true, false); final List<PartitionDto> metacatPartitions = partV1.getPartitionsForRequest(catalogName, dbName, tblName, null, null, null, maxValues, false, dto); final List<Partition> result = Lists.newArrayListWithCapacity(metacatPartitions.size()); for (PartitionDto partition : metacatPartitions) { result.add(hiveConverters.metacatToHivePartition(partition, tableDto)); } return result; }
/** * {@inheritDoc} */ @Override public Database get_database(final String name) throws TException { return requestWrapper("get_database", new Object[]{name}, () -> { final String databaseName = normalizeIdentifier(name); final DatabaseDto dto = v1.getDatabase(catalogName, databaseName, true, false); return hiveConverters.metacatToHiveDatabase(dto); }); }
/** * {@inheritDoc} */ @Override public List<String> get_all_tables(final String dbName) throws TException { final String databaseName = normalizeIdentifier(dbName); return requestWrapper("get_all_tables", new Object[]{dbName}, () -> v1.getDatabase(catalogName, databaseName, false, true).getTables()); }
/** * {@inheritDoc} */ @Override public List<String> get_all_tables(final String dbName) throws TException { final String databaseName = normalizeIdentifier(dbName); return requestWrapper("get_all_tables", new Object[]{dbName}, () -> v1.getDatabase(catalogName, databaseName, false, true).getTables()); }
/** * {@inheritDoc} */ @Override public Database get_database(final String name) throws TException { return requestWrapper("get_database", new Object[]{name}, () -> { final String databaseName = normalizeIdentifier(name); final DatabaseDto dto = v1.getDatabase(catalogName, databaseName, true, false); return hiveConverters.metacatToHiveDatabase(dto); }); }
/** * {@inheritDoc} */ @Override public AddPartitionsResult add_partitions_req(final AddPartitionsRequest request) throws TException { final String dbName = normalizeIdentifier(request.getDbName()); final String tableName = normalizeIdentifier(request.getTblName()); return requestWrapper("add_partition", new Object[]{dbName, tableName}, () -> { final List<Partition> partitions = addPartitionsCore(dbName, tableName, request.getParts(), request.isIfNotExists()); final AddPartitionsResult result = new AddPartitionsResult(); result.setPartitions(partitions); return result; }); }
/** * {@inheritDoc} */ @Override public void create_database(final Database database) throws TException { requestWrapper("create_database", new Object[]{database}, () -> { final String dbName = normalizeIdentifier(database.getName()); v1.createDatabase(catalogName, dbName, DatabaseCreateRequestDto.builder().metadata(database.getParameters()).build()); return null; }); }
/** * {@inheritDoc} */ @Override public void create_database(final Database database) throws TException { requestWrapper("create_database", new Object[]{database}, () -> { final String dbName = normalizeIdentifier(database.getName()); v1.createDatabase(catalogName, dbName, DatabaseCreateRequestDto.builder().metadata(database.getParameters()).build()); return null; }); }
/** * {@inheritDoc} */ @Override public void alter_database(final String dbname, final Database db) throws TException { requestWrapper("update_database", new Object[]{db}, () -> { if (dbname == null || db == null) { throw new InvalidInputException("Invalid database request"); } v1.updateDatabase(catalogName, normalizeIdentifier(dbname), DatabaseCreateRequestDto.builder().metadata(db.getParameters()).build()); return null; }); }