Example usage for com.amazonaws.services.glue.model TableInput setParameters

List of usage examples for com.amazonaws.services.glue.model TableInput setParameters

Introduction

In this page you can find the example usage for com.amazonaws.services.glue.model TableInput setParameters.

Prototype


public void setParameters(java.util.Map<String, String> parameters) 

Source Link

Document

These key-value pairs define properties associated with the table.

Usage

From source file:com.facebook.presto.hive.metastore.glue.converter.GlueInputConverter.java

License:Apache License

public static TableInput convertTable(Table table) {
    TableInput input = new TableInput();
    input.setName(table.getTableName());
    input.setOwner(table.getOwner());// w  ww.  j  av a2  s .  co m
    input.setTableType(table.getTableType());
    input.setStorageDescriptor(convertStorage(table.getStorage(), table.getDataColumns()));
    input.setPartitionKeys(
            table.getPartitionColumns().stream().map(GlueInputConverter::convertColumn).collect(toList()));
    input.setParameters(table.getParameters());
    table.getViewOriginalText().ifPresent(input::setViewOriginalText);
    table.getViewExpandedText().ifPresent(input::setViewExpandedText);
    return input;
}

From source file:com.facebook.presto.hive.metastore.glue.GlueHiveMetastore.java

License:Apache License

@Override
public void updateTableStatistics(String databaseName, String tableName,
        Function<PartitionStatistics, PartitionStatistics> update) {
    PartitionStatistics currentStatistics = getTableStatistics(databaseName, tableName);
    PartitionStatistics updatedStatistics = update.apply(currentStatistics);
    if (!updatedStatistics.getColumnStatistics().isEmpty()) {
        throw new PrestoException(NOT_SUPPORTED, "Glue metastore does not support column level statistics");
    }//  ww w.ja v  a  2s .  c  om

    Table table = getTableOrElseThrow(databaseName, tableName);

    try {
        TableInput tableInput = GlueInputConverter.convertTable(table);
        tableInput.setParameters(
                updateStatisticsParameters(table.getParameters(), updatedStatistics.getBasicStatistics()));
        glueClient.updateTable(
                new UpdateTableRequest().withDatabaseName(databaseName).withTableInput(tableInput));
    } catch (EntityNotFoundException e) {
        throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
    } catch (AmazonServiceException e) {
        throw new PrestoException(HIVE_METASTORE_ERROR, e);
    }
}