com.amazonaws.services.s3.model.CompressionType Java Examples

The following examples show how to use com.amazonaws.services.s3.model.CompressionType. 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: S3QueryUtil.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static SelectObjectContentRequest generateBaseCSVRequest(String bucket, String key, String query) {
	SelectObjectContentRequest request = new SelectObjectContentRequest();
	request.setBucketName(bucket);
	request.setKey(key);
	request.setExpression(query);
	request.setExpressionType(ExpressionType.SQL);

	InputSerialization inputSerialization = new InputSerialization();
	inputSerialization.setCsv(new CSVInput());
	inputSerialization.setCompressionType(CompressionType.NONE);
	request.setInputSerialization(inputSerialization);

	OutputSerialization outputSerialization = new OutputSerialization();
	outputSerialization.setCsv(new CSVOutput());
	request.setOutputSerialization(outputSerialization);

	return request;
}
 
Example #2
Source File: S3QueryUtil.java    From flink with Apache License 2.0 6 votes vote down vote up
private static SelectObjectContentRequest generateBaseCSVRequest(String bucket, String key, String query) {
	SelectObjectContentRequest request = new SelectObjectContentRequest();
	request.setBucketName(bucket);
	request.setKey(key);
	request.setExpression(query);
	request.setExpressionType(ExpressionType.SQL);

	InputSerialization inputSerialization = new InputSerialization();
	inputSerialization.setCsv(new CSVInput());
	inputSerialization.setCompressionType(CompressionType.NONE);
	request.setInputSerialization(inputSerialization);

	OutputSerialization outputSerialization = new OutputSerialization();
	outputSerialization.setCsv(new CSVOutput());
	request.setOutputSerialization(outputSerialization);

	return request;
}
 
Example #3
Source File: S3SelectLineRecordReader.java    From presto with Apache License 2.0 5 votes vote down vote up
protected CompressionType getCompressionType(Path path)
{
    CompressionCodec codec = compressionCodecFactory.getCodec(path);
    if (codec == null) {
        return CompressionType.NONE;
    }
    if (codec instanceof GzipCodec) {
        return CompressionType.GZIP;
    }
    if (codec instanceof BZip2Codec) {
        return CompressionType.BZIP2;
    }
    throw new PrestoException(NOT_SUPPORTED, "Compression extension not supported for S3 Select: " + path);
}
 
Example #4
Source File: S3SelectAccessor.java    From pxf with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a {@link com.amazonaws.services.s3.model.InputSerialization}
 * object with parsed values from the request context.
 *
 * @param context the request context
 * @return a {@link InputSerialization} object
 */
InputSerialization getInputSerialization(RequestContext context) {
    InputSerialization inputSerialization = new InputSerialization();

    // We need to infer the format name from the profile (i.e. s3:parquet
    // would return parquet for the format)
    String format = context.inferFormatName();
    String compressionType = context.getOption(COMPRESSION_TYPE);

    LOG.debug("With format {}", format);
    if (StringUtils.equalsIgnoreCase(format, "parquet")) {
        inputSerialization.setParquet(new ParquetInput());
    } else if (StringUtils.equalsIgnoreCase(format, "json")) {
        inputSerialization.setJson(getJSONInput(context));
    } else {
        inputSerialization.setCsv(getCSVInput(context));
    }

    LOG.debug("With compression type {}", compressionType);
    if (StringUtils.equalsIgnoreCase(compressionType, "gzip")) {
        inputSerialization.setCompressionType(CompressionType.GZIP);
    } else if (StringUtils.equalsIgnoreCase(compressionType, "bzip2")) {
        inputSerialization.setCompressionType(CompressionType.BZIP2);
    } else {
        inputSerialization.setCompressionType(CompressionType.NONE);
    }

    return inputSerialization;
}