Search in sources :

Example 11 with MStorageDescriptor

use of org.apache.hadoop.hive.metastore.model.MStorageDescriptor in project hive by apache.

the class ObjectStore method convertToStorageDescriptor.

private StorageDescriptor convertToStorageDescriptor(MStorageDescriptor msd, boolean noFS, boolean isAcidTable) throws MetaException {
    if (msd == null) {
        return null;
    }
    List<MFieldSchema> mFieldSchemas = msd.getCD() == null ? null : msd.getCD().getCols();
    List<Order> orderList = (isAcidTable) ? Collections.emptyList() : convertToOrders(msd.getSortCols());
    List<String> bucList = convertList(msd.getBucketCols());
    SkewedInfo skewedInfo = null;
    Map<String, String> sdParams = isAcidTable ? Collections.emptyMap() : convertMap(msd.getParameters());
    StorageDescriptor sd = new StorageDescriptor(noFS ? null : convertToFieldSchemas(mFieldSchemas), msd.getLocation(), msd.getInputFormat(), msd.getOutputFormat(), msd.isCompressed(), msd.getNumBuckets(), (!isAcidTable) ? convertToSerDeInfo(msd.getSerDeInfo(), true) : new SerDeInfo(msd.getSerDeInfo().getName(), msd.getSerDeInfo().getSerializationLib(), Collections.emptyMap()), bucList, orderList, sdParams);
    if (!isAcidTable) {
        skewedInfo = new SkewedInfo(convertList(msd.getSkewedColNames()), convertToSkewedValues(msd.getSkewedColValues()), covertToSkewedMap(msd.getSkewedColValueLocationMaps()));
    } else {
        skewedInfo = new SkewedInfo(Collections.emptyList(), Collections.emptyList(), Collections.emptyMap());
    }
    sd.setSkewedInfo(skewedInfo);
    sd.setStoredAsSubDirectories(msd.isStoredAsSubDirectories());
    return sd;
}
Also used : Order(org.apache.hadoop.hive.metastore.api.Order) MOrder(org.apache.hadoop.hive.metastore.model.MOrder) SkewedInfo(org.apache.hadoop.hive.metastore.api.SkewedInfo) MFieldSchema(org.apache.hadoop.hive.metastore.model.MFieldSchema) MSerDeInfo(org.apache.hadoop.hive.metastore.model.MSerDeInfo) SerDeInfo(org.apache.hadoop.hive.metastore.api.SerDeInfo) StorageDescriptor(org.apache.hadoop.hive.metastore.api.StorageDescriptor) MStorageDescriptor(org.apache.hadoop.hive.metastore.model.MStorageDescriptor)

Aggregations

MStorageDescriptor (org.apache.hadoop.hive.metastore.model.MStorageDescriptor)11 Query (javax.jdo.Query)5 InvalidObjectException (org.apache.hadoop.hive.metastore.api.InvalidObjectException)5 ScheduledQuery (org.apache.hadoop.hive.metastore.api.ScheduledQuery)4 MColumnDescriptor (org.apache.hadoop.hive.metastore.model.MColumnDescriptor)4 MScheduledQuery (org.apache.hadoop.hive.metastore.model.MScheduledQuery)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 ValidReaderWriteIdList (org.apache.hadoop.hive.common.ValidReaderWriteIdList)3 ValidWriteIdList (org.apache.hadoop.hive.common.ValidWriteIdList)3 ReplicationMetricList (org.apache.hadoop.hive.metastore.api.ReplicationMetricList)3 MPartition (org.apache.hadoop.hive.metastore.model.MPartition)3 MStringList (org.apache.hadoop.hive.metastore.model.MStringList)3 MTable (org.apache.hadoop.hive.metastore.model.MTable)3 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)2 StorageDescriptor (org.apache.hadoop.hive.metastore.api.StorageDescriptor)2 URI (java.net.URI)1 HashSet (java.util.HashSet)1