fe/src/main/java/com/cloudera/impala/catalog/HdfsStorageDescriptor.java
/**
   * Constructs a new HdfsStorageDescriptor from a StorageDescriptor retrieved from the
   * metastore.
   *
   * @throws InvalidStorageDescriptorException - if the storage descriptor has invalid
   * delimiters, an unsupported SerDe, or an unknown file format.
   */
Constructs a new HdfsStorageDescriptor from a StorageDescriptor retrieved from the
metastore.

@throws InvalidStorageDescriptorException - if the storage descriptor has invalid
delimiters, an unsupported SerDe, or an unknown file format.
Constructs a new HdfsStorageDescriptor from a StorageDescriptor retrieved from the metastore . @throws InvalidStorageDescriptorException - if the storage descriptor has invalid delimiters an unsupported SerDe or an unknown file format .
public static HdfsStorageDescriptor fromStorageDescriptor(String tblName,
      StorageDescriptor sd)
      throws InvalidStorageDescriptorException {
    Map<String, Byte> delimMap = extractDelimiters(sd.getSerdeInfo());
    if (!COMPATIBLE_SERDES.contains(sd.getSerdeInfo().getSerializationLib())) {
      throw new InvalidStorageDescriptorException(String.format("Impala does not " +
          "support tables of this type. REASON: SerDe library '%s' is not " +
          "supported.", sd.getSerdeInfo().getSerializationLib()));
    }
    Map<String, String> parameters = sd.getSerdeInfo().getParameters();
    int blockSize = 0;
    String blockValue = parameters.get(BLOCK_SIZE);
    if (blockValue != null) {
      blockSize = Integer.parseInt(blockValue);
    }
    THdfsCompression compression = THdfsCompression.NONE;
    String compressionValue = parameters.get(COMPRESSION);
    if (compressionValue != null) {
      if (CatalogObjectsConstants.COMPRESSION_MAP.containsKey(compressionValue)) {
        compression = CatalogObjectsConstants.COMPRESSION_MAP.get(compressionValue);
      } else {
        LOG.warn("Unknown compression type: " + compressionValue);
      }
    }
    try {
      return new HdfsStorageDescriptor(tblName,
          HdfsFileFormat.fromJavaClassName(sd.getInputFormat()),
          delimMap.get(serdeConstants.LINE_DELIM),
          delimMap.get(serdeConstants.FIELD_DELIM),
          delimMap.get(serdeConstants.COLLECTION_DELIM),
          delimMap.get(serdeConstants.MAPKEY_DELIM),
          delimMap.get(serdeConstants.ESCAPE_CHAR),
          delimMap.get(serdeConstants.QUOTE_CHAR),
          blockSize, compression);
    } catch (IllegalArgumentException ex) {
      throw new InvalidStorageDescriptorException(ex);
    }
  }
public static HdfsStorageDescriptor fromStorageDescriptor ( String tblName , StorageDescriptor sd ) throws InvalidStorageDescriptorException { Map < String , Byte > delimMap = extractDelimiters ( sd . getSerdeInfo ( ) ) ; if ( ! COMPATIBLE_SERDES . contains ( sd . getSerdeInfo ( ) . getSerializationLib ( ) ) ) { throw new InvalidStorageDescriptorException ( String . format ( "Impala does not " + "support tables of this type. REASON: SerDe library '%s' is not " + "supported." , sd . getSerdeInfo ( ) . getSerializationLib ( ) ) ) ; } Map < String , String > parameters = sd . getSerdeInfo ( ) . getParameters ( ) ; int blockSize = 0 ; String blockValue = parameters . get ( BLOCK_SIZE ) ; if ( blockValue != null ) { blockSize = Integer . parseInt ( blockValue ) ; } THdfsCompression compression = THdfsCompression . NONE ; String compressionValue = parameters . get ( COMPRESSION ) ; if ( compressionValue != null ) { if ( CatalogObjectsConstants . COMPRESSION_MAP . containsKey ( compressionValue ) ) { compression = CatalogObjectsConstants . COMPRESSION_MAP . get ( compressionValue ) ; } else { LOG . warn ( "Unknown compression type: " + compressionValue ) ; } } try { return new HdfsStorageDescriptor ( tblName , HdfsFileFormat . fromJavaClassName ( sd . getInputFormat ( ) ) , delimMap . get ( serdeConstants . LINE_DELIM ) , delimMap . get ( serdeConstants . FIELD_DELIM ) , delimMap . get ( serdeConstants . COLLECTION_DELIM ) , delimMap . get ( serdeConstants . MAPKEY_DELIM ) , delimMap . get ( serdeConstants . ESCAPE_CHAR ) , delimMap . get ( serdeConstants . QUOTE_CHAR ) , blockSize , compression ) ; } catch ( IllegalArgumentException ex ) { throw new InvalidStorageDescriptorException ( ex ) ; } }
Constructs a new HdfsStorageDescriptor from a StorageDescriptor retrieved from the
 metastore.
Constructs a new HdfsStorageDescriptor from a StorageDescriptor retrieved from the metastore .
// Extract the blocksize and compression specification from the SerDe parameters, // if present. // Thrown by fromJavaClassName