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 3de3322f277 [fix](function) use need_replace_null_data_to_default for
function round (#56129)
3de3322f277 is described below
commit 3de3322f2776eecdc0d32d713f37e75b723e12b9
Author: Mryange <[email protected]>
AuthorDate: Wed Sep 17 17:00:38 2025 +0800
[fix](function) use need_replace_null_data_to_default for function round
(#56129)
### What problem does this PR solve?
The round function should use need_replace_null_data_to_default because
internal checks are performed for invalid values.
Not using need_replace_null_data_to_default may cause the function to
encounter random values when handling null values, resulting in errors.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
be/src/vec/functions/round.h | 2 ++
.../sql_functions/math_functions/test_round.out | Bin 5553 -> 5583 bytes
.../sql_functions/math_functions/test_round.groovy | 17 +++++++++++++++++
3 files changed, 19 insertions(+)
diff --git a/be/src/vec/functions/round.h b/be/src/vec/functions/round.h
index f447c17e789..7f8bbfe6e83 100644
--- a/be/src/vec/functions/round.h
+++ b/be/src/vec/functions/round.h
@@ -675,6 +675,8 @@ public:
return Impl::get_variadic_argument_types();
}
+ bool need_replace_null_data_to_default() const override { return true; }
+
/// Get result types by argument types. If the function does not apply to
these arguments, throw an exception.
DataTypePtr get_return_type_impl(const DataTypes& arguments) const
override {
if ((arguments.empty()) || (arguments.size() > 2)) {
diff --git
a/regression-test/data/query_p0/sql_functions/math_functions/test_round.out
b/regression-test/data/query_p0/sql_functions/math_functions/test_round.out
index ccdd9551f80..13ae8bcac9c 100644
Binary files
a/regression-test/data/query_p0/sql_functions/math_functions/test_round.out and
b/regression-test/data/query_p0/sql_functions/math_functions/test_round.out
differ
diff --git
a/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
b/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
index df54600e8e8..c47d1c799fc 100644
---
a/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
+++
b/regression-test/suites/query_p0/sql_functions/math_functions/test_round.groovy
@@ -313,4 +313,21 @@ suite("test_round") {
sql ("select round_bankers(a, 1-2) from test_round_bankers_scale order
by id")
result([[new BigDecimal(40)]])
}
+
+
+ sql """
+ DROP TABLE IF EXISTS test_dfloor_null;
+ """
+
+ sql """
+ CREATE TABLE test_dfloor_null (id INT, col1 DOUBLE, col2 DOUBLE, col3
DECIMAL(10,2), col4 VARCHAR(20), col5 DATETIME) DISTRIBUTED BY HASH(id) BUCKETS
4 PROPERTIES ("replication_num" = "1");
+ """
+
+ sql """
+ INSERT INTO test_dfloor_null (id, col1, col2, col3, col4, col5) VALUES (1,
10.5, 20.3, 100.25, 'test', '2023-01-01 10:00:00'), (2, 1.7976931348623157E308,
-1.7976931348623157E308, 99999999.99, 'boundary', '9999-12-31 23:59:59'), (3,
NULL, 0.0, -99999999.99, 'invalid', '1000-01-01 00:00:00'), (4, 15.75, 25.5,
50.00, 'special$char', '2023-06-15 14:30:45'), (5, 0.0, -0.0, 0.00, 'zero',
'2023-03-20 08:15:30');
+ """
+
+ qt_sql """
+ SELECT dfloor(col1, col2) AS r FROM test_dfloor_null order by id;
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]