Java源码示例:com.amazonaws.services.s3.model.CompressionType
示例1
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;
}
示例2
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;
}
示例3
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);
}
示例4
/**
* 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;
}