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 0ae9ed206a6 branch-4.0: [Feature](func) Support function PREVIOUS_DAY 
#60680 (#60726)
0ae9ed206a6 is described below

commit 0ae9ed206a6b263211702f8c6e76f637a1b39d34
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Feb 13 09:56:10 2026 +0800

    branch-4.0: [Feature](func) Support function PREVIOUS_DAY #60680 (#60726)
    
    Cherry-picked from #60680
    
    Co-authored-by: linrrarity <[email protected]>
---
 .../function_date_or_datetime_computation.cpp      |   1 +
 .../function_date_or_datetime_computation.h        |  25 +--
 .../doris/catalog/BuiltinScalarFunctions.java      |   2 +
 .../expressions/functions/scalar/PreviousDay.java  |  67 ++++++++
 .../expressions/visitor/ScalarFunctionVisitor.java |   5 +
 .../string_functions/test_previous_day.out         | 185 +++++++++++++++++++++
 .../string_functions/test_previous_day.groovy      | 127 ++++++++++++++
 7 files changed, 401 insertions(+), 11 deletions(-)

diff --git a/be/src/vec/functions/function_date_or_datetime_computation.cpp 
b/be/src/vec/functions/function_date_or_datetime_computation.cpp
index d21dd46609e..1ef7ecb579b 100644
--- a/be/src/vec/functions/function_date_or_datetime_computation.cpp
+++ b/be/src/vec/functions/function_date_or_datetime_computation.cpp
@@ -203,6 +203,7 @@ using FunctionDatetimeToWeekTwoArgs =
 
 void register_function_date_time_computation(SimpleFunctionFactory& factory) {
     factory.register_function<FunctionNextDay>();
+    factory.register_function<FunctionPreviousDay>();
     factory.register_function<FunctionNow>();
     factory.register_function<FunctionNowWithPrecision>();
     factory.register_function(CurDateFunctionName::name, 
&createCurDateFunctionBuilderFunction);
diff --git a/be/src/vec/functions/function_date_or_datetime_computation.h 
b/be/src/vec/functions/function_date_or_datetime_computation.h
index 5772bd835d3..81db78956e5 100644
--- a/be/src/vec/functions/function_date_or_datetime_computation.h
+++ b/be/src/vec/functions/function_date_or_datetime_computation.h
@@ -1484,10 +1484,11 @@ private:
     }
 };
 
-class FunctionNextDay : public IFunction {
+template <bool IsPrevious>
+class FunctionRelativeDay : public IFunction {
 public:
-    static constexpr auto name = "next_day";
-    static FunctionPtr create() { return std::make_shared<FunctionNextDay>(); }
+    static constexpr auto name = IsPrevious ? "previous_day" : "next_day";
+    static FunctionPtr create() { return 
std::make_shared<FunctionRelativeDay<IsPrevious>>(); }
     String get_name() const override { return name; }
     size_t get_number_of_arguments() const override { return 2; }
     DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) 
const override {
@@ -1506,9 +1507,7 @@ public:
         const auto& date_col = *assert_cast<const 
ColumnDateV2*>(left_col.get());
         const auto& week_col = *assert_cast<const 
ColumnString*>(right_col.get());
         Status status;
-        if (left_const && right_const) {
-            status = execute_vector<true, true>(input_rows_count, date_col, 
week_col, *res);
-        } else if (left_const) {
+        if (left_const) {
             status = execute_vector<true, false>(input_rows_count, date_col, 
week_col, *res);
         } else if (right_const) {
             status = execute_vector<false, true>(input_rows_count, date_col, 
week_col, *res);
@@ -1538,10 +1537,11 @@ private:
         }
         return it->second;
     }
-    static Status compute_next_day(DateV2Value<DateV2ValueType>& dtv, const 
int week_day) {
-        auto days_to_add = (week_day - (dtv.weekday() + 1) + 7) % 7;
-        days_to_add = days_to_add == 0 ? 7 : days_to_add;
-        dtv.date_add_interval<TimeUnit::DAY>(TimeInterval(TimeUnit::DAY, 
days_to_add, false));
+    static Status compute_relative_day(DateV2Value<DateV2ValueType>& dtv, 
const int week_day) {
+        auto delta_days = IsPrevious ? ((dtv.weekday() + 1) - week_day + 7) % 7
+                                     : (week_day - (dtv.weekday() + 1) + 7) % 
7;
+        delta_days = delta_days == 0 ? 7 : delta_days;
+        dtv.date_add_interval<TimeUnit::DAY>(TimeInterval(TimeUnit::DAY, 
delta_days, IsPrevious));
         return Status::OK();
     }
 
@@ -1574,13 +1574,16 @@ private:
                                                    week);
                 }
             }
