fluozhiye commented on code in PR #180: URL: https://github.com/apache/doris-spark-connector/pull/180#discussion_r1458603610
########## spark-doris-connector/src/main/java/org/apache/doris/spark/load/DorisStreamLoad.java: ########## @@ -222,13 +226,34 @@ public long load(Iterator<InternalRow> rows, StructType schema) String loadUrlStr = String.format(loadUrlPattern, getBackend(), db, tbl); this.loadUrlStr = loadUrlStr; HttpPut httpPut = getHttpPut(label, loadUrlStr, enable2PC, schema); - RecordBatchInputStream recodeBatchInputStream = new RecordBatchInputStream(RecordBatch.newBuilder(rows) - .format(dataFormat) - .sep(FIELD_DELIMITER) - .delim(LINE_DELIMITER) - .schema(schema) - .addDoubleQuotes(addDoubleQuotes).build(), streamingPassthrough); - httpPut.setEntity(new InputStreamEntity(recodeBatchInputStream)); + + if(StringUtils.isNotEmpty(compressType)){ + if("gz".equals(compressType.toLowerCase())){ + if(dataFormat.equals(DataFormat.CSV)){ Review Comment: No problem。I have made an update。 ########## spark-doris-connector/src/main/java/org/apache/doris/spark/load/DorisStreamLoad.java: ########## @@ -505,4 +530,19 @@ private void handleStreamPassThrough() { } + /** + * compress data by gz compression algorithm + */ + private byte[] compressByGZ(String content) throws IOException{ + byte[] compressedData; + try(ByteArrayOutputStream baos = new ByteArrayOutputStream(); + GZIPOutputStream gzipOutputStream = new GZIPOutputStream(baos); + ){ + gzipOutputStream.write(content.getBytes("UTF-8")); + gzipOutputStream.finish(); + compressedData = baos.toByteArray(); + } + return compressedData; Review Comment: have submitted a unit test for the method -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org