public static ColumnMapping get(String columnSpec, ColumnEncoding defaultEncoding,
      String columnName, TypeInfo columnType) {
    Preconditions.checkNotNull(columnSpec);
    Preconditions.checkNotNull(columnName);
    Preconditions.checkNotNull(columnType);
    ColumnEncoding encoding = defaultEncoding;

    // Check for column encoding specification
    if (ColumnEncoding.hasColumnEncoding(columnSpec)) {
      String columnEncodingStr = ColumnEncoding.getColumnEncoding(columnSpec);
      columnSpec = ColumnEncoding.stripCode(columnSpec);

      if (AccumuloHiveConstants.ROWID.equalsIgnoreCase(columnSpec)) {
        return new HiveAccumuloRowIdColumnMapping(columnSpec,
            ColumnEncoding.get(columnEncodingStr), columnName, columnType.getTypeName());
      } else {
        Entry<String,String> pair = parseMapping(columnSpec);

        if (isPrefix(pair.getValue())) {
          // Sanity check that, for a map, we got 2 encodings
          if (!ColumnEncoding.isMapEncoding(columnEncodingStr)) {
            throw new IllegalArgumentException("Expected map encoding for a map specification, "
                + columnSpec + " with encoding " + columnEncodingStr);
          }

          Entry<ColumnEncoding,ColumnEncoding> encodings = ColumnEncoding
              .getMapEncoding(columnEncodingStr);

          return new HiveAccumuloMapColumnMapping(pair.getKey(), pair.getValue(),
              encodings.getKey(), encodings.getValue(), columnName, columnType.getTypeName());
        } else {
          return new HiveAccumuloColumnMapping(pair.getKey(), pair.getValue(),
              ColumnEncoding.getFromMapping(columnEncodingStr), columnName, columnType.getTypeName());
        }
      }
    } else {
      if (AccumuloHiveConstants.ROWID.equalsIgnoreCase(columnSpec)) {
        return new HiveAccumuloRowIdColumnMapping(columnSpec, defaultEncoding, columnName,
            columnType.getTypeName());
      } else {
        Entry<String,String> pair = parseMapping(columnSpec);
        boolean isPrefix = isPrefix(pair.getValue());

        String cq = pair.getValue();

        // Replace any \* that appear in the prefix with a regular *
        if (-1 != cq.indexOf(AccumuloHiveConstants.ESCAPED_ASTERISK)) {
          cq = cq.replaceAll(AccumuloHiveConstants.ESCAPED_ASTERISK_REGEX,
              Character.toString(AccumuloHiveConstants.ASTERISK));
        }

        if (isPrefix) {
          return new HiveAccumuloMapColumnMapping(pair.getKey(), cq.substring(0, cq.length() - 1),
              defaultEncoding, defaultEncoding, columnName, columnType.getTypeName());
        } else {
          return new HiveAccumuloColumnMapping(pair.getKey(), cq, encoding, columnName, columnType.getTypeName());
        }
      }
    }
  }
Generate the proper instance of a ColumnMapping

@param columnSpec
         Specification for mapping this column to Accumulo
@param defaultEncoding
         The default encoding in which values should be encoded to Accumulo
accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/columns/ColumnMappingFactory.java