You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2024/09/19 11:59:59 UTC
(doris) branch branch-2.0 updated: [Bug](branch-20) fix udf return array_string type has error in branch-20 (#41004)
This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 25fdd854519 [Bug](branch-20) fix udf return array_string type has error in branch-20 (#41004)
25fdd854519 is described below
commit 25fdd854519e0f6c4354ddbd584c56ef0c96a567
Author: zhangstar333 <87...@users.noreply.github.com>
AuthorDate: Thu Sep 19 19:59:51 2024 +0800
[Bug](branch-20) fix udf return array_string type has error in branch-20 (#41004)
when return type is array_string, the nested column string offset is
should be cumulative, start with offset[row-1]
instead of equal to 0
this bug only in branch-2.0
---
.../src/main/java/org/apache/doris/udf/UdfConvert.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfConvert.java b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfConvert.java
index 7b3a151f006..aefaf511fb1 100644
--- a/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfConvert.java
+++ b/fe/be-java-extensions/java-udf/src/main/java/org/apache/doris/udf/UdfConvert.java
@@ -1292,7 +1292,8 @@ public class UdfConvert {
int num = data.size();
int[] offsets = new int[num];
byte[][] byteRes = new byte[num][];
- int offset = 0;
+ int oldOffsetNum = UdfUtils.UNSAFE.getInt(null, strOffsetAddr + ((hasPutElementNum - 1) * 4L));
+ int offset = oldOffsetNum;
for (int i = 0; i < num; ++i) {
String value = data.get(i);
if (value == null) {
@@ -1304,23 +1305,22 @@ public class UdfConvert {
offset += byteRes[i].length;
offsets[i] = offset;
}
- int oldOffsetNum = UdfUtils.UNSAFE.getInt(null, strOffsetAddr + ((hasPutElementNum - 1) * 4L));
int oldSzie = 0;
if (num > 0) {
oldSzie = offsets[num - 1];
}
byte[] bytes = new byte[oldSzie];
- long bytesAddr = JNINativeMethod.resizeStringColumn(dataAddr, oldOffsetNum + oldSzie);
+ long bytesAddr = JNINativeMethod.resizeStringColumn(dataAddr, oldSzie);
int dst = 0;
for (int i = 0; i < num; i++) {
for (int j = 0; j < byteRes[i].length; j++) {
bytes[dst++] = byteRes[i][j];
}
}
- UdfUtils.copyMemory(offsets, UdfUtils.INT_ARRAY_OFFSET, null, strOffsetAddr + (4L * oldOffsetNum),
+ UdfUtils.copyMemory(offsets, UdfUtils.INT_ARRAY_OFFSET, null, strOffsetAddr + (4L * hasPutElementNum),
num * 4L);
UdfUtils.copyMemory(bytes, UdfUtils.BYTE_ARRAY_OFFSET, null, bytesAddr + oldOffsetNum,
- oldSzie);
+ oldSzie - oldOffsetNum);
hasPutElementNum = hasPutElementNum + num;
}
UdfUtils.UNSAFE.putLong(null, offsetsAddr + 8L * row, hasPutElementNum);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org