Java Code Examples for org.apache.hadoop.io.SequenceFile.CompressionType#valueOf()

The following examples show how to use org.apache.hadoop.io.SequenceFile.CompressionType#valueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SequenceFileAccessor.java    From pxf with Apache License 2.0 6 votes vote down vote up
/**
 * Compression: based on compression codec and compression type (default
 * value RECORD). If there is no codec, compression type is ignored, and
 * NONE is used.
 *
 * @param context - container where compression codec and type are held
 */
private void getCompressionCodec(RequestContext context) {

    String userCompressCodec = context.getOption("COMPRESSION_CODEC");
    String userCompressType = context.getOption("COMPRESSION_TYPE");
    String parsedCompressType = parseCompressionType(userCompressType);

    compressionType = CompressionType.NONE;
    codec = null;
    if (userCompressCodec != null) {
        codec = codecFactory.getCodec(userCompressCodec, configuration);

        try {
            compressionType = CompressionType.valueOf(parsedCompressType);
        } catch (IllegalArgumentException e) {
            throw new IllegalArgumentException(
                    String.format("Illegal value for compression type '%s'", parsedCompressType));
        }
        LOG.debug("Compression ON: compression codec: {}, compression type: {}",
                userCompressCodec, compressionType);
    }
}
 
Example 2
Source File: SequenceFileOutputFormat.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param conf the {@link JobConf}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobConf conf) {
  String val = conf.get(org.apache.hadoop.mapreduce.lib.output.
    FileOutputFormat.COMPRESS_TYPE, CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}
 
Example 3
Source File: SequenceFileOutputFormat.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param job the {@link Job}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobContext job) {
  String val = job.getConfiguration().get(FileOutputFormat.COMPRESS_TYPE, 
                                          CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}
 
Example 4
Source File: SequenceFileOutputFormat.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param conf the {@link JobConf}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobConf conf) {
  String val = conf.get(org.apache.hadoop.mapreduce.lib.output.
    FileOutputFormat.COMPRESS_TYPE, CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}
 
Example 5
Source File: SequenceFileOutputFormat.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param job the {@link Job}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobContext job) {
  String val = job.getConfiguration().get(FileOutputFormat.COMPRESS_TYPE, 
                                          CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}
 
Example 6
Source File: SequenceFileOutputFormat.java    From RDFS with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param conf the {@link JobConf}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobConf conf) {
  String val = conf.get("mapred.output.compression.type", 
                        CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}
 
Example 7
Source File: SequenceFileOutputFormat.java    From RDFS with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param job the {@link Job}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobContext job) {
  String val = job.getConfiguration().get("mapred.output.compression.type", 
                                          CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}
 
Example 8
Source File: SequenceFileOutputFormat.java    From hadoop-gpu with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param conf the {@link JobConf}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobConf conf) {
  String val = conf.get("mapred.output.compression.type", 
                        CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}
 
Example 9
Source File: SequenceFileOutputFormat.java    From hadoop-gpu with Apache License 2.0 2 votes vote down vote up
/**
 * Get the {@link CompressionType} for the output {@link SequenceFile}.
 * @param job the {@link Job}
 * @return the {@link CompressionType} for the output {@link SequenceFile}, 
 *         defaulting to {@link CompressionType#RECORD}
 */
public static CompressionType getOutputCompressionType(JobContext job) {
  String val = job.getConfiguration().get("mapred.output.compression.type", 
                                          CompressionType.RECORD.toString());
  return CompressionType.valueOf(val);
}