This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new b40d4bcf7be branch-4.0: [Fix](p0) Fixed the issue that
testFoldConstant was interfered by enable_sql_cache and could not be tested
correctly. #61328 (#61461)
b40d4bcf7be is described below
commit b40d4bcf7bed030f820ba976224b76f01a22743d
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Mar 18 17:45:31 2026 +0800
branch-4.0: [Fix](p0) Fixed the issue that testFoldConstant was interfered
by enable_sql_cache and could not be tested correctly. #61328 (#61461)
Cherry-picked from #61328
Co-authored-by: linrrarity <[email protected]>
---
.../executable/DateTimeExtractAndTransform.java | 28 ++++++++++++++++++----
.../org/apache/doris/regression/suite/Suite.groovy | 5 +++-
2 files changed, 27 insertions(+), 6 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java
index f59ae96fd01..acbdfc25504 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/DateTimeExtractAndTransform.java
@@ -748,12 +748,30 @@ public class DateTimeExtractAndTransform {
secondValue = 59;
}
- double totalSeconds = Math.abs(hourValue) * 3600 + minuteValue * 60
- + Math.round(secondValue * 1000000.0) / 1000000.0;
- if (hourValue < 0) {
- totalSeconds = -totalSeconds;
+ return new TimeV2Literal((int) Math.abs(hourValue), (int) minuteValue,
(int) secondValue,
+ (int) Math.round(secondValue * 1000000) % 1000000,
6, hourValue < 0);
+ }
+
+ /**
+ * time transformation function: maketime
+ */
+ @ExecFunction(name = "maketime")
+ public static Expression makeTime(BigIntLiteral hour, BigIntLiteral
minute, BigIntLiteral second) {
+ long hourValue = hour.getValue();
+ long minuteValue = minute.getValue();
+ long secondValue = second.getValue();
+
+ if (minuteValue < 0 || minuteValue >= 60 || secondValue < 0 ||
secondValue >= 60) {
+ return new NullLiteral(TimeV2Type.SYSTEM_DEFAULT);
+ }
+ if (Math.abs(hourValue) > 838) {
+ hourValue = hourValue > 0 ? 838 : -838;
+ minuteValue = 59;
+ secondValue = 59;
}
- return new TimeV2Literal(totalSeconds);
+
+ return new TimeV2Literal((int) Math.abs(hourValue), (int) minuteValue,
+ (int) secondValue, 0, 0, hourValue < 0);
}
/**
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index 2af0aef9710..a33b5b652a4 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -2052,6 +2052,8 @@ class Suite implements GroovyInterceptable {
void testFoldConst(String foldSql) {
def sessionVarOrigValue = sql("select @@debug_skip_fold_constant")
+ def sqlCacheOrigValue = sql("select @@enable_sql_cache")
+ sql("set enable_sql_cache=false")
String openFoldConstant = "set debug_skip_fold_constant=false";
sql(openFoldConstant)
// logger.info(foldSql)
@@ -2066,8 +2068,9 @@ class Suite implements GroovyInterceptable {
List<List<Object>> resultExpected = tupleResult2.first
logger.info("result expected: " + resultExpected.toString())
- // restore debug_skip_fold_constant original value
+ // restore original session values
sql("set debug_skip_fold_constant=${sessionVarOrigValue[0][0]}")
+ sql("set enable_sql_cache=${sqlCacheOrigValue[0][0]}")
String errorMsg = null
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]