This is an automated email from the ASF dual-hosted git repository.

diwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-spark-connector.git


The following commit(s) were added to refs/heads/master by this push:
     new ad5d62f  [bug] byteBuffer calculate new capacity bug fix. (#142)
ad5d62f is described below

commit ad5d62ff9faf4e8f4694cb8832f9b51a3d4bf301
Author: Chuang Li <64473732+codecooke...@users.noreply.github.com>
AuthorDate: Fri Sep 15 17:59:04 2023 +0800

    [bug] byteBuffer calculate new capacity bug fix. (#142)
---
 .../org/apache/doris/spark/load/RecordBatchInputStream.java   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git 
a/spark-doris-connector/src/main/java/org/apache/doris/spark/load/RecordBatchInputStream.java
 
b/spark-doris-connector/src/main/java/org/apache/doris/spark/load/RecordBatchInputStream.java
index d705501..f70809b 100644
--- 
a/spark-doris-connector/src/main/java/org/apache/doris/spark/load/RecordBatchInputStream.java
+++ 
b/spark-doris-connector/src/main/java/org/apache/doris/spark/load/RecordBatchInputStream.java
@@ -170,14 +170,13 @@ public class RecordBatchInputStream extends InputStream {
      * @return new capacity
      */
     private int calculateNewCapacity(int capacity, int minCapacity) {
-        int newCapacity;
+        int newCapacity = 0;
         if (capacity == 0) {
             newCapacity = DEFAULT_BUF_SIZE;
-            while (newCapacity < minCapacity) {
-                newCapacity = newCapacity << 1;
-            }
-        } else {
-            newCapacity = capacity << 1;
+
+        }
+        while (newCapacity < minCapacity) {
+            newCapacity = newCapacity << 1;
         }
         return newCapacity;
     }


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

Reply via email to