use of com.netflix.metacat.common.dto.TableDto in project metacat by Netflix.
the class CatalogThriftHiveMetastore method get_partitions_by_names.
/**
* {@inheritDoc}
*/
@Override
public List<Partition> get_partitions_by_names(final String dbName, final String tblName, final List<String> names) throws TException {
return requestWrapper("get_partitions_by_names", new Object[] { dbName, tblName, names }, () -> {
final String databaseName = normalizeIdentifier(dbName);
final String tableName = normalizeIdentifier(tblName);
final TableDto tableDto = v1.getTable(catalogName, databaseName, tableName, true, false, false);
final GetPartitionsRequestDto dto = new GetPartitionsRequestDto(null, names, true, false);
final List<PartitionDto> metacatPartitions = partV1.getPartitionsForRequest(catalogName, databaseName, tableName, null, null, null, null, false, dto);
final List<Partition> result = Lists.newArrayListWithCapacity(metacatPartitions.size());
for (PartitionDto partition : metacatPartitions) {
result.add(hiveConverters.metacatToHivePartition(partition, tableDto));
}
return result;
});
}
use of com.netflix.metacat.common.dto.TableDto in project metacat by Netflix.
the class CatalogThriftHiveMetastore method partition_values_to_partition_filter.
/**
* Converts the partial specification given by the part_vals to a Metacat filter statement.
*
* @param dbName the name of the database
* @param tblName the name of the table
* @param partVals the partial specification values
* @return A Meta
* cat filter expression suitable for selecting out the partitions matching the specification
* @throws MetaException if there are more part_vals specified than partition columns on the table.
*/
@SuppressWarnings("checkstyle:methodname")
String partition_values_to_partition_filter(final String dbName, final String tblName, final List<String> partVals) throws MetaException {
final String databaseName = normalizeIdentifier(dbName);
final String tableName = normalizeIdentifier(tblName);
final TableDto tableDto = v1.getTable(catalogName, databaseName, tableName, true, false, false);
return partition_values_to_partition_filter(tableDto, partVals);
}
use of com.netflix.metacat.common.dto.TableDto in project metacat by Netflix.
the class CatalogThriftHiveMetastore method get_partitions_ps.
/**
* {@inheritDoc}
*/
@Override
public List<Partition> get_partitions_ps(final String dbName, final String tblName, final List<String> partVals, final short maxParts) throws TException {
return requestWrapper("get_partitions_ps", new Object[] { dbName, tblName, partVals, maxParts }, () -> {
final String databaseName = normalizeIdentifier(dbName);
final String tableName = normalizeIdentifier(tblName);
final TableDto tableDto = v1.getTable(catalogName, databaseName, tableName, true, false, false);
final String partFilter = partition_values_to_partition_filter(tableDto, partVals);
final Integer maxValues = maxParts > 0 ? Short.toUnsignedInt(maxParts) : null;
final List<PartitionDto> metacatPartitions = partV1.getPartitions(catalogName, dbName, tblName, partFilter, null, null, null, maxValues, false);
final List<Partition> result = Lists.newArrayListWithCapacity(metacatPartitions.size());
for (PartitionDto partition : metacatPartitions) {
result.add(hiveConverters.metacatToHivePartition(partition, tableDto));
}
return result;
});
}
use of com.netflix.metacat.common.dto.TableDto in project metacat by Netflix.
the class CatalogThriftHiveMetastore method get_partition.
/**
* {@inheritDoc}
*/
@Override
public Partition get_partition(final String dbName, final String tblName, final List<String> partVals) throws TException {
return requestWrapper("get_partition", new Object[] { dbName, tblName, partVals }, () -> {
final TableDto tableDto = getTableDto(dbName, tblName);
final String partName = hiveConverters.getNameFromPartVals(tableDto, partVals);
return hiveConverters.metacatToHivePartition(getPartitionDtoByName(tableDto, partName), tableDto);
});
}
use of com.netflix.metacat.common.dto.TableDto in project metacat by Netflix.
the class CatalogThriftHiveMetastore method get_partitions.
/**
* {@inheritDoc}
*/
@Override
public List<Partition> get_partitions(final String dbName, final String tblName, final short maxParts) throws TException {
return requestWrapper("get_partitions", new Object[] { dbName, tblName, 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 List<PartitionDto> metacatPartitions = partV1.getPartitions(catalogName, dbName, tblName, null, null, null, null, maxValues, false);
final List<Partition> result = Lists.newArrayListWithCapacity(metacatPartitions.size());
for (PartitionDto partition : metacatPartitions) {
result.add(hiveConverters.metacatToHivePartition(partition, tableDto));
}
return result;
});
}
Aggregations