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;
}
Aggregations