-            RETURN_IF_ERROR(compute_next_day(dtv, week_day));
+            RETURN_IF_ERROR(compute_relative_day(dtv, week_day));
             res_col.insert_value(dtv);
         }
         return Status::OK();
     }
 };
 
+using FunctionNextDay = FunctionRelativeDay<true>;
+using FunctionPreviousDay = FunctionRelativeDay<false>;
+
 class FunctionTime : public IFunction {
 public:
     static constexpr auto name = "time";
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
index 9722294f375..33531afe512 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
@@ -383,6 +383,7 @@ import 
org.apache.doris.nereids.trees.expressions.functions.scalar.Pmod;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Positive;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Pow;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Power;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.PreviousDay;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Protocol;
 import 
org.apache.doris.nereids.trees.expressions.functions.scalar.QuantilePercent;
 import 
org.apache.doris.nereids.trees.expressions.functions.scalar.QuantileStateEmpty;
@@ -926,6 +927,7 @@ public class BuiltinScalarFunctions implements 
FunctionHelper {
             scalar(ParseDataSize.class, "parse_data_size"),
             scalar(PeriodAdd.class, "period_add"),
             scalar(PeriodDiff.class, "period_diff"),
+            scalar(PreviousDay.class, "previous_day"),
             scalar(Pi.class, "pi"),
             scalar(Pmod.class, "pmod"),
             scalar(Positive.class, "positive"),
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/PreviousDay.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/PreviousDay.java
new file mode 100644
index 00000000000..5d894ab2f0e
--- /dev/null
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/PreviousDay.java
@@ -0,0 +1,67 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.functions.scalar;
+
+import org.apache.doris.catalog.FunctionSignature;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
+import 
org.apache.doris.nereids.trees.expressions.functions.PropagateNullLiteral;
+import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
+import org.apache.doris.nereids.trees.expressions.shape.BinaryExpression;
+import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
+import org.apache.doris.nereids.types.DateV2Type;
+import org.apache.doris.nereids.types.StringType;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+
+/**
+ * ScalarFunction 'previous_day'.
+ */
+public class PreviousDay extends ScalarFunction
+        implements BinaryExpression, ExplicitlyCastableSignature, 
PropagateNullLiteral, PropagateNullable {
+    private static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
+            
FunctionSignature.ret(DateV2Type.INSTANCE).args(DateV2Type.INSTANCE, 
StringType.INSTANCE));
+
+    public PreviousDay(Expression arg0, Expression arg1) {
+        super("previous_day", arg0, arg1);
+    }
+
+    /** constructor for withChildren and reuse signature */
+    private PreviousDay(ScalarFunctionParams functionParams) {
+        super(functionParams);
+    }
+
+    @Override
+    public PreviousDay withChildren(List<Expression> children) {
+        Preconditions.checkArgument(children.size() == 2);
+        return new PreviousDay(getFunctionParams(children));
+    }
+
+    @Override
+    public List<FunctionSignature> getSignatures() {
+        return SIGNATURES;
+    }
+
+    @Override
+    public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
+        return visitor.visitPreviousDay(this, context);
+    }
+}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java
index 6abb49cfec3..cd5aebd2bab 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/visitor/ScalarFunctionVisitor.java
@@ -389,6 +389,7 @@ import 
org.apache.doris.nereids.trees.expressions.functions.scalar.Pmod;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Positive;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Pow;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Power;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.PreviousDay;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Protocol;
 import 
org.apache.doris.nereids.trees.expressions.functions.scalar.QuantilePercent;
 import 
org.apache.doris.nereids.trees.expressions.functions.scalar.QuantileStateEmpty;
@@ -2737,6 +2738,10 @@ public interface ScalarFunctionVisitor<R, C> {
         return visitScalarFunction(periodDiff, context);
     }
 
