use of com.facebook.presto.hive.metastore.glue.converter.GlueInputConverter in project presto by prestodb.
the class GlueHiveMetastore method addPartitions.
@Override
public void addPartitions(MetastoreContext metastoreContext, String databaseName, String tableName, List<PartitionWithStatistics> partitions) {
try {
List<Future<BatchCreatePartitionResult>> futures = new ArrayList<>();
for (List<PartitionWithStatistics> partitionBatch : Lists.partition(partitions, BATCH_CREATE_PARTITION_MAX_PAGE_SIZE)) {
List<PartitionInput> partitionInputs = mappedCopy(partitionBatch, GlueInputConverter::convertPartition);
futures.add(glueClient.batchCreatePartitionAsync(new BatchCreatePartitionRequest().withCatalogId(catalogId).withDatabaseName(databaseName).withTableName(tableName).withPartitionInputList(partitionInputs), stats.getBatchCreatePartitions().metricsAsyncHandler()));
}
for (Future<BatchCreatePartitionResult> future : futures) {
BatchCreatePartitionResult result = future.get();
propagatePartitionErrorToPrestoException(databaseName, tableName, result.getErrors());
}
} catch (AmazonServiceException | InterruptedException | ExecutionException e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
throw new PrestoException(HIVE_METASTORE_ERROR, e);
}
}
Aggregations