Source:
<code>public SelectObjectContentRequest buildSelectObjectRequest(Properties schema, String query, Path path) { String fieldDelimiter = getFieldDelimiter(schema); String quoteChar = getQuoteChar(schema); String escapeChar = getEscapeChar(schema); SelectObjectContentRequest selectObjectRequest = new SelectObjectContentRequest(); <START> AmazonS3URI uri = new AmazonS3URI(path.toUri()); <END> selectObjectRequest.setBucketName(uri.getBucket()); selectObjectRequest.setKey(uri.getKey()); selectObjectRequest.setExpression(query); selectObjectRequest.setExpressionType(ExpressionType.SQL); CSVInput selectObjectCSVInputSerialization = new CSVInput(); selectObjectCSVInputSerialization.setRecordDelimiter(lineDelimiter); selectObjectCSVInputSerialization.setFieldDelimiter(fieldDelimiter); selectObjectCSVInputSerialization.setComments(COMMENTS_CHAR_STR); selectObjectCSVInputSerialization.setQuoteCharacter(quoteChar); selectObjectCSVInputSerialization.setQuoteEscapeCharacter(escapeChar); InputSerialization selectObjectInputSerialization = new InputSerialization(); if (path.getName().endsWith(CompressionCodecName.GZIP.getExtension())) { selectObjectInputSerialization.setCompressionType(CompressionType.GZIP); } selectObjectInputSerialization.setCsv(selectObjectCSVInputSerialization); selectObjectRequest.setInputSerialization(selectObjectInputSerialization); OutputSerialization selectObjectOutputSerialization = new OutputSerialization(); CSVOutput selectObjectCSVOutputSerialization = new CSVOutput(); selectObjectCSVOutputSerialization.setRecordDelimiter(lineDelimiter); selectObjectCSVOutputSerialization.setFieldDelimiter(fieldDelimiter); selectObjectCSVOutputSerialization.setQuoteCharacter(quoteChar); selectObjectCSVOutputSerialization.setQuoteEscapeCharacter(escapeChar); selectObjectOutputSerialization.setCsv(selectObjectCSVOutputSerialization); selectObjectRequest.setOutputSerialization(selectObjectOutputSerialization); return selectObjectRequest; }</code><technical_language>AmazonS3URI initialization fail endpoints "s3n://" currently supported</technical_language>

Target:
public SelectObjectContentRequest buildSelectObjectRequest(Properties schema, String query, Path path) { SelectObjectContentRequest selectObjectRequest = new SelectObjectContentRequest(); URI uri = path.toUri(); selectObjectRequest.setBucketName(PrestoS3FileSystem.getBucketName(uri)); selectObjectRequest.setKey(PrestoS3FileSystem.keyFromPath(path)); selectObjectRequest.setExpression(query); selectObjectRequest.setExpressionType(ExpressionType.SQL); String fieldDelimiter = getFieldDelimiter(schema); String quoteChar = schema.getProperty(QUOTE_CHAR, null); String escapeChar = schema.getProperty(ESCAPE_CHAR, null); CSVInput selectObjectCSVInputSerialization = new CSVInput(); selectObjectCSVInputSerialization.setRecordDelimiter(lineDelimiter); selectObjectCSVInputSerialization.setFieldDelimiter(fieldDelimiter); selectObjectCSVInputSerialization.setComments(COMMENTS_CHAR_STR); selectObjectCSVInputSerialization.setQuoteCharacter(quoteChar); selectObjectCSVInputSerialization.setQuoteEscapeCharacter(escapeChar); InputSerialization selectObjectInputSerialization = new InputSerialization(); if (path.getName().endsWith(GZIP.getExtension())) { selectObjectInputSerialization.setCompressionType(CompressionType.GZIP); } else if (path.getName().endsWith(BZIP2.getExtension())) { selectObjectInputSerialization.setCompressionType(CompressionType.BZIP2); } selectObjectInputSerialization.setCsv(selectObjectCSVInputSerialization); selectObjectRequest.setInputSerialization(selectObjectInputSerialization); OutputSerialization selectObjectOutputSerialization = new OutputSerialization(); CSVOutput selectObjectCSVOutputSerialization = new CSVOutput(); selectObjectCSVOutputSerialization.setRecordDelimiter(lineDelimiter); selectObjectCSVOutputSerialization.setFieldDelimiter(fieldDelimiter); selectObjectCSVOutputSerialization.setQuoteCharacter(quoteChar); selectObjectCSVOutputSerialization.setQuoteEscapeCharacter(escapeChar); selectObjectOutputSerialization.setCsv(selectObjectCSVOutputSerialization); selectObjectRequest.setOutputSerialization(selectObjectOutputSerialization); return selectObjectRequest; }