+    default R visitPreviousDay(PreviousDay previousDay, C context) {
+        return visitScalarFunction(previousDay, context);
+    }
+
     default R visitUnicodeNormalize(UnicodeNormalize func, C context) {
         return visitScalarFunction(func, context);
     }
diff --git 
a/regression-test/data/query_p0/sql_functions/string_functions/test_previous_day.out
 
b/regression-test/data/query_p0/sql_functions/string_functions/test_previous_day.out
new file mode 100644
index 00000000000..61027f2cf47
--- /dev/null
+++ 
b/regression-test/data/query_p0/sql_functions/string_functions/test_previous_day.out
@@ -0,0 +1,185 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !empty_nullable --
+
+-- !empty_not_nullable --
+
+-- !empty_partial_nullable --
+
+-- !all_null --
+\N     \N
+2024-12-31     2024-12-31
+
+-- !nullable --
+2024-03-11     2024-03-11
+0000-01-01     0000-01-01
+0000-12-29     0000-12-29
+0000-02-27     0000-02-27
+2024-02-21     2024-02-21
+2024-02-22     2024-02-22
+2023-02-21     2023-02-21
+2023-02-22     2023-02-22
+1900-02-21     1900-02-21
+1900-02-22     1900-02-22
+9999-12-24     9999-12-24
+1969-12-24     1969-12-24
+1969-12-25     1969-12-25
+
+-- !not_nullable --
+2024-03-11     2024-03-11
+0000-01-01     0000-01-01
+0000-12-29     0000-12-29
+0000-02-27     0000-02-27
+2024-02-21     2024-02-21
+2024-02-22     2024-02-22
+2023-02-21     2023-02-21
+2023-02-22     2023-02-22
+1900-02-21     1900-02-21
+1900-02-22     1900-02-22
+9999-12-24     9999-12-24
+1969-12-24     1969-12-24
+1969-12-25     1969-12-25
+
+-- !partial_nullable --
+2024-03-11     2024-03-11      2024-03-11      2024-03-11
+0000-01-01     0000-01-01      0000-01-01      0000-01-01
+0000-12-29     0000-12-29      0000-12-29      0000-12-29
+0000-02-27     0000-02-27      0000-02-27      0000-02-27
+2024-02-21     2024-02-21      2024-02-21      2024-02-21
+2024-02-22     2024-02-22      2024-02-22      2024-02-22
+2023-02-21     2023-02-21      2023-02-21      2023-02-21
+2023-02-22     2023-02-22      2023-02-22      2023-02-22
+1900-02-21     1900-02-21      1900-02-21      1900-02-21
+1900-02-22     1900-02-22      1900-02-22      1900-02-22
+9999-12-24     9999-12-24      9999-12-24      9999-12-24
+1969-12-24     1969-12-24      1969-12-24      1969-12-24
+1969-12-25     1969-12-25      1969-12-25      1969-12-25
+
+-- !nullable_no_null --
+2024-03-11     2024-03-11
+0000-01-01     0000-01-01
+0000-12-29     0000-12-29
+0000-02-27     0000-02-27
+2024-02-21     2024-02-21
+2024-02-22     2024-02-22
+2023-02-21     2023-02-21
+2023-02-22     2023-02-22
+1900-02-21     1900-02-21
+1900-02-22     1900-02-22
+9999-12-24     9999-12-24
+1969-12-24     1969-12-24
+1969-12-25     1969-12-25
+
+-- !timestamptz_literal --
+2025-10-03     2025-10-04
+
+-- !timestamptz_mixed --
+2025-10-04     2025-10-04
+
+-- !const_nullable --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
+-- !partial_const_nullable --
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+\N
+
+-- !const_not_nullable --
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+2024-12-30
+
+-- !const_other_nullable --
+2024-12-30
+2024-12-29
+2024-12-27
+2024-12-30
+2024-12-25
+2024-12-26
+2024-12-24
+2024-12-25
+2024-12-25
+2024-12-26
+2024-12-27
+2024-12-25
+2024-12-26
+
+-- !const_other_not_nullable --
+2024-03-08
+0000-01-01
+0000-12-29
+0000-02-24
+2024-02-23
+2024-02-23
+2023-02-24
+2023-02-24
+1900-02-23
+1900-02-23
+9999-12-24
+1969-12-26
+1969-12-26
+
+-- !const_nullable_no_null --
+2024-12-30
+
+-- !const_nullable_no_null_multirows --
+2024-03-11
+0000-01-01
+0000-12-29
+0000-02-27
+2024-02-21
+2024-02-22
+2023-02-21
+2023-02-22
+1900-02-21
+1900-02-22
+9999-12-24
+1969-12-24
+1969-12-25
+
+-- !const_partial_nullable_no_null --
+2024-12-30
+2024-12-29
+2024-12-27
+2024-12-30
+2024-12-25
+2024-12-26
+2024-12-24
+2024-12-25
+2024-12-25
+2024-12-26
+2024-12-27
+2024-12-25
+2024-12-26
+
diff --git 
a/regression-test/suites/query_p0/sql_functions/string_functions/test_previous_day.groovy
 
