List of usage examples for com.amazonaws.services.glue.model PartitionInput setParameters
public void setParameters(java.util.Map<String, String> parameters)
These key-value pairs define partition parameters.
From source file:com.facebook.presto.hive.metastore.glue.converter.GlueInputConverter.java
License:Apache License
public static PartitionInput convertPartition(PartitionWithStatistics partitionWithStatistics) { PartitionInput input = convertPartition(partitionWithStatistics.getPartition()); PartitionStatistics statistics = partitionWithStatistics.getStatistics(); if (!statistics.getColumnStatistics().isEmpty()) { throw new PrestoException(NOT_SUPPORTED, "Glue metastore does not support column level statistics"); }// w w w . j a v a 2 s .c o m input.setParameters(updateStatisticsParameters(input.getParameters(), statistics.getBasicStatistics())); return input; }
From source file:com.facebook.presto.hive.metastore.glue.converter.GlueInputConverter.java
License:Apache License
public static PartitionInput convertPartition(Partition partition) { PartitionInput input = new PartitionInput(); input.setValues(partition.getValues()); input.setStorageDescriptor(convertStorage(partition.getStorage(), partition.getColumns())); input.setParameters(partition.getParameters()); return input; }
From source file:com.facebook.presto.hive.metastore.glue.GlueHiveMetastore.java
License:Apache License
@Override public void updatePartitionStatistics(String databaseName, String tableName, String partitionName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName); if (currentStatistics == null) { throw new PrestoException(HIVE_PARTITION_DROPPED_DURING_QUERY, "Statistics result does not contain entry for partition: " + partitionName); }// w ww .j a v a 2s .c om PartitionStatistics updatedStatistics = update.apply(currentStatistics); if (!updatedStatistics.getColumnStatistics().isEmpty()) { throw new PrestoException(NOT_SUPPORTED, "Glue metastore does not support column level statistics"); } List<String> partitionValues = toPartitionValues(partitionName); Partition partition = getPartition(databaseName, tableName, partitionValues) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); try { PartitionInput partitionInput = GlueInputConverter.convertPartition(partition); partitionInput.setParameters( updateStatisticsParameters(partition.getParameters(), updatedStatistics.getBasicStatistics())); glueClient.updatePartition( new UpdatePartitionRequest().withDatabaseName(databaseName).withTableName(tableName) .withPartitionValueList(partition.getValues()).withPartitionInput(partitionInput)); } catch (EntityNotFoundException e) { throw new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }