You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "JNSimba (via GitHub)" <gi...@apache.org> on 2023/04/06 02:24:59 UTC

[GitHub] [doris-spark-connector] JNSimba commented on a diff in pull request #91: improve the sink format handle logic by factory pattern

JNSimba commented on code in PR #91:
URL: https://github.com/apache/doris-spark-connector/pull/91#discussion_r1159221392


##########
spark-doris-connector/src/main/java/org/apache/doris/spark/util/ListUtils.java:
##########
@@ -43,10 +43,11 @@ public static List<String> getSerializedList(List<Map<Object, Object>> batch) th
      * @throws JsonProcessingException
      */
     public static void divideAndSerialize(List<Map<Object, Object>> batch, List<String> result) throws JsonProcessingException {
-        String serializedResult = (new ObjectMapper()).writeValueAsString(batch);
+
         // if an error occurred in the batch call to getBytes ,average divide the batch
         try {
             //the "Requested array size exceeds VM limit" exception occurs when the collection is large
+            String serializedResult = (new ObjectMapper()).writeValueAsString(batch);

Review Comment:
   Would it be better to create `new ObjectMapper()` only once?



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org