mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 17:40:28 +08:00
optimize buffer allocated logic
This commit is contained in:
parent
fd42a23b68
commit
f9391a78e7
@ -106,7 +106,7 @@ public class DorisStreamLoadVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (DorisWriterOptions.StreamLoadFormat.JSON.equals(writerOptions.getStreamLoadFormat())) {
|
if (DorisWriterOptions.StreamLoadFormat.JSON.equals(writerOptions.getStreamLoadFormat())) {
|
||||||
ByteBuffer bos = ByteBuffer.allocate(totalBytes + rows.size() + 1);
|
ByteBuffer bos = ByteBuffer.allocate(totalBytes + (rows.isEmpty() ? 2 : rows.size() + 1));
|
||||||
bos.put("[".getBytes(StandardCharsets.UTF_8));
|
bos.put("[".getBytes(StandardCharsets.UTF_8));
|
||||||
byte[] jsonDelimiter = ",".getBytes(StandardCharsets.UTF_8);
|
byte[] jsonDelimiter = ",".getBytes(StandardCharsets.UTF_8);
|
||||||
boolean isFirstElement = true;
|
boolean isFirstElement = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user