b/regression-test/suites/query_p0/sql_functions/string_functions/test_previous_day.groovy
new file mode 100644
index 00000000000..497a7b63015
--- /dev/null
+++ 
b/regression-test/suites/query_p0/sql_functions/string_functions/test_previous_day.groovy
@@ -0,0 +1,127 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite('test_previous_day') {
+    sql 'drop table if exists previous_day_args;'
+    sql '''
+        create table previous_day_args (
+            k0 int,
+            a date not null,
+            b date null,
+            c datetime not null,
+            d datetime null,
+            e string not null,
+            f string null
+        )
+        DISTRIBUTED BY HASH(k0)
+        PROPERTIES
+        (
+            "replication_num" = "1"
+        );
+    '''
+
+    qt_empty_nullable 'select previous_day(a, e), previous_day(c, e) from 
previous_day_args order by k0'
+    qt_empty_not_nullable 'select previous_day(b, f), previous_day(d, f) from 
previous_day_args order by k0'
+    qt_empty_partial_nullable 'select previous_day(a, f), previous_day(c, f) 
from previous_day_args order by k0'
+
+    sql "insert into previous_day_args values (1, '2025-01-01', null, 
'2025-01-01 00:00:00', null, 'MONDAY', null), (2, '2025-01-02', '2025-01-02', 
'2025-01-02 00:00:00', '2025-01-02 00:00:00', 'TUESDAY', 'TUESDAY')"
+    qt_all_null 'select previous_day(b, f), previous_day(d, f) from 
previous_day_args order by k0'
+
+    sql 'truncate table previous_day_args'
+
+    sql """
+        insert into previous_day_args(k0, a, b, c, d, e, f) values
+        -- normal date
+        (1, '2024-03-15', '2024-03-15', '2024-03-15 10:00:00', '2024-03-15 
10:00:00', 'MON', 'MONDAY'),
+
+        -- first week of 0000
+        (2, '0000-01-01', '0000-01-01', '0000-01-01 00:00:00', '0000-01-01 
00:00:00', 'SUN', 'SUNDAY'),
+
+        -- last day of 0000
+        (3, '0000-12-31', '0000-12-31', '0000-12-31 23:59:59', '0000-12-31 
23:59:59', 'FRI', 'FRIDAY'),
+
+        -- 0000-02-28
+        (4, '0000-02-28', '0000-02-28', '0000-02-28 12:00:00', '0000-02-28 
12:00:00', 'MO', 'MONDAY'),
+
+        -- leap year date before and after
+        (5, '2024-02-28', '2024-02-28', '2024-02-28 00:00:00', '2024-02-28 
00:00:00', 'WED', 'WEDNESDAY'),
+        (6, '2024-02-29', '2024-02-29', '2024-02-29 00:00:00', '2024-02-29 
00:00:00', 'THU', 'THURSDAY'),
+
+        -- non leap year date before and after
+        (7, '2023-02-28', '2023-02-28', '2023-02-28 00:00:00', '2023-02-28 
00:00:00', 'TUE', 'TUESDAY'),
+        (8, '2023-03-01', '2023-03-01', '2023-03-01 00:00:00', '2023-03-01 
00:00:00', 'WE', 'WEDNESDAY'),
+
+        -- 1900 non leap year date before and after
+        (9, '1900-02-28', '1900-02-28', '1900-02-28 00:00:00', '1900-02-28 
00:00:00', 'WED', 'WEDNESDAY'),
+        (10, '1900-03-01', '1900-03-01', '1900-03-01 00:00:00', '1900-03-01 
00:00:00', 'THU', 'THURSDAY'),
+
+        -- last second of 9999
+        (11, '9999-12-31', '9999-12-31', '9999-12-31 23:59:59', '9999-12-31 
23:59:59', 'FRI', 'FRIDAY'),
+
+        -- first second of 1970
+        (12, '1969-12-31', '1969-12-31', '1969-12-31 23:59:59', '1969-12-31 
23:59:59', 'WED', 'WEDNESDAY'),
+        (13, '1970-01-01', '1970-01-01', '1970-01-01 00:00:00', '1970-01-01 
00:00:00', 'THU', 'THURSDAY');
+    """
+
+    qt_nullable 'select previous_day(b, f), previous_day(d, f) from 
previous_day_args order by k0'
+    qt_not_nullable 'select previous_day(a, e), previous_day(c, e) from 
previous_day_args order by k0'
+    qt_partial_nullable 'select previous_day(a, f), previous_day(c, f), 
previous_day(b, e), previous_day(d, e) from previous_day_args order by k0'
+    qt_nullable_no_null 'select previous_day(a, nullable(e)), previous_day(c, 
nullable(e)) from previous_day_args order by k0'
+
+    // timestamptz literals (calculated in UTC) vs local datetime (no casts)
+    qt_timestamptz_literal "select previous_day('2025-10-10 23:00:00-08:00', 
'FRI'), previous_day('2025-10-10 23:00:00+02:00', 'SAT')"
+    qt_timestamptz_mixed "select previous_day('2025-10-11 07:30:00+08:00', 
'SAT'), previous_day('2025-10-11 00:30:00Z', 'SAT')"
+
+    /// consts. most by BE-UT
+    qt_const_nullable 'select previous_day(NULL, NULL) from previous_day_args 
order by k0'
+    qt_partial_const_nullable 'select previous_day(NULL, e) from 
previous_day_args order by k0'
+    qt_const_not_nullable "select previous_day('2025-01-01', 'MONDAY') from 
previous_day_args order by k0"
+    qt_const_other_nullable "select previous_day('2025-01-01', f) from 
previous_day_args order by k0"
+    qt_const_other_not_nullable "select previous_day(a, 'FRI') from 
previous_day_args order by k0"
+    qt_const_nullable_no_null "select previous_day(nullable('2025-01-01'), 
nullable('MON'))"
+    qt_const_nullable_no_null_multirows 'select previous_day(nullable(c), 
nullable(e)) from previous_day_args order by k0'
+    qt_const_partial_nullable_no_null "select previous_day('2025-01-01', 
nullable(e)) from previous_day_args order by k0"
+
+    /// folding
+    testFoldConst("select previous_day('', 'SA')")
+    testFoldConst('select previous_day(NULL, NULL)')
+    testFoldConst("select previous_day(NULL, 'FRI')")
+    testFoldConst("select previous_day('2025-01-01', NULL)")
+    testFoldConst("select previous_day('2025-01-01', 'MONDAY')")
+    testFoldConst("select previous_day(nullable('2025-01-01'), 
nullable('SUN'))")
+    testFoldConst("select previous_day('2025-01-01', nullable('WE'))")
+    testFoldConst("select previous_day(nullable('2025-01-01'), 'TH')")
+    testFoldConst("select previous_day(nullable('2025-01-01 12:34:56'), 
'MONDAY')")
+    testFoldConst("select previous_day('2025-10-10 23:00:00-08:00', 'FRI')")
+    testFoldConst("select previous_day('2025-10-10 23:00:00+02:00', 'SAT')")
+    testFoldConst("select previous_day('2025-10-11 07:30:00+08:00', 'SAT')")
+    testFoldConst("select previous_day('2025-10-11 00:30:00Z', 'SAT')")
+
+    /// error cases
+    test {
+        sql """ select previous_day('2025-01-01', 'SO') """
+        exception 'Function previous_day failed to parse weekday: SO'
+    }
+    test {
+        sql """ select previous_day('2025-01-01', 'MONDDY') """
+        exception 'Function previous_day failed to parse weekday: MONDDY'
+    }
+    test {
+        sql """ select previous_day('2025-01-01', '') """
+        exception 'Function previous_day failed to parse weekday: '
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to