Example usage for com.amazonaws.services.glue.model StorageDescriptor getOutputFormat

List of usage examples for com.amazonaws.services.glue.model StorageDescriptor getOutputFormat

Introduction

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

Prototype


public String getOutputFormat() 

Source Link

Document

The output format: SequenceFileOutputFormat (binary), or IgnoreKeyTextOutputFormat, or a custom format.

Usage

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

License:Apache License

private static void setStorageBuilder(StorageDescriptor sd, Storage.Builder storageBuilder) {
    requireNonNull(sd.getSerdeInfo(), "StorageDescriptor SerDeInfo is null");
    SerDeInfo serdeInfo = sd.getSerdeInfo();

    Optional<HiveBucketProperty> bucketProperty = Optional.empty();
    if (sd.getNumberOfBuckets() > 0) {
        if (isNullOrEmpty(sd.getBucketColumns())) {
            throw new PrestoException(HIVE_INVALID_METADATA,
                    "Table/partition metadata has 'numBuckets' set, but 'bucketCols' is not set");
        }//from w  ww .j a  va2  s  . c om
        List<SortingColumn> sortedBy = ImmutableList.of();
        if (!isNullOrEmpty(sd.getSortColumns())) {
            sortedBy = sd.getSortColumns().stream()
                    .map(column -> new SortingColumn(column.getColumn(),
                            Order.fromMetastoreApiOrder(column.getSortOrder(), "unknown")))
                    .collect(toImmutableList());
        }
        bucketProperty = Optional
                .of(new HiveBucketProperty(sd.getBucketColumns(), sd.getNumberOfBuckets(), sortedBy));
    }

    storageBuilder
            .setStorageFormat(StorageFormat.createNullable(serdeInfo.getSerializationLibrary(),
                    sd.getInputFormat(), sd.getOutputFormat()))
            .setLocation(nullToEmpty(sd.getLocation())).setBucketProperty(bucketProperty)
            .setSkewed(sd.getSkewedInfo() != null && !isNullOrEmpty(sd.getSkewedInfo().getSkewedColumnNames()))
            .setSerdeParameters(firstNonNull(serdeInfo.getParameters(), ImmutableMap.of())).build();
}