@Test public void testParquetInputSerialization() { RequestContext context = getRequestContext("s3:parquet"); context.setFormat("parquet"); InputSerialization inputSerialization = new S3SelectAccessor().getInputSerialization(context); assertNotNull(inputSerialization.getParquet()); assertNull(inputSerialization.getJson()); assertNull(inputSerialization.getCsv()); }
InputSerialization getInputSerialization(RequestContext context) { InputSerialization inputSerialization = new InputSerialization(); 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; }
S3SelectAccessor extends BasePlugin implements Accessor { InputSerialization getInputSerialization(RequestContext context) { InputSerialization inputSerialization = new InputSerialization(); 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; } }
S3SelectAccessor extends BasePlugin implements Accessor { InputSerialization getInputSerialization(RequestContext context) { InputSerialization inputSerialization = new InputSerialization(); 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; }  }
S3SelectAccessor extends BasePlugin implements Accessor { InputSerialization getInputSerialization(RequestContext context) { InputSerialization inputSerialization = new InputSerialization(); 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; }  @Override void initialize(RequestContext requestContext); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override void closeForRead(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow onerow); @Override void closeForWrite(); }
S3SelectAccessor extends BasePlugin implements Accessor { InputSerialization getInputSerialization(RequestContext context) { InputSerialization inputSerialization = new InputSerialization(); 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; }  @Override void initialize(RequestContext requestContext); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override void closeForRead(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow onerow); @Override void closeForWrite(); static final String COMPRESSION_TYPE; static final String FILE_HEADER_INFO; static final String FILE_HEADER_INFO_NONE; static final String FILE_HEADER_INFO_IGNORE; static final String FILE_HEADER_INFO_USE; static final String JSON_TYPE; }