Search in sources :

Example 6 with StorageInfo

use of com.netflix.metacat.common.server.connectors.model.StorageInfo in project metacat by Netflix.

the class S3ConnectorInfoConverter method toStorageInfo.

/**
     * Converts from s3 table info to storage info.
     * @param table table info
     * @return table info
     */
StorageInfo toStorageInfo(final Table table) {
    StorageInfo result = null;
    final Location location = table.getLocation();
    if (location != null) {
        final Map<String, String> infoParameters = Maps.newHashMap();
        result = new StorageInfo();
        result.setUri(location.getUri());
        final Info info = location.getInfo();
        if (info != null) {
            result.setOwner(info.getOwner());
            result.setInputFormat(info.getInputFormat());
            result.setOutputFormat(info.getOutputFormat());
            result.setSerializationLib(info.getSerializationLib());
            if (info.getParameters() != null) {
                infoParameters.putAll(info.getParameters());
            }
        }
        result.setSerdeInfoParameters(infoParameters);
        result.setParameters(Maps.newHashMap());
    }
    return result;
}
Also used : StorageInfo(com.netflix.metacat.common.server.connectors.model.StorageInfo) AuditInfo(com.netflix.metacat.common.server.connectors.model.AuditInfo) DatabaseInfo(com.netflix.metacat.common.server.connectors.model.DatabaseInfo) FieldInfo(com.netflix.metacat.common.server.connectors.model.FieldInfo) PartitionInfo(com.netflix.metacat.common.server.connectors.model.PartitionInfo) StorageInfo(com.netflix.metacat.common.server.connectors.model.StorageInfo) Info(com.netflix.metacat.connector.s3.model.Info) TableInfo(com.netflix.metacat.common.server.connectors.model.TableInfo) Location(com.netflix.metacat.connector.s3.model.Location)

Example 7 with StorageInfo

use of com.netflix.metacat.common.server.connectors.model.StorageInfo in project metacat by Netflix.

the class S3ConnectorInfoConverter method fromStorageInfo.

/**
     * Converts from storage info to s3 location.
     * @param storageInfo storage info
     * @return location
     */
Location fromStorageInfo(final StorageInfo storageInfo) {
    final Location result = new Location();
    if (storageInfo != null) {
        result.setUri(storageInfo.getUri());
        final Info info = new Info();
        info.setLocation(result);
        info.setOwner(storageInfo.getOwner());
        info.setInputFormat(storageInfo.getInputFormat());
        info.setOutputFormat(storageInfo.getOutputFormat());
        info.setSerializationLib(storageInfo.getSerializationLib());
        final Map<String, String> parameters = Maps.newHashMap();
        if (storageInfo.getParameters() != null) {
            parameters.putAll(storageInfo.getParameters());
        }
        if (storageInfo.getSerdeInfoParameters() != null) {
            parameters.putAll(storageInfo.getSerdeInfoParameters());
        }
        info.setParameters(parameters);
        result.setInfo(info);
    }
    return result;
}
Also used : AuditInfo(com.netflix.metacat.common.server.connectors.model.AuditInfo) DatabaseInfo(com.netflix.metacat.common.server.connectors.model.DatabaseInfo) FieldInfo(com.netflix.metacat.common.server.connectors.model.FieldInfo) PartitionInfo(com.netflix.metacat.common.server.connectors.model.PartitionInfo) StorageInfo(com.netflix.metacat.common.server.connectors.model.StorageInfo) Info(com.netflix.metacat.connector.s3.model.Info) TableInfo(com.netflix.metacat.common.server.connectors.model.TableInfo) Location(com.netflix.metacat.connector.s3.model.Location)

Aggregations

StorageInfo (com.netflix.metacat.common.server.connectors.model.StorageInfo)7 AuditInfo (com.netflix.metacat.common.server.connectors.model.AuditInfo)6 FieldInfo (com.netflix.metacat.common.server.connectors.model.FieldInfo)4 QualifiedName (com.netflix.metacat.common.QualifiedName)3 PartitionInfo (com.netflix.metacat.common.server.connectors.model.PartitionInfo)3 DatabaseInfo (com.netflix.metacat.common.server.connectors.model.DatabaseInfo)2 TableInfo (com.netflix.metacat.common.server.connectors.model.TableInfo)2 Info (com.netflix.metacat.connector.s3.model.Info)2 Location (com.netflix.metacat.connector.s3.model.Location)2 FieldSchema (org.apache.hadoop.hive.metastore.api.FieldSchema)2 StorageDescriptor (org.apache.hadoop.hive.metastore.api.StorageDescriptor)2 Functions (com.google.common.base.Functions)1 Joiner (com.google.common.base.Joiner)1 Strings (com.google.common.base.Strings)1 Throwables (com.google.common.base.Throwables)1 ImmutableList (com.google.common.collect.ImmutableList)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1