This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 99427d409d [vectorized](udaf) fix java-udaf case is unstable with
fuzzy mode #18146
99427d409d is described below
commit 99427d409d11b0abb9d2669a8092de59e791c844
Author: zhangstar333 <[email protected]>
AuthorDate: Tue Mar 28 09:30:49 2023 +0800
[vectorized](udaf) fix java-udaf case is unstable with fuzzy mode #18146
he udaf case is unstable reason:
when fuzzy enable_pipeline_engine=true, the case of agg function only 1
instance,
so not merge the default value, but if instance>1, will merge the default
value
---
.../javaudf_p0/test_javaudaf_my_date_datetime.out | 8 +++----
.../java/org/apache/doris/udf/MyHourDateTime.java | 26 ++++++++++++++++++----
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/regression-test/data/javaudf_p0/test_javaudaf_my_date_datetime.out
b/regression-test/data/javaudf_p0/test_javaudaf_my_date_datetime.out
index 64a31eece3..a888dd87e2 100644
--- a/regression-test/data/javaudf_p0/test_javaudaf_my_date_datetime.out
+++ b/regression-test/data/javaudf_p0/test_javaudaf_my_date_datetime.out
@@ -23,14 +23,14 @@
1 2022-01-09
-- !select5 --
-2022-01-01T03:00
+2022-01-05T03:11:11
-- !select6 --
-1 2022-01-05T03:00
+1 2022-01-05T03:11:11
-- !select5 --
-2022-01-01T03:00
+2022-01-05T03:11:11
-- !select6 --
-1 2022-01-05T03:00
+1 2022-01-05T03:11:11
diff --git
a/regression-test/java-udf-src/src/main/java/org/apache/doris/udf/MyHourDateTime.java
b/regression-test/java-udf-src/src/main/java/org/apache/doris/udf/MyHourDateTime.java
index e74f19d81c..8978a32d34 100644
---
a/regression-test/java-udf-src/src/main/java/org/apache/doris/udf/MyHourDateTime.java
+++
b/regression-test/java-udf-src/src/main/java/org/apache/doris/udf/MyHourDateTime.java
@@ -24,7 +24,8 @@ import java.time.LocalDateTime;
public class MyHourDateTime {
private static final Logger LOG = Logger.getLogger(MyHourDateTime.class);
public static class State {
- public LocalDateTime counter = LocalDateTime.of(2022,01,01,00,00,00);
+ public LocalDateTime counter;
+ public boolean inited = false;
}
public State create() {
@@ -36,8 +37,14 @@ public class MyHourDateTime {
public void add(State state, LocalDateTime val1) {
if (val1 == null) return;
- state.counter = state.counter.plusHours(val1.getHour());
- }
+ if (!state.inited) {
+ state.inited = true;
+ state.counter =
LocalDateTime.of(val1.getYear(),val1.getMonthValue(),val1.getDayOfMonth(),
+ val1.getHour(),val1.getMinute(),val1.getSecond());
+ } else {
+ state.counter = state.counter.plusHours(val1.getHour());
+ }
+ }
public void serialize(State state, DataOutputStream out) throws
IOException {
out.writeInt(state.counter.getYear());
@@ -46,14 +53,25 @@ public class MyHourDateTime {
out.writeInt(state.counter.getHour());
out.writeInt(state.counter.getMinute());
out.writeInt(state.counter.getSecond());
+ out.writeBoolean(state.inited);
}
public void deserialize(State state, DataInputStream in) throws
IOException {
state.counter =
LocalDateTime.of(in.readInt(),in.readInt(),in.readInt(),in.readInt(),in.readInt(),in.readInt());
+ state.inited = in.readBoolean();
}
public void merge(State state, State rhs) {
- state.counter = state.counter.plusHours(rhs.counter.getHour());
+ if (!rhs.inited) {
+ return;
+ }
+ if (!state.inited) {
+ state.inited = true;
+ state.counter =
LocalDateTime.of(rhs.counter.getYear(),rhs.counter.getMonthValue(),rhs.counter.getDayOfMonth()
+
,rhs.counter.getHour(),rhs.counter.getMinute(),rhs.counter.getSecond());
+ } else {
+ state.counter = state.counter.plusHours(rhs.counter.getHour());
+ }
}
public LocalDateTime getValue(State state) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]