use of com.netflix.metacat.connector.s3.model.Partition in project metacat by Netflix.
the class S3ConnectorPartitionService method get.
@Override
public PartitionInfo get(@Nonnull final ConnectorContext context, @Nonnull final QualifiedName name) {
final QualifiedName tableName = QualifiedName.ofTable(catalogName, name.getDatabaseName(), name.getTableName());
final Table table = getTable(tableName);
final List<Partition> partitions = partitionDao.getPartitions(table.getId(), Lists.newArrayList(name.getPartitionName()), null, null, null, null);
if (partitions.isEmpty()) {
throw new PartitionNotFoundException(tableName, name.getPartitionName());
}
log.debug("Get partition for table {}", tableName);
return infoConverter.toPartitionInfo(tableName, table, partitions.get(0));
}
use of com.netflix.metacat.connector.s3.model.Partition in project metacat by Netflix.
the class S3ConnectorPartitionService method create.
@Override
public void create(@Nonnull final ConnectorContext context, @Nonnull final PartitionInfo partitionInfo) {
final QualifiedName name = partitionInfo.getName();
log.debug("Start: Create partition {}", name);
final QualifiedName tableName = QualifiedName.ofTable(catalogName, name.getDatabaseName(), name.getTableName());
// Table
final Table table = getTable(tableName);
final List<Partition> partitions = partitionDao.getPartitions(table.getId(), Lists.newArrayList(name.getPartitionName()), null, null, null, null);
if (!partitions.isEmpty()) {
throw new PartitionAlreadyExistsException(tableName, name.getPartitionName());
}
partitionDao.save(infoConverter.toPartition(table, partitionInfo));
log.debug("End: Create partition {}", name);
}
Aggregations