You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "linrrzqqq (via GitHub)" <gi...@apache.org> on 2025/10/30 11:17:01 UTC
[PR] [Feature](function) Support function DEFAULT [doris]
linrrzqqq opened a new pull request, #57531:
URL: https://github.com/apache/doris/pull/57531
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] 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:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [x] Yes. https://github.com/apache/doris-website/pull/3029
### 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 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3491561983
# FE Regression Coverage Report
Increment line coverage ` 94.12% (16/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_e6c286ca24c9782154f78fe1ca84fd5450c4e463_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_e6c286ca24c9782154f78fe1ca84fd5450c4e463_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3485659900
<details>
<summary>ClickBench: <b>Total hot run time: 27.66 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit a49bcfe67d4a00dd59be8eace0dad7155d3c8528, data reload: false
query1 0.05 0.05 0.05
query2 0.09 0.06 0.05
query3 0.26 0.09 0.08
query4 1.61 0.12 0.11
query5 0.27 0.26 0.25
query6 1.18 0.64 0.63
query7 0.03 0.03 0.02
query8 0.06 0.04 0.05
query9 0.62 0.53 0.53
query10 0.57 0.57 0.57
query11 0.16 0.11 0.12
query12 0.15 0.12 0.11
query13 0.61 0.61 0.61
query14 1.01 1.01 1.01
query15 0.84 0.82 0.83
query16 0.39 0.39 0.43
query17 1.03 1.06 1.03
query18 0.21 0.19 0.19
query19 1.91 1.85 1.78
query20 0.01 0.01 0.01
query21 15.47 0.19 0.13
query22 5.13 0.07 0.05
query23 15.68 0.25 0.11
query24 2.67 0.60 0.70
query25 0.08 0.06 0.06
query26 0.15 0.13 0.13
query27 0.06 0.06 0.05
query28 4.57 1.12 0.95
query29 12.60 3.95 3.27
query30 0.29 0.13 0.13
query31 2.82 0.60 0.38
query32 3.22 0.55 0.48
query33 3.08 3.03 3.00
query34 15.71 5.21 4.54
query35 4.55 4.60 4.55
query36 0.70 0.51 0.49
query37 0.10 0.07 0.08
query38 0.06 0.04 0.03
query39 0.04 0.03 0.03
query40 0.17 0.15 0.14
query41 0.09 0.03 0.04
query42 0.04 0.04 0.02
query43 0.05 0.04 0.03
Total cold run time: 98.39 s
Total hot run time: 27.66 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3479173999
# BE Regression && UT Coverage Report
Increment line coverage `7.59% (11/145)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_8486a80731d5080fc2d9d882df740e70da5f908d_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_8486a80731d5080fc2d9d882df740e70da5f908d_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 57.25% (19281/33681) |
| Line Coverage | 42.60% (184337/432746) |
| Region Coverage | 37.09% (145583/392558) |
| Branch Coverage | 38.14% (62307/163343) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3789135980
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3754282010
run cloud_p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3748735811
<details>
<summary>TPC-H: <b>Total hot run time: 31559 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 81065d6eded0251e8b72becfc029bd018ed6e937, data reload: false
------ Round 1 ----------------------------------
q1 17661 4200 4058 4058
q2 2038 364 247 247
q3 10145 1323 714 714
q4 10288 842 316 316
q5 8682 2151 1848 1848
q6 253 171 136 136
q7 930 813 661 661
q8 9287 1404 1123 1123
q9 5292 4735 4602 4602
q10 6828 1791 1412 1412
q11 502 282 276 276
q12 734 761 604 604
q13 17775 3847 3104 3104
q14 304 307 272 272
q15 593 514 504 504
q16 668 691 653 653
q17 666 747 533 533
q18 6713 6578 6443 6443
q19 1114 984 606 606
q20 389 355 237 237
q21 3013 2406 2247 2247
q22 1013 1019 963 963
Total cold run time: 104888 ms
Total hot run time: 31559 ms
----- Round 2, with runtime_filter_mode=off -----
q1 4131 4050 4061 4050
q2 324 404 312 312
q3 2113 2611 2204 2204
q4 1345 1743 1329 1329
q5 4139 4024 4149 4024
q6 204 167 130 130
q7 1858 1875 2094 1875
q8 2617 2368 2416 2368
q9 7338 7175 7298 7175
q10 2512 2771 2347 2347
q11 542 483 462 462
q12 733 785 631 631
q13 3793 4089 3333 3333
q14 330 316 317 316
q15 539 485 489 485
q16 680 738 644 644
q17 1165 1327 1430 1327
q18 7787 7807 7959 7807
q19 903 847 821 821
q20 1995 2031 1896 1896
q21 4863 4498 4424 4424
q22 1099 1022 960 960
Total cold run time: 51010 ms
Total hot run time: 48920 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "Thearas (via GitHub)" <gi...@apache.org>.
Thearas commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3467465414
Thank you for your contribution to Apache Doris.
Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR).
Please clearly describe your PR:
1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
3. What features were added. Why was this function added?
4. Which code was refactored and why was this part of the code refactored?
5. Which functions were optimized and what is the difference before and after the optimization?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3479053307
run external
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2484850516
##########
be/src/vec/functions/function_default.cpp:
##########
@@ -0,0 +1,218 @@
+// 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.
+
+#include <mysql/binary_log_types.h>
+
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "runtime/descriptors.h"
+#include "runtime/primitive_type.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/column_with_type_and_name.h"
+#include "vec/data_types/data_type_nullable.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
+class FunctionDefault : public IFunction {
+public:
+ static constexpr auto name = "default";
+ static FunctionPtr create() { return std::make_shared<FunctionDefault>(); }
+ String get_name() const override { return name; }
+ size_t get_number_of_arguments() const override { return 1; }
+
+ DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+ return make_nullable(arguments[0]);
+ }
+
+ bool use_default_implementation_for_nulls() const override { return false; }
+
+ Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
+ uint32_t result, size_t input_rows_count) const override {
+ ColumnWithTypeAndName& result_info = block.get_by_position(result);
+ auto res_nested_type = remove_nullable(result_info.type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ ColumnWithTypeAndName& input_column_info = block.get_by_position(arguments[0]);
+ const std::string& col_name = input_column_info.name;
+
+ std::string default_value;
+ bool has_default_value = false;
+ bool is_nullable = true;
+ get_default_value_and_nullable_for_col(context, col_name, default_value, has_default_value,
+ is_nullable);
+
+ // For date types, if the default value is `CURRENT_TIMESTAMP` or `CURRENT_DATE`.
+ // Reference the behavior in MySQL:
+ // if column is NULLABLE, return all NULLs
+ // else return zero datetime values like `0000-00-00 00:00:00` or `0000-00-00`
+ if (is_date_type(res_primitive_type) && has_default_value &&
+ (default_value == "CURRENT_TIMESTAMP" || default_value == "CURRENT_DATE")) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return return_with_zero_datetime(block, result, res_nested_type, res_primitive_type,
+ input_rows_count);
+ }
+ }
+
+ // For some complex types, only accept NULL as default value
+ if (is_complex_type(res_primitive_type) || res_primitive_type == TYPE_JSONB ||
+ res_primitive_type == TYPE_VARIANT) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return Status::InvalidArgument(
+ "Column '{}' of type '{}' must be nullable to use DEFAULT", col_name,
+ res_nested_type->get_name());
+ }
+ }
+
+ // 1. specified default value when creating table -> default_value
+ // 2. no specified default value && column is NOT NULL -> error
+ // 3. no specified default value && column is NULLABLE -> NULL
+ if (has_default_value) {
+ MutableColumnPtr res_col = res_nested_type->create_column();
+ auto null_map = ColumnUInt8::create(input_rows_count, 0);
+ Field default_field;
+
+ auto temp_column = res_nested_type->create_column();
+ auto serde = res_nested_type->get_serde();
+ StringRef default_str_ref(default_value.data(), default_value.size());
+ DataTypeSerDe::FormatOptions options;
+ Status parse_status = serde->from_string(default_str_ref, *temp_column, options);
+
+ if (parse_status.ok() && temp_column->size() > 0) {
+ temp_column->get(0, default_field);
+ }
+
+ for (size_t i = 0; i < input_rows_count; ++i) {
+ res_col->insert(default_field);
Review Comment:
This is a scalar function in MySQL's behavior
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478268503
# BE Regression && UT Coverage Report
Increment line coverage `90.07% (127/141)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_0ab8fbc78ea338f6e31bf84ddb9b74febb63a34a_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_0ab8fbc78ea338f6e31bf84ddb9b74febb63a34a_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 71.47% (24077/33686) |
| Line Coverage | 57.87% (250415/432736) |
| Region Coverage | 52.82% (207412/392658) |
| Branch Coverage | 54.65% (89273/163354) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3489176622
# FE Regression Coverage Report
Increment line coverage ` 88.24% (15/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3776502747
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "924060929 (via GitHub)" <gi...@apache.org>.
924060929 commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2715774918
##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -1617,6 +1617,7 @@ primaryExpression
| CASE value=expression whenClause+ (ELSE elseExpression=expression)? END #simpleCase
| name=CAST LEFT_PAREN expression AS castDataType RIGHT_PAREN #cast
| name=TRY_CAST LEFT_PAREN expression AS castDataType RIGHT_PAREN #tryCast
+ | DEFAULT LEFT_PAREN expression RIGHT_PAREN #defaultValue
Review Comment:
should be `DEFAULT LEFT_PAREN identifier RIGHT_PAREN` because you only support get default value from a column
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3748803201
<details>
<summary>ClickBench: <b>Total hot run time: 26.88 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 81065d6eded0251e8b72becfc029bd018ed6e937, data reload: false
query1 0.06 0.05 0.04
query2 0.09 0.05 0.05
query3 0.25 0.09 0.08
query4 1.60 0.12 0.11
query5 0.28 0.25 0.25
query6 1.14 0.67 0.64
query7 0.03 0.02 0.02
query8 0.05 0.04 0.04
query9 0.59 0.51 0.51
query10 0.54 0.54 0.54
query11 0.14 0.10 0.09
query12 0.14 0.10 0.11
query13 0.60 0.58 0.59
query14 0.96 0.95 0.96
query15 0.78 0.77 0.80
query16 0.39 0.42 0.42
query17 0.96 1.00 1.03
query18 0.23 0.21 0.21
query19 1.99 1.89 1.88
query20 0.01 0.01 0.02
query21 15.45 0.27 0.13
query22 5.27 0.06 0.04
query23 16.30 0.28 0.11
query24 1.38 0.34 0.44
query25 0.12 0.08 0.06
query26 0.15 0.13 0.13
query27 0.08 0.04 0.07
query28 3.54 1.08 0.88
query29 12.54 3.97 3.15
query30 0.28 0.14 0.12
query31 2.82 0.63 0.38
query32 3.30 0.55 0.44
query33 2.96 3.07 3.04
query34 16.11 5.11 4.46
query35 4.42 4.39 5.01
query36 0.74 0.52 0.54
query37 0.12 0.06 0.08
query38 0.07 0.05 0.04
query39 0.05 0.03 0.03
query40 0.17 0.15 0.16
query41 0.08 0.03 0.03
query42 0.04 0.03 0.02
query43 0.04 0.04 0.03
Total cold run time: 96.86 s
Total hot run time: 26.88 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3748285266
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3754282355
run external
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3468683728
# FE UT Coverage Report
Increment line coverage ` 5.88% (1/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb/fe_increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb/fe_report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3485237373
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2484869021
##########
be/src/vec/functions/function_default.cpp:
##########
@@ -0,0 +1,218 @@
+// 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.
+
+#include <mysql/binary_log_types.h>
+
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "runtime/descriptors.h"
+#include "runtime/primitive_type.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/column_with_type_and_name.h"
+#include "vec/data_types/data_type_nullable.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
+class FunctionDefault : public IFunction {
+public:
+ static constexpr auto name = "default";
+ static FunctionPtr create() { return std::make_shared<FunctionDefault>(); }
+ String get_name() const override { return name; }
+ size_t get_number_of_arguments() const override { return 1; }
+
+ DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+ return make_nullable(arguments[0]);
+ }
+
+ bool use_default_implementation_for_nulls() const override { return false; }
+
+ Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
+ uint32_t result, size_t input_rows_count) const override {
+ ColumnWithTypeAndName& result_info = block.get_by_position(result);
+ auto res_nested_type = remove_nullable(result_info.type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ ColumnWithTypeAndName& input_column_info = block.get_by_position(arguments[0]);
+ const std::string& col_name = input_column_info.name;
+
+ std::string default_value;
+ bool has_default_value = false;
+ bool is_nullable = true;
+ get_default_value_and_nullable_for_col(context, col_name, default_value, has_default_value,
+ is_nullable);
+
+ // For date types, if the default value is `CURRENT_TIMESTAMP` or `CURRENT_DATE`.
+ // Reference the behavior in MySQL:
+ // if column is NULLABLE, return all NULLs
+ // else return zero datetime values like `0000-00-00 00:00:00` or `0000-00-00`
+ if (is_date_type(res_primitive_type) && has_default_value &&
+ (default_value == "CURRENT_TIMESTAMP" || default_value == "CURRENT_DATE")) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return return_with_zero_datetime(block, result, res_nested_type, res_primitive_type,
+ input_rows_count);
+ }
+ }
+
+ // For some complex types, only accept NULL as default value
+ if (is_complex_type(res_primitive_type) || res_primitive_type == TYPE_JSONB ||
+ res_primitive_type == TYPE_VARIANT) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return Status::InvalidArgument(
+ "Column '{}' of type '{}' must be nullable to use DEFAULT", col_name,
+ res_nested_type->get_name());
+ }
+ }
+
+ // 1. specified default value when creating table -> default_value
+ // 2. no specified default value && column is NOT NULL -> error
+ // 3. no specified default value && column is NULLABLE -> NULL
+ if (has_default_value) {
+ MutableColumnPtr res_col = res_nested_type->create_column();
+ auto null_map = ColumnUInt8::create(input_rows_count, 0);
+ Field default_field;
+
+ auto temp_column = res_nested_type->create_column();
+ auto serde = res_nested_type->get_serde();
+ StringRef default_str_ref(default_value.data(), default_value.size());
+ DataTypeSerDe::FormatOptions options;
+ Status parse_status = serde->from_string(default_str_ref, *temp_column, options);
+
+ if (parse_status.ok() && temp_column->size() > 0) {
+ temp_column->get(0, default_field);
+ }
+
+ for (size_t i = 0; i < input_rows_count; ++i) {
+ res_col->insert(default_field);
Review Comment:
why scalar function couldn't return const column?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3488818294
run nonConcurrent
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3489895505
# FE Regression Coverage Report
Increment line coverage ` 88.24% (15/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3776624095
<details>
<summary>TPC-DS: <b>Total hot run time: 174054 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 6e0eb6c4c2bbe2c6646128ac5907186c69e342ba, data reload: false
query5 1187 596 497 497
query6 235 226 210 210
query7 385 463 263 263
query8 280 259 248 248
query9 3271 2932 2913 2913
query10 414 387 333 333
query11 15024 15233 15001 15001
query12 172 115 121 115
query13 2016 489 400 400
query14 6117 3062 2820 2820
query14_1 2741 2695 2670 2670
query15 206 193 177 177
query16 996 489 462 462
query17 1243 632 545 545
query18 2423 418 325 325
query19 221 219 186 186
query20 125 115 110 110
query21 206 130 112 112
query22 3968 3934 3874 3874
query23 15886 15592 15219 15219
query23_1 15381 15491 15471 15471
query24 6706 1562 1175 1175
query24_1 1168 1156 1180 1156
query25 512 431 384 384
query26 1237 267 148 148
query27 2772 457 281 281
query28 4562 2177 2171 2171
query29 713 500 422 422
query30 315 242 207 207
query31 786 633 547 547
query32 82 73 73 73
query33 492 356 314 314
query34 891 875 535 535
query35 726 756 681 681
query36 892 865 830 830
query37 132 93 82 82
query38 2666 2795 2706 2706
query39 774 753 722 722
query39_1 706 725 698 698
query40 216 130 122 122
query41 67 62 61 61
query42 102 104 102 102
query43 430 483 412 412
query44 1368 758 757 757
query45 196 200 180 180
query46 829 952 576 576
query47 1369 1489 1298 1298
query48 329 335 251 251
query49 618 424 344 344
query50 621 277 208 208
query51 3763 3851 3773 3773
query52 104 106 99 99
query53 289 321 269 269
query54 289 267 260 260
query55 85 85 86 85
query56 321 312 311 311
query57 1031 1006 916 916
query58 269 264 259 259
query59 2138 2128 1964 1964
query60 343 332 306 306
query61 151 143 151 143
query62 392 370 335 335
query63 301 269 268 268
query64 4786 1282 937 937
query65 3812 3757 3724 3724
query66 1420 417 343 343
query67 15476 15647 15449 15449
query68 2323 1103 764 764
query69 439 363 334 334
query70 1007 992 947 947
query71 323 310 299 299
query72 5275 3087 3258 3087
query73 613 729 324 324
query74 8719 8769 8476 8476
query75 2754 2802 2477 2477
query76 2182 1064 698 698
query77 390 418 309 309
query78 9833 9827 9209 9209
query79 1022 926 600 600
query80 720 621 524 524
query81 488 264 236 236
query82 1388 147 115 115
query83 331 267 244 244
query84 254 132 101 101
query85 985 552 504 504
query86 375 296 288 288
query87 2890 2835 2727 2727
query88 3551 2611 2583 2583
query89 395 357 335 335
query90 1899 182 178 178
query91 179 172 144 144
query92 87 77 74 74
query93 970 924 540 540
query94 484 335 347 335
query95 563 400 318 318
query96 646 509 242 242
query97 2341 2343 2306 2306
query98 223 200 199 199
query99 588 569 498 498
Total cold run time: 230619 ms
Total hot run time: 174054 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3776638711
<details>
<summary>ClickBench: <b>Total hot run time: 26.82 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 6e0eb6c4c2bbe2c6646128ac5907186c69e342ba, data reload: false
query1 0.06 0.05 0.04
query2 0.10 0.04 0.05
query3 0.26 0.08 0.09
query4 1.60 0.11 0.12
query5 0.27 0.26 0.26
query6 1.14 0.66 0.66
query7 0.03 0.02 0.02
query8 0.05 0.04 0.04
query9 0.57 0.50 0.49
query10 0.56 0.53 0.56
query11 0.14 0.09 0.10
query12 0.14 0.10 0.11
query13 0.60 0.59 0.59
query14 0.96 0.95 0.95
query15 0.79 0.78 0.79
query16 0.40 0.39 0.40
query17 1.07 1.06 1.05
query18 0.23 0.22 0.21
query19 1.94 1.88 1.87
query20 0.02 0.01 0.01
query21 15.46 0.28 0.14
query22 5.17 0.05 0.05
query23 16.03 0.29 0.10
query24 1.24 0.28 0.26
query25 0.11 0.06 0.07
query26 0.15 0.13 0.14
query27 0.04 0.04 0.06
query28 3.32 1.07 0.88
query29 12.51 3.88 3.14
query30 0.27 0.14 0.15
query31 2.83 0.61 0.40
query32 3.25 0.54 0.47
query33 3.03 3.02 3.08
query34 15.89 5.10 4.45
query35 4.40 4.44 4.39
query36 0.64 0.50 0.49
query37 0.11 0.07 0.06
query38 0.06 0.04 0.04
query39 0.04 0.04 0.03
query40 0.17 0.14 0.13
query41 0.09 0.03 0.03
query42 0.05 0.03 0.03
query43 0.05 0.03 0.04
Total cold run time: 95.84 s
Total hot run time: 26.82 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3749438656
# FE Regression Coverage Report
Increment line coverage ` 63.33% (19/30)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3747401316
# Cloud UT Coverage Report
Increment line coverage ` ` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/5aa6d36f6794aaf4f8ed052bb4a343db58f982fe_5aa6d36f6794aaf4f8ed052bb4a343db58f982fe_cloud/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/5aa6d36f6794aaf4f8ed052bb4a343db58f982fe_5aa6d36f6794aaf4f8ed052bb4a343db58f982fe_cloud/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 79.57% (1784/2242) |
| Line Coverage | 64.79% (31744/48997) |
| Region Coverage | 65.46% (15789/24120) |
| Branch Coverage | 56.03% (8387/14968) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3468871642
<details>
<summary>ClickBench: <b>Total hot run time: 29.57 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 5ca6a29e47eda34b1a634fcd82b0dd56e81528eb, data reload: false
query1 0.06 0.06 0.06
query2 0.12 0.06 0.07
query3 0.26 0.09 0.09
query4 1.61 0.12 0.12
query5 0.30 0.28 0.26
query6 1.17 0.69 0.69
query7 0.04 0.03 0.02
query8 0.07 0.05 0.05
query9 0.67 0.57 0.58
query10 0.63 0.62 0.63
query11 0.20 0.13 0.14
query12 0.18 0.14 0.14
query13 0.66 0.62 0.61
query14 1.05 1.02 1.05
query15 0.92 0.86 0.88
query16 0.42 0.44 0.43
query17 1.17 1.23 1.12
query18 0.24 0.23 0.21
query19 2.02 1.93 1.92
query20 0.01 0.01 0.01
query21 15.36 0.24 0.15
query22 4.86 0.08 0.06
query23 15.65 0.31 0.12
query24 2.36 0.78 0.89
query25 0.08 0.06 0.07
query26 0.17 0.16 0.16
query27 0.08 0.07 0.07
query28 4.44 1.20 0.98
query29 12.68 4.57 3.77
query30 0.30 0.17 0.15
query31 2.84 0.65 0.41
query32 3.25 0.59 0.49
query33 3.11 3.20 3.19
query34 15.94 5.30 4.69
query35 4.70 4.61 4.59
query36 0.72 0.54 0.51
query37 0.11 0.07 0.08
query38 0.08 0.05 0.04
query39 0.04 0.04 0.04
query40 0.20 0.16 0.14
query41 0.09 0.04 0.04
query42 0.04 0.04 0.03
query43 0.05 0.04 0.05
Total cold run time: 98.95 s
Total hot run time: 29.57 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb merged PR #57531:
URL: https://github.com/apache/doris/pull/57531
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3789485458
# FE UT Coverage Report
Increment line coverage ` 13.21% (7/53)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_250ef6b99c1678f3b80b565c8d601f423dba7d9a/fe_increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_250ef6b99c1678f3b80b565c8d601f423dba7d9a/fe_report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3490571322
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3491489240
# BE Regression && UT Coverage Report
Increment line coverage `97.89% (139/142)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_e6c286ca24c9782154f78fe1ca84fd5450c4e463_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_e6c286ca24c9782154f78fe1ca84fd5450c4e463_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 71.57% (24264/33902) |
| Line Coverage | 58.13% (252753/434778) |
| Region Coverage | 53.56% (211114/394155) |
| Branch Coverage | 54.90% (90216/164319) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3490465472
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3489861160
# BE Regression && UT Coverage Report
Increment line coverage `93.48% (129/138)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 71.51% (24115/33724) |
| Line Coverage | 57.94% (250962/433171) |
| Region Coverage | 53.00% (208280/392959) |
| Branch Coverage | 54.74% (89536/163555) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2486468809
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java:
##########
@@ -433,7 +433,7 @@ public void analyze(boolean isOlap) throws AnalysisException {
throw new AnalysisException("complex type have to use aggregate function: " + name);
}
}
- if (isAllowNull) {
+ if (!isAllowNull) {
Review Comment:
seems wrong?
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Default.java:
##########
@@ -0,0 +1,85 @@
+// 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.exceptions.AnalysisException;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.SlotReference;
+import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable;
+import org.apache.doris.nereids.trees.expressions.functions.CustomSignature;
+import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
+import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
+import org.apache.doris.nereids.types.DataType;
+
+import com.google.common.base.Preconditions;
+
+import java.util.List;
+
+/**
+ * ScalarFunction 'default'. This function returns the default value of a column.
+ */
+public class Default extends ScalarFunction
+ implements UnaryExpression, CustomSignature, AlwaysNullable {
+
+ /**
+ * constructor with 1 argument.
+ */
+ public Default(Expression arg) {
+ super("default", arg);
+ }
+
+ /** constructor for withChildren and reuse signature */
+ private Default(ScalarFunctionParams functionParams) {
+ super(functionParams);
+ }
+
+ /**
+ * withChildren.
+ */
+ @Override
+ public Default withChildren(List<Expression> children) {
+ Preconditions.checkArgument(children.size() == 1);
Review Comment:
can this make sure only accept one argument? please add test for more than one args in BE and foldByBE paths
##########
be/src/vec/functions/function_default.cpp:
##########
@@ -0,0 +1,223 @@
+// 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.
+
+#include <mysql/binary_log_types.h>
+
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "runtime/descriptors.h"
+#include "runtime/primitive_type.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/column_with_type_and_name.h"
+#include "vec/data_types/data_type_nullable.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
+class FunctionDefault : public IFunction {
+public:
+ static constexpr auto name = "default";
+ static FunctionPtr create() { return std::make_shared<FunctionDefault>(); }
+ String get_name() const override { return name; }
+ size_t get_number_of_arguments() const override { return 1; }
+
+ DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+ return make_nullable(arguments[0]);
+ }
+
+ bool use_default_implementation_for_nulls() const override { return false; }
+
+ Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
+ uint32_t result, size_t input_rows_count) const override {
+ ColumnWithTypeAndName& result_info = block.get_by_position(result);
+ auto res_nested_type = remove_nullable(result_info.type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ ColumnWithTypeAndName& input_column_info = block.get_by_position(arguments[0]);
+ const std::string& col_name = input_column_info.name;
+
+ std::string default_value;
+ bool has_default_value = false;
+ bool is_nullable = true;
+ get_default_value_and_nullable_for_col(context, col_name, default_value, has_default_value,
+ is_nullable);
+
+ // For date types, if the default value is `CURRENT_TIMESTAMP` or `CURRENT_DATE`.
+ // Reference the behavior in MySQL:
+ // if column is NULLABLE, return all NULLs
+ // else return zero datetime values like `0000-00-00 00:00:00` or `0000-00-00`
+ // Because Doris has a range limit for date & datetime, `0000-00-00` cannot be represented.
+ // So here we use the smallest representable value instead
+ if (is_date_type(res_primitive_type) && has_default_value &&
+ (default_value == "CURRENT_TIMESTAMP" || default_value == "CURRENT_DATE")) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return return_with_zero_datetime(block, result, res_nested_type, res_primitive_type,
+ input_rows_count);
+ }
+ }
+
+ // For some complex types, only accept NULL as default value
+ if (is_complex_type(res_primitive_type) || res_primitive_type == TYPE_JSONB ||
+ res_primitive_type == TYPE_VARIANT) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return Status::InvalidArgument(
+ "Column '{}' of type '{}' must be nullable to use DEFAULT", col_name,
+ res_nested_type->get_name());
+ }
+ }
+
+ // 1. specified default value when creating table -> default_value
+ // 2. no specified default value && column is NOT NULL -> error
+ // 3. no specified default value && column is NULLABLE -> NULL
+ if (has_default_value) {
+ MutableColumnPtr res_col = res_nested_type->create_column();
+ auto null_map = ColumnUInt8::create(input_rows_count, 0);
+ Field default_field;
+
+ auto temp_column = res_nested_type->create_column();
+ auto serde = res_nested_type->get_serde();
+ StringRef default_str_ref(default_value.data(), default_value.size());
+ DataTypeSerDe::FormatOptions options;
+ Status parse_status = serde->from_string(default_str_ref, *temp_column, options);
+
+ if (parse_status.ok() && temp_column->size() > 0) {
+ temp_column->get(0, default_field);
+ res_col->insert(default_field);
+ block.replace_by_position(
+ result, ColumnNullable::create(
+ ColumnConst::create(std::move(res_col), input_rows_count),
+ std::move(null_map)));
+ } else [[unlikely]] {
+ return Status::FatalError("Failed to parse default value for column '{}'",
+ col_name);
+ }
+ } else {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return Status::InvalidArgument("Column '{}' is NOT NULL but has no default value",
+ col_name);
+ }
+ }
+ return Status::OK();
+ }
+
+private:
+ void get_default_value_and_nullable_for_col(FunctionContext* context,
+ const std::string& column_name,
+ std::string& default_value, bool& has_default_value,
+ bool& is_nullable) const {
+ RuntimeState* state = context->state();
+ const DescriptorTbl& desc_tbl = state->desc_tbl();
+
+ SlotDescriptor* target_slot = nullptr;
+ for (auto* tuple_desc : desc_tbl.get_tuple_descs()) {
+ for (auto* slot : tuple_desc->slots()) {
+ if (slot->col_name() == column_name) {
Review Comment:
what if multi columns with same name but in different table so have different types and default value?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3468366012
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3485594660
# FE UT Coverage Report
Increment line coverage ` 5.88% (1/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528/fe_increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528/fe_report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3486330374
# FE Regression Coverage Report
Increment line coverage ` 88.24% (15/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3489208772
# FE Regression Coverage Report
Increment line coverage ` 88.24% (15/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478142800
# BE UT Coverage Report
Increment line coverage `9.72% (14/144)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/0ab8fbc78ea338f6e31bf84ddb9b74febb63a34a_0ab8fbc78ea338f6e31bf84ddb9b74febb63a34a/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/0ab8fbc78ea338f6e31bf84ddb9b74febb63a34a_0ab8fbc78ea338f6e31bf84ddb9b74febb63a34a/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 52.69% (18056/34266) |
| Line Coverage | 37.98% (164080/431986) |
| Region Coverage | 32.34% (125166/387062) |
| Branch Coverage | 33.73% (54726/162243) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3469224751
# BE UT Coverage Report
Increment line coverage `9.72% (14/144)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/5ca6a29e47eda34b1a634fcd82b0dd56e81528eb_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/5ca6a29e47eda34b1a634fcd82b0dd56e81528eb_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 52.71% (18045/34236) |
| Line Coverage | 37.96% (163748/431398) |
| Region Coverage | 32.33% (124852/386191) |
| Branch Coverage | 33.69% (54587/162005) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3469546831
# FE Regression Coverage Report
Increment line coverage ` 76.47% (13/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3743683823
# Cloud UT Coverage Report
Increment line coverage ` ` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/4d0b905f90f06d0e80b1babb7f77b8a84ce41349_4d0b905f90f06d0e80b1babb7f77b8a84ce41349_cloud/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/4d0b905f90f06d0e80b1babb7f77b8a84ce41349_4d0b905f90f06d0e80b1babb7f77b8a84ce41349_cloud/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 79.57% (1784/2242) |
| Line Coverage | 64.83% (31767/48997) |
| Region Coverage | 65.49% (15796/24120) |
| Branch Coverage | 56.07% (8393/14968) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3743711220
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3754992679
# FE Regression Coverage Report
Increment line coverage ` 63.33% (19/30)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3747315055
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3749178514
# BE UT Coverage Report
Increment line coverage `7.35% (10/136)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/81065d6eded0251e8b72becfc029bd018ed6e937_81065d6eded0251e8b72becfc029bd018ed6e937/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/81065d6eded0251e8b72becfc029bd018ed6e937_81065d6eded0251e8b72becfc029bd018ed6e937/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 52.94% (18973/35836) |
| Line Coverage | 39.00% (175804/450818) |
| Region Coverage | 33.62% (136297/405398) |
| Branch Coverage | 34.63% (58897/170056) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3748387161
# Cloud UT Coverage Report
Increment line coverage ` ` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/81065d6eded0251e8b72becfc029bd018ed6e937_81065d6eded0251e8b72becfc029bd018ed6e937_cloud/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/81065d6eded0251e8b72becfc029bd018ed6e937_81065d6eded0251e8b72becfc029bd018ed6e937_cloud/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 79.57% (1784/2242) |
| Line Coverage | 64.77% (31736/48997) |
| Region Coverage | 65.44% (15784/24120) |
| Branch Coverage | 56.03% (8386/14968) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3749400659
# BE Regression && UT Coverage Report
Increment line coverage `5.26% (7/133)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 61.05% (21440/35119) |
| Line Coverage | 47.33% (213105/450232) |
| Region Coverage | 42.49% (174151/409908) |
| Branch Coverage | 43.08% (73596/170821) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2701517349
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Default.java:
##########
@@ -15,55 +15,57 @@
// specific language governing permissions and limitations
// under the License.
-package org.apache.doris.nereids.trees.expressions.functions.scalar;
+package org.apache.doris.nereids.trees.expressions;
-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.PropagateNullable;
+import org.apache.doris.nereids.exceptions.AnalysisException;
+import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable;
import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
-import org.apache.doris.nereids.types.QuantileStateType;
-import org.apache.doris.nereids.types.StringType;
+import org.apache.doris.nereids.types.DataType;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.List;
/**
- * Function 'quantile_state_to_base64'.
+ * Default value expression.
*/
-public class QuantileStateToBase64 extends ScalarFunction
- implements UnaryExpression, ExplicitlyCastableSignature, PropagateNullable {
+public class Default extends Expression
+ implements UnaryExpression, AlwaysNullable {
- public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
- FunctionSignature.ret(StringType.INSTANCE).args(QuantileStateType.INSTANCE)
- );
+ public Default(Expression child) {
+ super(ImmutableList.of(child));
+ }
/**
* constructor with 1 argument.
*/
- public QuantileStateToBase64(Expression arg) {
- super("quantile_state_to_base64", arg);
+ public Default(Expression arg, DataType targetType) {
+ super(ImmutableList.of(arg));
}
- /**
- * withChildren.
- */
@Override
- public QuantileStateToBase64 withChildren(List<Expression> children) {
+ public Default withChildren(List<Expression> children) {
Preconditions.checkArgument(children.size() == 1);
- return new QuantileStateToBase64(children.get(0));
+ return new Default(children.get(0));
+ }
+
+ @Override
+ public DataType getDataType() {
+ return child().getDataType();
}
@Override
- public List<FunctionSignature> getSignatures() {
- return SIGNATURES;
+ public void checkLegalityBeforeTypeCoercion() {
Review Comment:
also check after rewrite
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultExpr.java:
##########
Review Comment:
do we really still need DefaultExpr? could Default directly used and translate to send to BE?
##########
be/src/vec/exprs/vdefault_expr.cpp:
##########
@@ -0,0 +1,181 @@
+// 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.
+
+#include "vec/exprs/vdefault_expr.h"
+
+#include <cctz/time_zone.h>
+#include <fmt/format.h>
+
+#include "runtime/descriptors.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/block.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/exprs/vexpr_context.h"
+#include "vec/exprs/vslot_ref.h"
+#include "vec/runtime/timestamptz_value.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+
+Status VDefaultExpr::prepare(RuntimeState* state, const RowDescriptor& desc,
+ VExprContext* context) {
+ RETURN_IF_ERROR(VExpr::prepare(state, desc, context));
+ DCHECK_EQ(_children.size(), 1);
+
+ _expr_name = fmt::format("default({})", _children[0]->expr_name());
+
+ auto* slot_ref = dynamic_cast<VSlotRef*>(_children[0].get());
+ if (slot_ref != nullptr && slot_ref->slot_id() != -1) {
+ const auto* slot_desc = state->desc_tbl().get_slot_descriptor(slot_ref->slot_id());
+ if (slot_desc) {
+ _slot_id = slot_ref->slot_id();
+ _is_nullable = slot_desc->is_nullable();
+ _has_default_value = slot_desc->has_default_value();
+ if (_has_default_value) {
+ _default_value = slot_desc->col_default_value();
+ }
+ }
+ }
+ _prepare_finished = true;
+ return Status::OK();
+}
+
+Status VDefaultExpr::open(RuntimeState* state, VExprContext* context,
+ FunctionContext::FunctionStateScope scope) {
+ RETURN_IF_ERROR(VExpr::open(state, context, scope));
+ int64_t timestamp_ms = state->timestamp_ms();
+ int32_t nano_seconds = state->nano_seconds();
+ cctz::time_zone timezone_obj = state->timezone_obj();
+
+ auto res_nested_type = remove_nullable(_data_type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ // Agg state(HLL, BITMAPA, QUANTILE_STATE) error only
+ if (is_var_len_object(res_primitive_type)) {
Review Comment:
could this be checked in FE?
##########
be/src/vec/exprs/vdefault_expr.cpp:
##########
@@ -0,0 +1,181 @@
+// 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.
+
+#include "vec/exprs/vdefault_expr.h"
+
+#include <cctz/time_zone.h>
+#include <fmt/format.h>
+
+#include "runtime/descriptors.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/block.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/exprs/vexpr_context.h"
+#include "vec/exprs/vslot_ref.h"
+#include "vec/runtime/timestamptz_value.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+
+Status VDefaultExpr::prepare(RuntimeState* state, const RowDescriptor& desc,
+ VExprContext* context) {
+ RETURN_IF_ERROR(VExpr::prepare(state, desc, context));
+ DCHECK_EQ(_children.size(), 1);
+
+ _expr_name = fmt::format("default({})", _children[0]->expr_name());
+
+ auto* slot_ref = dynamic_cast<VSlotRef*>(_children[0].get());
+ if (slot_ref != nullptr && slot_ref->slot_id() != -1) {
+ const auto* slot_desc = state->desc_tbl().get_slot_descriptor(slot_ref->slot_id());
+ if (slot_desc) {
+ _slot_id = slot_ref->slot_id();
+ _is_nullable = slot_desc->is_nullable();
+ _has_default_value = slot_desc->has_default_value();
+ if (_has_default_value) {
+ _default_value = slot_desc->col_default_value();
+ }
+ }
+ }
+ _prepare_finished = true;
+ return Status::OK();
+}
+
+Status VDefaultExpr::open(RuntimeState* state, VExprContext* context,
+ FunctionContext::FunctionStateScope scope) {
+ RETURN_IF_ERROR(VExpr::open(state, context, scope));
+ int64_t timestamp_ms = state->timestamp_ms();
+ int32_t nano_seconds = state->nano_seconds();
+ cctz::time_zone timezone_obj = state->timezone_obj();
+
+ auto res_nested_type = remove_nullable(_data_type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ // Agg state(HLL, BITMAPA, QUANTILE_STATE) error only
+ if (is_var_len_object(res_primitive_type)) {
+ return Status::InvalidArgument(
+ "Agg type(HLL, BITMAP, QUANTILE_STATE) cannot be used for the DEFAULT "
+ "function");
+ }
+
+ // 1. specified default value when creating table -> default_valueni
+ // 2. no specified default value && column is NULLABLE -> NULL
+ // 3. no specified default value && column is NOT NULL -> error
+ if (_has_default_value) {
+ if ((is_date_type(res_primitive_type) || res_primitive_type == TYPE_TIMESTAMPTZ) &&
+ (_default_value.starts_with("CURRENT_TIMESTAMP") || _default_value == "CURRENT_DATE")) {
+ int precision = -1;
+ if (_default_value.size() > 17) {
+ precision = std::atoi(_default_value.substr(18, 1).c_str());
Review Comment:
use our `string_parser.hpp`'s utils
##########
be/src/vec/exprs/vdefault_expr.cpp:
##########
@@ -0,0 +1,181 @@
+// 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.
+
+#include "vec/exprs/vdefault_expr.h"
+
+#include <cctz/time_zone.h>
+#include <fmt/format.h>
+
+#include "runtime/descriptors.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/block.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/exprs/vexpr_context.h"
+#include "vec/exprs/vslot_ref.h"
+#include "vec/runtime/timestamptz_value.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+
+Status VDefaultExpr::prepare(RuntimeState* state, const RowDescriptor& desc,
+ VExprContext* context) {
+ RETURN_IF_ERROR(VExpr::prepare(state, desc, context));
+ DCHECK_EQ(_children.size(), 1);
+
+ _expr_name = fmt::format("default({})", _children[0]->expr_name());
+
+ auto* slot_ref = dynamic_cast<VSlotRef*>(_children[0].get());
+ if (slot_ref != nullptr && slot_ref->slot_id() != -1) {
+ const auto* slot_desc = state->desc_tbl().get_slot_descriptor(slot_ref->slot_id());
+ if (slot_desc) {
+ _slot_id = slot_ref->slot_id();
+ _is_nullable = slot_desc->is_nullable();
+ _has_default_value = slot_desc->has_default_value();
+ if (_has_default_value) {
+ _default_value = slot_desc->col_default_value();
+ }
+ }
+ }
+ _prepare_finished = true;
+ return Status::OK();
+}
+
+Status VDefaultExpr::open(RuntimeState* state, VExprContext* context,
+ FunctionContext::FunctionStateScope scope) {
+ RETURN_IF_ERROR(VExpr::open(state, context, scope));
+ int64_t timestamp_ms = state->timestamp_ms();
+ int32_t nano_seconds = state->nano_seconds();
+ cctz::time_zone timezone_obj = state->timezone_obj();
+
+ auto res_nested_type = remove_nullable(_data_type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ // Agg state(HLL, BITMAPA, QUANTILE_STATE) error only
+ if (is_var_len_object(res_primitive_type)) {
+ return Status::InvalidArgument(
+ "Agg type(HLL, BITMAP, QUANTILE_STATE) cannot be used for the DEFAULT "
+ "function");
+ }
+
+ // 1. specified default value when creating table -> default_valueni
+ // 2. no specified default value && column is NULLABLE -> NULL
+ // 3. no specified default value && column is NOT NULL -> error
+ if (_has_default_value) {
+ if ((is_date_type(res_primitive_type) || res_primitive_type == TYPE_TIMESTAMPTZ) &&
+ (_default_value.starts_with("CURRENT_TIMESTAMP") || _default_value == "CURRENT_DATE")) {
+ int precision = -1;
+ if (_default_value.size() > 17) {
+ precision = std::atoi(_default_value.substr(18, 1).c_str());
+ } else {
+ precision = res_nested_type->get_scale();
+ }
+
+ switch (res_primitive_type) {
+ case TYPE_DATEV2:
+ RETURN_IF_ERROR(write_current_time_value<TYPE_DATEV2>(timestamp_ms, nano_seconds,
+ timezone_obj, precision));
+ break;
+ case TYPE_DATETIMEV2:
+ RETURN_IF_ERROR(write_current_time_value<TYPE_DATETIMEV2>(
+ timestamp_ms, nano_seconds, timezone_obj, precision));
+ break;
+ case TYPE_TIMESTAMPTZ:
+ RETURN_IF_ERROR(write_current_time_value<TYPE_TIMESTAMPTZ>(
+ timestamp_ms, nano_seconds, timezone_obj, precision));
+ break;
+ default:
+ return Status::FatalError(
+ "Unknown date type in DefaultExpr for CURRENT_DATE/TIMESTAMP");
+ }
+ } else {
+ auto temp_column = res_nested_type->create_column();
+ auto serde = res_nested_type->get_serde();
+ StringRef default_str_ref(_default_value.data(), _default_value.size());
+ DataTypeSerDe::FormatOptions options;
+ Status parse_status = serde->from_string(default_str_ref, *temp_column, options);
+
+ if (parse_status.ok() && temp_column->size() > 0) {
+ Field default_field;
+ temp_column->get(0, default_field);
+ _cached_column = _data_type->create_column_const(1, default_field);
+ } else [[unlikely]] {
+ return Status::FatalError("Failed to parse default value for column '{}'",
+ _children[0]->expr_name());
+ }
+ }
+ } else if (_is_nullable) {
+ _cached_column = _data_type->create_column_const(1, Field());
+ } else {
+ return Status::InvalidArgument("Column '{}' is NOT NULL but has no default value",
+ _children[0]->expr_name());
+ }
+
+ _open_finished = true;
+ return Status::OK();
+}
+
+const std::string& VDefaultExpr::expr_name() const {
+ return _expr_name;
+}
+
+std::string VDefaultExpr::debug_string() const {
+ std::stringstream out;
+ out << "DefaultExpr(slot_id=" << _slot_id << ", is_nullable=" << _is_nullable
Review Comment:
add the _default_value here. and its type if possible
##########
be/src/vec/exprs/vdefault_expr.cpp:
##########
@@ -0,0 +1,181 @@
+// 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.
+
+#include "vec/exprs/vdefault_expr.h"
+
+#include <cctz/time_zone.h>
+#include <fmt/format.h>
+
+#include "runtime/descriptors.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/block.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/exprs/vexpr_context.h"
+#include "vec/exprs/vslot_ref.h"
+#include "vec/runtime/timestamptz_value.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+
+Status VDefaultExpr::prepare(RuntimeState* state, const RowDescriptor& desc,
+ VExprContext* context) {
+ RETURN_IF_ERROR(VExpr::prepare(state, desc, context));
+ DCHECK_EQ(_children.size(), 1);
+
+ _expr_name = fmt::format("default({})", _children[0]->expr_name());
+
+ auto* slot_ref = dynamic_cast<VSlotRef*>(_children[0].get());
Review Comment:
oh, when will it be null?
##########
be/src/vec/exprs/vdefault_expr.cpp:
##########
@@ -0,0 +1,181 @@
+// 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.
+
+#include "vec/exprs/vdefault_expr.h"
+
+#include <cctz/time_zone.h>
+#include <fmt/format.h>
+
+#include "runtime/descriptors.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/block.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/exprs/vexpr_context.h"
+#include "vec/exprs/vslot_ref.h"
+#include "vec/runtime/timestamptz_value.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+
+Status VDefaultExpr::prepare(RuntimeState* state, const RowDescriptor& desc,
+ VExprContext* context) {
+ RETURN_IF_ERROR(VExpr::prepare(state, desc, context));
+ DCHECK_EQ(_children.size(), 1);
+
+ _expr_name = fmt::format("default({})", _children[0]->expr_name());
+
+ auto* slot_ref = dynamic_cast<VSlotRef*>(_children[0].get());
+ if (slot_ref != nullptr && slot_ref->slot_id() != -1) {
Review Comment:
when will this branch be false?
##########
be/src/vec/exprs/vdefault_expr.cpp:
##########
@@ -0,0 +1,181 @@
+// 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.
+
+#include "vec/exprs/vdefault_expr.h"
+
+#include <cctz/time_zone.h>
+#include <fmt/format.h>
+
+#include "runtime/descriptors.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/block.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/exprs/vexpr_context.h"
+#include "vec/exprs/vslot_ref.h"
+#include "vec/runtime/timestamptz_value.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+
+Status VDefaultExpr::prepare(RuntimeState* state, const RowDescriptor& desc,
+ VExprContext* context) {
+ RETURN_IF_ERROR(VExpr::prepare(state, desc, context));
+ DCHECK_EQ(_children.size(), 1);
+
+ _expr_name = fmt::format("default({})", _children[0]->expr_name());
+
+ auto* slot_ref = dynamic_cast<VSlotRef*>(_children[0].get());
Review Comment:
assert_cast
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3781905370
# FE Regression Coverage Report
Increment line coverage ` 83.33% (40/48)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_6e0eb6c4c2bbe2c6646128ac5907186c69e342ba_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_6e0eb6c4c2bbe2c6646128ac5907186c69e342ba_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3789960312
# FE Regression Coverage Report
Increment line coverage ` 83.02% (44/53)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_250ef6b99c1678f3b80b565c8d601f423dba7d9a_merge_fe/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_250ef6b99c1678f3b80b565c8d601f423dba7d9a_merge_fe/report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478732895
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3479309319
# BE Regression && UT Coverage Report
Increment line coverage `7.59% (11/145)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_8486a80731d5080fc2d9d882df740e70da5f908d_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_8486a80731d5080fc2d9d882df740e70da5f908d_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 57.25% (19281/33681) |
| Line Coverage | 42.60% (184337/432746) |
| Region Coverage | 37.09% (145583/392558) |
| Branch Coverage | 38.14% (62307/163343) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3469460641
# BE Regression && UT Coverage Report
Increment line coverage `90.07% (127/141)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_5ca6a29e47eda34b1a634fcd82b0dd56e81528eb_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 71.40% (24022/33644) |
| Line Coverage | 57.83% (249814/431981) |
| Region Coverage | 52.93% (207275/391625) |
| Branch Coverage | 54.57% (88991/163078) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3490858167
<details>
<summary>ClickBench: <b>Total hot run time: 27.99 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit e6c286ca24c9782154f78fe1ca84fd5450c4e463, data reload: false
query1 0.05 0.05 0.05
query2 0.09 0.05 0.05
query3 0.26 0.08 0.08
query4 1.61 0.12 0.12
query5 0.28 0.25 0.25
query6 1.15 0.65 0.63
query7 0.04 0.03 0.03
query8 0.06 0.04 0.04
query9 0.61 0.53 0.52
query10 0.58 0.58 0.58
query11 0.16 0.11 0.11
query12 0.15 0.12 0.12
query13 0.63 0.61 0.61
query14 1.00 1.00 1.02
query15 0.86 0.83 0.84
query16 0.39 0.39 0.43
query17 1.03 1.06 1.00
query18 0.22 0.20 0.20
query19 1.96 1.77 1.80
query20 0.01 0.01 0.02
query21 15.45 0.19 0.14
query22 5.13 0.07 0.04
query23 15.63 0.28 0.10
query24 3.13 1.17 0.87
query25 0.08 0.08 0.06
query26 0.15 0.13 0.13
query27 0.06 0.05 0.06
query28 5.01 1.13 0.93
query29 12.57 3.84 3.20
query30 0.29 0.13 0.11
query31 2.81 0.61 0.38
query32 3.23 0.56 0.47
query33 3.16 3.03 3.14
query34 15.86 5.16 4.66
query35 4.60 4.59 4.58
query36 0.68 0.50 0.50
query37 0.10 0.07 0.07
query38 0.06 0.05 0.04
query39 0.04 0.02 0.02
query40 0.17 0.15 0.13
query41 0.09 0.03 0.04
query42 0.04 0.03 0.03
query43 0.04 0.04 0.03
Total cold run time: 99.52 s
Total hot run time: 27.99 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3486278245
# BE Regression && UT Coverage Report
Increment line coverage `93.48% (129/138)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 71.21% (24014/33724) |
| Line Coverage | 57.61% (249559/433171) |
| Region Coverage | 52.61% (206746/392959) |
| Branch Coverage | 54.41% (88997/163555) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3488817025
run cloud_p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3489140996
# BE Regression && UT Coverage Report
Increment line coverage `93.48% (129/138)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 71.21% (24014/33724) |
| Line Coverage | 57.61% (249559/433171) |
| Region Coverage | 52.61% (206746/392959) |
| Branch Coverage | 54.41% (88997/163555) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478019630
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3485642851
<details>
<summary>TPC-DS: <b>Total hot run time: 186913 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit a49bcfe67d4a00dd59be8eace0dad7155d3c8528, data reload: false
query1 1083 420 397 397
query2 6550 1734 1763 1734
query3 6757 226 229 226
query4 26372 23790 23324 23324
query5 4664 636 449 449
query6 326 240 235 235
query7 4653 491 301 301
query8 304 246 248 246
query9 8707 2590 2602 2590
query10 535 334 286 286
query11 15941 15112 14870 14870
query12 191 120 112 112
query13 1702 558 422 422
query14 11186 9190 9206 9190
query15 199 189 169 169
query16 7518 677 502 502
query17 1227 755 627 627
query18 2021 422 330 330
query19 236 237 201 201
query20 140 130 134 130
query21 223 140 129 129
query22 4648 4661 4801 4661
query23 34901 33779 33807 33779
query24 8779 2502 2499 2499
query25 630 549 503 503
query26 1808 286 170 170
query27 3423 518 358 358
query28 4524 2258 2229 2229
query29 851 657 497 497
query30 322 247 205 205
query31 949 827 764 764
query32 86 67 81 67
query33 603 391 349 349
query34 834 867 525 525
query35 852 874 826 826
query36 1059 1070 961 961
query37 139 113 85 85
query38 3646 3613 3485 3485
query39 1502 1392 1406 1392
query40 220 126 117 117
query41 60 57 58 57
query42 118 108 114 108
query43 485 498 478 478
query44 1236 726 729 726
query45 178 181 172 172
query46 886 991 639 639
query47 1761 1809 1733 1733
query48 400 429 333 333
query49 752 490 412 412
query50 666 689 407 407
query51 3823 3836 3919 3836
query52 113 108 96 96
query53 251 264 193 193
query54 316 320 293 293
query55 94 94 83 83
query56 359 352 326 326
query57 1191 1197 1108 1108
query58 301 289 283 283
query59 2586 2898 2508 2508
query60 376 360 337 337
query61 190 187 174 174
query62 802 708 680 680
query63 226 186 189 186
query64 4496 1179 869 869
query65 4066 3932 3938 3932
query66 1108 436 324 324
query67 15503 14916 15044 14916
query68 5955 886 596 596
query69 485 330 284 284
query70 1455 1265 1236 1236
query71 452 342 313 313
query72 5814 2570 5512 2570
query73 732 767 360 360
query74 8978 9171 8642 8642
query75 3307 3267 2841 2841
query76 3300 1140 720 720
query77 496 397 311 311
query78 9444 9725 8805 8805
query79 1645 887 609 609
query80 701 573 495 495
query81 526 267 238 238
query82 237 161 134 134
query83 263 266 255 255
query84 260 123 89 89
query85 914 506 443 443
query86 369 301 305 301
query87 3735 3728 3623 3623
query88 2860 2262 2256 2256
query89 383 332 291 291
query90 1867 217 203 203
query91 158 162 148 148
query92 72 67 63 63
query93 1188 989 644 644
query94 673 449 327 327
query95 406 321 319 319
query96 485 560 282 282
query97 2886 2955 2866 2866
query98 235 215 212 212
query99 1334 1413 1286 1286
Total cold run time: 274269 ms
Total hot run time: 186913 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3776593472
<details>
<summary>TPC-H: <b>Total hot run time: 31407 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 6e0eb6c4c2bbe2c6646128ac5907186c69e342ba, data reload: false
------ Round 1 ----------------------------------
q1 17672 4194 4037 4037
q2 2109 351 250 250
q3 10094 1311 722 722
q4 10206 820 311 311
q5 7520 2117 1819 1819
q6 190 167 139 139
q7 927 792 662 662
q8 9276 1402 1124 1124
q9 5084 4602 4562 4562
q10 6848 1769 1419 1419
q11 523 306 290 290
q12 738 772 591 591
q13 17819 3845 3139 3139
q14 309 287 279 279
q15 585 516 510 510
q16 666 684 627 627
q17 673 797 481 481
q18 6743 6337 6366 6337
q19 1101 977 632 632
q20 389 359 246 246
q21 3059 2446 2263 2263
q22 1048 1018 967 967
Total cold run time: 103579 ms
Total hot run time: 31407 ms
----- Round 2, with runtime_filter_mode=off -----
q1 4096 4077 4027 4027
q2 332 397 320 320
q3 2140 2599 2203 2203
q4 1319 1776 1366 1366
q5 4108 3977 4070 3977
q6 205 172 136 136
q7 1893 1845 1689 1689
q8 2493 2352 2323 2323
q9 6719 6734 6659 6659
q10 2304 2545 2083 2083
q11 546 470 439 439
q12 670 725 558 558
q13 3305 3794 3097 3097
q14 276 287 265 265
q15 548 515 490 490
q16 617 660 613 613
q17 1106 1202 1290 1202
q18 7349 7357 7060 7060
q19 819 788 801 788
q20 1875 1974 1786 1786
q21 4555 4487 4074 4074
q22 1070 1027 990 990
Total cold run time: 48345 ms
Total hot run time: 46145 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "924060929 (via GitHub)" <gi...@apache.org>.
924060929 commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2715774918
##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -1617,6 +1617,7 @@ primaryExpression
| CASE value=expression whenClause+ (ELSE elseExpression=expression)? END #simpleCase
| name=CAST LEFT_PAREN expression AS castDataType RIGHT_PAREN #cast
| name=TRY_CAST LEFT_PAREN expression AS castDataType RIGHT_PAREN #tryCast
+ | DEFAULT LEFT_PAREN expression RIGHT_PAREN #defaultValue
Review Comment:
should be `DEFAULT LEFT_PAREN qualifiedName RIGHT_PAREN` because you only support get default value from a column
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3486019769
# BE UT Coverage Report
Increment line coverage `10.64% (15/141)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/a49bcfe67d4a00dd59be8eace0dad7155d3c8528_a49bcfe67d4a00dd59be8eace0dad7155d3c8528/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/a49bcfe67d4a00dd59be8eace0dad7155d3c8528_a49bcfe67d4a00dd59be8eace0dad7155d3c8528/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 52.72% (18086/34305) |
| Line Coverage | 38.04% (164490/432428) |
| Region Coverage | 32.36% (125363/387365) |
| Branch Coverage | 33.79% (54898/162446) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478869572
<details>
<summary>TPC-DS: <b>Total hot run time: 189481 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 8486a80731d5080fc2d9d882df740e70da5f908d, data reload: false
query1 1045 412 397 397
query2 6560 1723 1724 1723
query3 6759 225 222 222
query4 26627 23325 23023 23023
query5 4646 632 458 458
query6 353 251 240 240
query7 4645 501 310 310
query8 325 269 252 252
query9 8763 2606 2624 2606
query10 511 343 309 309
query11 15814 15285 15660 15285
query12 207 139 126 126
query13 1802 594 499 499
query14 12945 9498 9810 9498
query15 299 191 181 181
query16 8101 709 563 563
query17 1971 839 663 663
query18 2929 462 342 342
query19 287 215 192 192
query20 140 131 136 131
query21 215 148 131 131
query22 4534 4820 4571 4571
query23 35070 33897 33488 33488
query24 8161 2461 2521 2461
query25 585 525 487 487
query26 1230 272 159 159
query27 2705 500 381 381
query28 4294 2173 2173 2173
query29 775 605 474 474
query30 295 219 187 187
query31 908 801 737 737
query32 80 70 62 62
query33 590 367 325 325
query34 771 866 506 506
query35 784 836 763 763
query36 960 992 911 911
query37 120 106 82 82
query38 3569 3537 3417 3417
query39 1463 1419 1402 1402
query40 214 129 113 113
query41 57 57 55 55
query42 118 112 107 107
query43 464 486 459 459
query44 1212 763 734 734
query45 184 175 174 174
query46 880 1077 642 642
query47 1754 1791 1676 1676
query48 389 418 316 316
query49 759 494 414 414
query50 634 681 403 403
query51 3922 3922 3887 3887
query52 111 108 100 100
query53 230 267 196 196
query54 304 290 273 273
query55 83 81 83 81
query56 326 308 315 308
query57 1166 1205 1120 1120
query58 287 273 262 262
query59 2542 2714 2612 2612
query60 342 363 319 319
query61 166 151 153 151
query62 813 756 644 644
query63 222 201 190 190
query64 4427 1161 845 845
query65 4018 3968 3932 3932
query66 1086 420 330 330
query67 15495 15035 15000 15000
query68 9225 890 591 591
query69 471 318 288 288
query70 1350 1313 1236 1236
query71 474 327 321 321
query72 5836 4912 4921 4912
query73 557 580 360 360
query74 8872 9008 8719 8719
query75 4296 3342 2790 2790
query76 3834 1216 727 727
query77 926 391 319 319
query78 9690 9832 8934 8934
query79 2004 824 605 605
query80 681 576 511 511
query81 486 260 224 224
query82 435 164 132 132
query83 308 263 248 248
query84 295 123 102 102
query85 896 480 430 430
query86 329 314 296 296
query87 3756 3766 3691 3691
query88 3070 2290 2270 2270
query89 397 330 291 291
query90 1970 219 217 217
query91 167 163 134 134
query92 87 69 70 69
query93 1166 958 647 647
query94 697 431 319 319
query95 411 319 317 317
query96 498 567 282 282
query97 2952 2988 2894 2894
query98 240 231 217 217
query99 1443 1391 1308 1308
Total cold run time: 281862 ms
Total hot run time: 189481 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3490571539
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478739056
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3479054778
# BE UT Coverage Report
Increment line coverage `9.46% (14/148)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/8486a80731d5080fc2d9d882df740e70da5f908d_8486a80731d5080fc2d9d882df740e70da5f908d/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/8486a80731d5080fc2d9d882df740e70da5f908d_8486a80731d5080fc2d9d882df740e70da5f908d/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 52.68% (18050/34261) |
| Line Coverage | 37.98% (164063/431996) |
| Region Coverage | 32.32% (125067/386962) |
| Branch Coverage | 33.73% (54723/162232) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3748781196
<details>
<summary>TPC-DS: <b>Total hot run time: 172970 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 81065d6eded0251e8b72becfc029bd018ed6e937, data reload: false
query5 4408 609 489 489
query6 341 219 204 204
query7 4208 465 259 259
query8 326 228 232 228
query9 8682 2856 2852 2852
query10 489 349 322 322
query11 15196 15031 14782 14782
query12 168 116 110 110
query13 1248 475 349 349
query14 5525 2975 2725 2725
query14_1 2646 2633 2630 2630
query15 209 191 171 171
query16 987 511 488 488
query17 1048 671 558 558
query18 2435 433 334 334
query19 229 219 197 197
query20 119 119 113 113
query21 219 145 120 120
query22 3945 4029 3944 3944
query23 15960 15583 15269 15269
query23_1 15325 15517 15488 15488
query24 7103 1547 1174 1174
query24_1 1181 1146 1158 1146
query25 567 467 413 413
query26 1237 261 188 188
query27 2737 443 253 253
query28 4621 2151 2136 2136
query29 722 519 407 407
query30 303 235 212 212
query31 803 626 538 538
query32 80 73 71 71
query33 516 335 282 282
query34 892 880 508 508
query35 720 744 664 664
query36 892 922 864 864
query37 129 94 80 80
query38 2754 2752 2614 2614
query39 765 778 728 728
query39_1 711 706 708 706
query40 213 134 120 120
query41 66 66 60 60
query42 100 99 99 99
query43 433 466 402 402
query44 1300 728 729 728
query45 186 179 173 173
query46 822 932 562 562
query47 1436 1486 1353 1353
query48 289 304 225 225
query49 619 417 328 328
query50 609 266 215 215
query51 3858 3752 3837 3752
query52 103 108 93 93
query53 285 317 275 275
query54 282 296 257 257
query55 81 80 76 76
query56 323 314 301 301
query57 995 1038 933 933
query58 262 256 257 256
query59 2090 2235 2109 2109
query60 340 327 311 311
query61 159 161 154 154
query62 389 366 313 313
query63 311 260 256 256
query64 4935 1279 976 976
query65 3838 3675 3723 3675
query66 1460 412 322 322
query67 14688 15365 15450 15365
query68 2745 994 723 723
query69 517 355 312 312
query70 1001 908 862 862
query71 324 304 283 283
query72 5681 3666 3682 3666
query73 590 729 299 299
query74 8828 8739 8500 8500
query75 2765 2842 2454 2454
query76 2375 1053 685 685
query77 376 361 298 298
query78 9803 9895 9128 9128
query79 1028 885 563 563
query80 1283 580 485 485
query81 552 260 226 226
query82 1005 143 109 109
query83 369 253 241 241
query84 267 108 101 101
query85 935 508 441 441
query86 416 335 324 324
query87 2860 2853 2821 2821
query88 2955 2129 2124 2124
query89 383 360 322 322
query90 1950 164 165 164
query91 183 163 146 146
query92 78 74 70 70
query93 1055 903 516 516
query94 647 319 293 293
query95 604 327 359 327
query96 554 477 192 192
query97 2347 2382 2352 2352
query98 210 203 197 197
query99 639 616 518 518
Total cold run time: 245285 ms
Total hot run time: 172970 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3754881293
# BE Regression && UT Coverage Report
Increment line coverage `5.26% (7/133)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_81065d6eded0251e8b72becfc029bd018ed6e937_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 61.06% (21444/35119) |
| Line Coverage | 47.33% (213113/450232) |
| Region Coverage | 42.45% (174015/409908) |
| Branch Coverage | 43.08% (73594/170821) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3781448052
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3776758481
# FE UT Coverage Report
Increment line coverage ` 14.58% (7/48)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_6e0eb6c4c2bbe2c6646128ac5907186c69e342ba/fe_increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_6e0eb6c4c2bbe2c6646128ac5907186c69e342ba/fe_report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3789357112
<details>
<summary>TPC-DS: <b>Total hot run time: 172507 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 250ef6b99c1678f3b80b565c8d601f423dba7d9a, data reload: false
query5 4404 656 487 487
query6 310 217 196 196
query7 4217 450 255 255
query8 337 243 230 230
query9 8701 2832 2856 2832
query10 438 309 284 284
query11 15193 15226 14832 14832
query12 185 121 117 117
query13 1248 464 378 378
query14 6232 2963 2752 2752
query14_1 2672 2775 2638 2638
query15 198 188 170 170
query16 964 485 456 456
query17 1088 686 574 574
query18 2450 438 333 333
query19 204 182 157 157
query20 123 117 113 113
query21 215 139 124 124
query22 4169 4217 4052 4052
query23 15978 15533 15453 15453
query23_1 15638 15450 15600 15450
query24 7134 1548 1164 1164
query24_1 1157 1174 1170 1170
query25 532 460 413 413
query26 1243 272 154 154
query27 2767 464 276 276
query28 4507 2150 2178 2150
query29 803 541 447 447
query30 309 241 201 201
query31 805 636 564 564
query32 88 76 78 76
query33 538 376 312 312
query34 909 881 530 530
query35 723 756 675 675
query36 823 877 817 817
query37 138 102 89 89
query38 2697 2679 2720 2679
query39 782 733 761 733
query39_1 711 717 703 703
query40 221 137 122 122
query41 74 67 66 66
query42 99 95 94 94
query43 435 445 406 406
query44 1311 745 746 745
query45 188 185 178 178
query46 824 947 607 607
query47 1401 1471 1380 1380
query48 303 319 241 241
query49 597 432 340 340
query50 690 275 199 199
query51 3805 3746 3692 3692
query52 90 90 84 84
query53 206 210 165 165
query54 272 259 244 244
query55 79 84 75 75
query56 302 294 287 287
query57 1092 1044 957 957
query58 270 262 270 262
query59 2039 2074 2037 2037
query60 330 332 313 313
query61 155 148 146 146
query62 390 361 314 314
query63 191 155 166 155
query64 4946 1181 843 843
query65 3837 3647 3768 3647
query66 1455 426 318 318
query67 15531 15546 15418 15418
query68 2497 1061 731 731
query69 385 311 270 270
query70 997 912 954 912
query71 306 292 276 276
query72 5295 3174 3229 3174
query73 601 727 326 326
query74 8762 8733 8606 8606
query75 2314 2294 1917 1917
query76 2266 1046 641 641
query77 361 395 296 296
query78 9647 9797 9115 9115
query79 2536 889 602 602
query80 1745 530 435 435
query81 541 262 235 235
query82 1016 152 118 118
query83 324 262 244 244
query84 256 117 101 101
query85 872 462 418 418
query86 412 293 288 288
query87 2875 2866 2793 2793
query88 3526 2587 2570 2570
query89 312 248 240 240
query90 2011 178 166 166
query91 167 157 132 132
query92 76 70 68 68
query93 1226 1022 638 638
query94 638 327 279 279
query95 594 336 379 336
query96 640 512 231 231
query97 2381 2387 2324 2324
query98 232 200 197 197
query99 607 565 478 478
Total cold run time: 248054 ms
Total hot run time: 172507 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2483819173
##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -1976,6 +1974,7 @@ nonReserved
| DECIMAL
| DECIMALV2
| DECIMALV3
+ | DEFAULT
Review Comment:
should keep `default` reserved
##########
regression-test/suites/nereids_p0/sql_functions/test_default.groovy:
##########
Review Comment:
test for:
1. empty table
2. e, pi, current_... (not literal values)
##########
regression-test/suites/nereids_p0/sql_functions/test_default.groovy:
##########
Review Comment:
3. agg table
##########
be/src/vec/functions/function_default.cpp:
##########
@@ -0,0 +1,218 @@
+// 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.
+
+#include <mysql/binary_log_types.h>
+
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "runtime/descriptors.h"
+#include "runtime/primitive_type.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/column_with_type_and_name.h"
+#include "vec/data_types/data_type_nullable.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
+class FunctionDefault : public IFunction {
+public:
+ static constexpr auto name = "default";
+ static FunctionPtr create() { return std::make_shared<FunctionDefault>(); }
+ String get_name() const override { return name; }
+ size_t get_number_of_arguments() const override { return 1; }
+
+ DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+ return make_nullable(arguments[0]);
+ }
+
+ bool use_default_implementation_for_nulls() const override { return false; }
+
+ Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
+ uint32_t result, size_t input_rows_count) const override {
+ ColumnWithTypeAndName& result_info = block.get_by_position(result);
+ auto res_nested_type = remove_nullable(result_info.type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ ColumnWithTypeAndName& input_column_info = block.get_by_position(arguments[0]);
+ const std::string& col_name = input_column_info.name;
+
+ std::string default_value;
+ bool has_default_value = false;
+ bool is_nullable = true;
+ get_default_value_and_nullable_for_col(context, col_name, default_value, has_default_value,
+ is_nullable);
+
+ // For date types, if the default value is `CURRENT_TIMESTAMP` or `CURRENT_DATE`.
+ // Reference the behavior in MySQL:
+ // if column is NULLABLE, return all NULLs
+ // else return zero datetime values like `0000-00-00 00:00:00` or `0000-00-00`
+ if (is_date_type(res_primitive_type) && has_default_value &&
+ (default_value == "CURRENT_TIMESTAMP" || default_value == "CURRENT_DATE")) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return return_with_zero_datetime(block, result, res_nested_type, res_primitive_type,
+ input_rows_count);
+ }
+ }
+
+ // For some complex types, only accept NULL as default value
+ if (is_complex_type(res_primitive_type) || res_primitive_type == TYPE_JSONB ||
+ res_primitive_type == TYPE_VARIANT) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return Status::InvalidArgument(
+ "Column '{}' of type '{}' must be nullable to use DEFAULT", col_name,
+ res_nested_type->get_name());
+ }
+ }
+
+ // 1. specified default value when creating table -> default_value
+ // 2. no specified default value && column is NOT NULL -> error
+ // 3. no specified default value && column is NULLABLE -> NULL
+ if (has_default_value) {
+ MutableColumnPtr res_col = res_nested_type->create_column();
+ auto null_map = ColumnUInt8::create(input_rows_count, 0);
+ Field default_field;
+
+ auto temp_column = res_nested_type->create_column();
+ auto serde = res_nested_type->get_serde();
+ StringRef default_str_ref(default_value.data(), default_value.size());
+ DataTypeSerDe::FormatOptions options;
+ Status parse_status = serde->from_string(default_str_ref, *temp_column, options);
+
+ if (parse_status.ok() && temp_column->size() > 0) {
+ temp_column->get(0, default_field);
+ }
+
+ for (size_t i = 0; i < input_rows_count; ++i) {
+ res_col->insert(default_field);
Review Comment:
could make `res_col` always a const column?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478095212
<details>
<summary>ClickBench: <b>Total hot run time: 28.79 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 0ab8fbc78ea338f6e31bf84ddb9b74febb63a34a, data reload: false
query1 0.06 0.06 0.05
query2 0.10 0.05 0.05
query3 0.26 0.08 0.09
query4 1.61 0.13 0.12
query5 0.30 0.28 0.27
query6 1.18 0.68 0.69
query7 0.03 0.03 0.03
query8 0.06 0.04 0.04
query9 0.64 0.58 0.55
query10 0.62 0.62 0.62
query11 0.19 0.13 0.13
query12 0.18 0.14 0.13
query13 0.64 0.62 0.62
query14 1.04 1.04 1.03
query15 0.89 0.86 0.87
query16 0.43 0.41 0.41
query17 1.17 1.12 1.21
query18 0.23 0.22 0.23
query19 2.02 1.87 1.91
query20 0.01 0.01 0.02
query21 15.35 0.21 0.14
query22 5.00 0.08 0.05
query23 15.68 0.30 0.12
query24 2.67 0.76 0.30
query25 0.10 0.07 0.06
query26 0.16 0.15 0.16
query27 0.08 0.06 0.06
query28 4.20 1.19 0.96
query29 12.61 4.53 3.70
query30 0.28 0.15 0.14
query31 2.82 0.68 0.42
query32 3.24 0.59 0.48
query33 3.15 3.16 3.18
query34 16.04 5.23 4.58
query35 4.61 4.66 4.64
query36 0.72 0.54 0.56
query37 0.11 0.07 0.08
query38 0.07 0.05 0.05
query39 0.04 0.04 0.03
query40 0.19 0.16 0.14
query41 0.10 0.04 0.03
query42 0.05 0.04 0.04
query43 0.05 0.04 0.04
Total cold run time: 98.98 s
Total hot run time: 28.79 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3478876281
<details>
<summary>ClickBench: <b>Total hot run time: 27.5 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 8486a80731d5080fc2d9d882df740e70da5f908d, data reload: false
query1 0.06 0.05 0.05
query2 0.09 0.05 0.05
query3 0.26 0.08 0.08
query4 1.61 0.12 0.11
query5 0.28 0.25 0.26
query6 1.16 0.65 0.64
query7 0.03 0.03 0.03
query8 0.06 0.04 0.05
query9 0.59 0.55 0.51
query10 0.60 0.58 0.57
query11 0.16 0.11 0.11
query12 0.15 0.12 0.11
query13 0.62 0.61 0.61
query14 1.02 1.00 0.99
query15 0.85 0.84 0.84
query16 0.41 0.38 0.40
query17 1.06 1.05 1.02
query18 0.22 0.20 0.20
query19 1.90 1.80 1.83
query20 0.02 0.02 0.01
query21 15.45 0.18 0.14
query22 5.11 0.06 0.05
query23 15.64 0.26 0.10
query24 2.69 0.45 0.70
query25 0.07 0.06 0.06
query26 0.14 0.12 0.12
query27 0.06 0.06 0.06
query28 4.30 1.14 0.93
query29 12.59 3.91 3.20
query30 0.28 0.13 0.12
query31 2.81 0.59 0.39
query32 3.23 0.55 0.47
query33 3.01 3.06 3.13
query34 15.87 5.15 4.53
query35 4.54 4.59 4.59
query36 0.68 0.51 0.48
query37 0.10 0.06 0.07
query38 0.06 0.04 0.04
query39 0.04 0.03 0.03
query40 0.17 0.15 0.13
query41 0.08 0.03 0.03
query42 0.04 0.03 0.03
query43 0.05 0.04 0.03
Total cold run time: 98.16 s
Total hot run time: 27.5 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3479053759
run cloud_p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3743549799
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3743867127
# Cloud UT Coverage Report
Increment line coverage ` ` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/5200cc48a75c77791b983bfdf0abe660621e30a1_5200cc48a75c77791b983bfdf0abe660621e30a1_cloud/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/5200cc48a75c77791b983bfdf0abe660621e30a1_5200cc48a75c77791b983bfdf0abe660621e30a1_cloud/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 79.57% (1784/2242) |
| Line Coverage | 64.76% (31732/48997) |
| Region Coverage | 65.43% (15782/24120) |
| Branch Coverage | 55.99% (8381/14968) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3744154679
# FE UT Coverage Report
Increment line coverage ` 26.67% (8/30)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_5200cc48a75c77791b983bfdf0abe660621e30a1/fe_increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_5200cc48a75c77791b983bfdf0abe660621e30a1/fe_report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "linrrzqqq (via GitHub)" <gi...@apache.org>.
linrrzqqq commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3489547927
run nonConcurrent
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3490836097
<details>
<summary>TPC-DS: <b>Total hot run time: 190712 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit e6c286ca24c9782154f78fe1ca84fd5450c4e463, data reload: false
query1 1057 424 399 399
query2 6548 1755 1674 1674
query3 6756 220 228 220
query4 26642 23939 23897 23897
query5 4827 630 483 483
query6 348 247 235 235
query7 4669 493 312 312
query8 312 259 259 259
query9 8744 2612 2618 2612
query10 507 340 317 317
query11 15243 15334 14947 14947
query12 189 123 118 118
query13 1700 566 446 446
query14 11085 9305 9317 9305
query15 203 194 178 178
query16 7715 701 526 526
query17 1216 786 643 643
query18 2065 453 379 379
query19 258 253 189 189
query20 139 134 145 134
query21 257 142 134 134
query22 4713 4728 4546 4546
query23 34619 34035 34061 34035
query24 8838 2491 2513 2491
query25 604 554 486 486
query26 2151 287 161 161
query27 2800 543 365 365
query28 4445 2246 2242 2242
query29 870 644 536 536
query30 396 236 197 197
query31 962 858 782 782
query32 89 71 79 71
query33 635 395 327 327
query34 829 894 532 532
query35 818 846 780 780
query36 972 1036 927 927
query37 132 116 94 94
query38 3743 3628 3662 3628
query39 1527 1416 1416 1416
query40 217 125 115 115
query41 62 57 57 57
query42 118 112 118 112
query43 481 488 464 464
query44 1228 756 726 726
query45 188 180 184 180
query46 893 986 639 639
query47 1796 1842 1717 1717
query48 389 424 304 304
query49 784 484 394 394
query50 648 685 406 406
query51 3937 3920 3828 3828
query52 107 101 97 97
query53 235 261 193 193
query54 316 296 268 268
query55 85 83 82 82
query56 301 310 304 304
query57 1156 1213 1101 1101
query58 288 277 267 267
query59 2573 2737 2558 2558
query60 360 335 325 325
query61 156 148 158 148
query62 831 721 674 674
query63 225 196 192 192
query64 4494 1160 842 842
query65 4051 3942 3965 3942
query66 1100 424 323 323
query67 15583 15107 14982 14982
query68 8586 882 586 586
query69 482 318 290 290
query70 1312 1213 1282 1213
query71 509 346 320 320
query72 5788 4887 4883 4883
query73 702 558 354 354
query74 9162 9016 8745 8745
query75 4055 3378 2863 2863
query76 3821 1153 741 741
query77 824 406 321 321
query78 9566 9611 9023 9023
query79 2324 853 605 605
query80 648 553 504 504
query81 503 257 238 238
query82 448 154 129 129
query83 284 260 252 252
query84 302 115 100 100
query85 907 491 431 431
query86 350 301 311 301
query87 3764 3739 3645 3645
query88 3369 2263 2270 2263
query89 388 317 290 290
query90 1982 219 217 217
query91 178 164 135 135
query92 90 70 63 63
query93 1254 958 641 641
query94 698 447 340 340
query95 406 323 306 306
query96 487 587 294 294
query97 2960 2967 2887 2887
query98 236 208 213 208
query99 1450 1408 1261 1261
Total cold run time: 280060 ms
Total hot run time: 190712 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3490770484
# FE UT Coverage Report
Increment line coverage ` 5.88% (1/17)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_e6c286ca24c9782154f78fe1ca84fd5450c4e463/fe_increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_e6c286ca24c9782154f78fe1ca84fd5450c4e463/fe_report/index.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3491222594
# BE UT Coverage Report
Increment line coverage `14.48% (21/145)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/e6c286ca24c9782154f78fe1ca84fd5450c4e463_e6c286ca24c9782154f78fe1ca84fd5450c4e463/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/e6c286ca24c9782154f78fe1ca84fd5450c4e463_e6c286ca24c9782154f78fe1ca84fd5450c4e463/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 52.78% (18200/34483) |
| Line Coverage | 38.23% (165930/434035) |
| Region Coverage | 33.25% (129185/388561) |
| Branch Coverage | 34.02% (55524/163210) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2493220429
##########
be/src/vec/exprs/vectorized_fn_call.cpp:
##########
@@ -154,6 +155,22 @@ Status VectorizedFnCall::prepare(RuntimeState* state, const RowDescriptor& desc,
_prepare_finished = true;
FunctionContext* fn_ctx = context->fn_context(_fn_context_index);
+ if (_function_name == "default" && !_children.empty()) {
Review Comment:
add a new virtual function and call
##########
be/src/vec/functions/function_default.cpp:
##########
@@ -0,0 +1,198 @@
+// 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.
+
+#include "vec/functions/function_default.h"
+
+#include <mysql/binary_log_types.h>
+
+#include <string>
+
+#include "common/status.h"
+#include "runtime/define_primitive_type.h"
+#include "runtime/descriptors.h"
+#include "runtime/primitive_type.h"
+#include "runtime/runtime_state.h"
+#include "util/binary_cast.hpp"
+#include "vec/columns/column_const.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/core/column_with_type_and_name.h"
+#include "vec/data_types/data_type_nullable.h"
+#include "vec/data_types/serde/data_type_serde.h"
+#include "vec/functions/function.h"
+#include "vec/functions/simple_function_factory.h"
+#include "vec/runtime/vdatetime_value.h"
+
+namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
+class FunctionDefault : public IFunction {
+public:
+ static constexpr auto name = "default";
+ static FunctionPtr create() { return std::make_shared<FunctionDefault>(); }
+ String get_name() const override { return name; }
+ size_t get_number_of_arguments() const override { return 1; }
+
+ DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
+ return make_nullable(arguments[0]);
+ }
+
+ bool use_default_implementation_for_nulls() const override { return false; }
+
+ Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
+ uint32_t result, size_t input_rows_count) const override {
+ ColumnWithTypeAndName& result_info = block.get_by_position(result);
+ auto res_nested_type = remove_nullable(result_info.type);
+ PrimitiveType res_primitive_type = res_nested_type->get_primitive_type();
+
+ ColumnWithTypeAndName& input_column_info = block.get_by_position(arguments[0]);
+ const std::string& col_name = input_column_info.name;
+
+ std::string default_value;
+ bool has_default_value = false;
+ bool is_nullable = true;
+ const auto* slot_state = static_cast<const DefaultFunctionState*>(
+ context->get_function_state(FunctionContext::FRAGMENT_LOCAL));
+ if (slot_state != nullptr && slot_state->slot_id != -1) {
+ default_value = slot_state->default_value;
+ has_default_value = slot_state->has_default_value;
+ is_nullable = slot_state->is_nullable;
+ }
+
+ // For date types, if the default value is `CURRENT_TIMESTAMP` or `CURRENT_DATE`.
+ // Reference the behavior in MySQL:
+ // if column is NULLABLE, return all NULLs
+ // else return zero datetime values like `0000-00-00 00:00:00` or `0000-00-00`
+ // Because Doris has a range limit for date & datetime, `0000-00-00` cannot be represented.
+ // So here we use the smallest representable value instead
+ if (is_date_type(res_primitive_type) && has_default_value &&
+ (default_value == "CURRENT_TIMESTAMP" || default_value == "CURRENT_DATE")) {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return return_with_zero_datetime(block, result, res_nested_type, res_primitive_type,
+ input_rows_count);
+ }
+ }
+
+ // Agg state(HLL, BITMAPA, QUANTILE_STATE) error only
+ if (is_var_len_object(res_primitive_type)) {
+ return Status::InvalidArgument(
+ "Agg type(HLL, BITMAP, QUANTILE_STATE) cannot be used for the DEFAULT "
+ "function");
+ }
+
+ // 1. specified default value when creating table -> default_value
+ // 2. no specified default value && column is NOT NULL -> error
+ // 3. no specified default value && column is NULLABLE -> NULL
+ if (has_default_value) {
+ MutableColumnPtr res_col = res_nested_type->create_column();
+ auto null_map = ColumnUInt8::create(input_rows_count, 0);
+ Field default_field;
+
+ auto temp_column = res_nested_type->create_column();
+ auto serde = res_nested_type->get_serde();
+ StringRef default_str_ref(default_value.data(), default_value.size());
+ DataTypeSerDe::FormatOptions options;
+ Status parse_status = serde->from_string(default_str_ref, *temp_column, options);
+
+ if (parse_status.ok() && temp_column->size() > 0) {
+ temp_column->get(0, default_field);
+ res_col->insert(default_field);
+ block.replace_by_position(
+ result, ColumnNullable::create(
+ ColumnConst::create(std::move(res_col), input_rows_count),
+ std::move(null_map)));
+ } else [[unlikely]] {
+ return Status::FatalError("Failed to parse default value for column '{}'",
+ col_name);
+ }
+ } else {
+ if (is_nullable) {
+ return return_with_all_null(block, result, res_nested_type, input_rows_count);
+ } else {
+ return Status::InvalidArgument("Column '{}' is NOT NULL but has no default value",
+ col_name);
+ }
+ }
+ return Status::OK();
+ }
+
+private:
+ static Status return_with_all_null(Block& block, uint32_t result,
+ const DataTypePtr& nested_type, size_t input_rows_count) {
+ MutableColumnPtr res_col = nested_type->create_column();
+ res_col->insert_default();
+ auto null_map = ColumnUInt8::create(input_rows_count, 1);
+ block.replace_by_position(
+ result,
+ ColumnNullable::create(ColumnConst::create(std::move(res_col), input_rows_count),
+ std::move(null_map)));
+ return Status::OK();
+ }
+
+ static Status return_with_zero_datetime(Block& block, uint32_t result,
+ const DataTypePtr& nested_type,
+ PrimitiveType primitive_type, size_t input_rows_count) {
+ MutableColumnPtr res_col = nested_type->create_column();
+
+ switch (primitive_type) {
+ case TYPE_DATE:
Review Comment:
not support all V1 anymore
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3489176944
# BE Regression && UT Coverage Report
Increment line coverage `93.48% (129/138)` :tada:
[Increment coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/increment_report/index.html)
[Complete coverage report](http://coverage.selectdb-in.cc/coverage/57531_a49bcfe67d4a00dd59be8eace0dad7155d3c8528_merge/report/index.html)
| Category | Coverage |
|-------------------|--------------------|
| Function Coverage | 71.49% (24109/33724) |
| Line Coverage | 57.92% (250882/433171) |
| Region Coverage | 52.98% (208202/392959) |
| Branch Coverage | 54.73% (89508/163555) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3789215073
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3789299277
<details>
<summary>TPC-H: <b>Total hot run time: 30813 ms</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 250ef6b99c1678f3b80b565c8d601f423dba7d9a, data reload: false
------ Round 1 ----------------------------------
q1 17711 4773 4569 4569
q2 2005 321 202 202
q3 10271 1309 726 726
q4 10217 863 311 311
q5 7553 2052 1841 1841
q6 183 169 141 141
q7 860 712 584 584
q8 9260 1384 1072 1072
q9 4907 4605 4667 4605
q10 6801 1643 1259 1259
q11 538 301 284 284
q12 341 377 225 225
q13 17785 3826 3097 3097
q14 241 245 216 216
q15 608 521 528 521
q16 633 624 577 577
q17 652 774 529 529
q18 6521 6342 6321 6321
q19 1100 980 626 626
q20 402 353 238 238
q21 2680 1927 1962 1927
q22 1065 985 942 942
Total cold run time: 102334 ms
Total hot run time: 30813 ms
----- Round 2, with runtime_filter_mode=off -----
q1 4715 4737 4672 4672
q2 307 398 315 315
q3 2138 2658 2240 2240
q4 1323 1769 1280 1280
q5 4112 3994 4107 3994
q6 217 175 133 133
q7 1939 1944 1762 1762
q8 2899 2546 2646 2546
q9 7350 7257 7091 7091
q10 2470 2730 2268 2268
q11 574 500 460 460
q12 727 733 646 646
q13 3640 4103 3429 3429
q14 288 313 275 275
q15 555 513 508 508
q16 643 680 662 662
q17 1173 1346 1406 1346
q18 8204 7585 7773 7585
q19 939 827 867 827
q20 1967 2124 1970 1970
q21 4678 4249 4100 4100
q22 1071 997 991 991
Total cold run time: 51929 ms
Total hot run time: 49100 ms
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #57531:
URL: https://github.com/apache/doris/pull/57531#issuecomment-3789380870
<details>
<summary>ClickBench: <b>Total hot run time: 26.69 s</b></summary>
```
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 250ef6b99c1678f3b80b565c8d601f423dba7d9a, data reload: false
query1 0.05 0.05 0.05
query2 0.10 0.04 0.05
query3 0.26 0.08 0.08
query4 1.61 0.11 0.11
query5 0.27 0.25 0.25
query6 1.14 0.64 0.66
query7 0.04 0.03 0.02
query8 0.05 0.04 0.04
query9 0.57 0.51 0.50
query10 0.56 0.54 0.55
query11 0.15 0.10 0.11
query12 0.15 0.11 0.11
query13 0.61 0.58 0.60
query14 0.97 0.96 0.93
query15 0.80 0.78 0.79
query16 0.41 0.39 0.39
query17 0.98 1.06 1.01
query18 0.24 0.22 0.22
query19 1.88 1.77 1.82
query20 0.02 0.01 0.01
query21 15.43 0.28 0.13
query22 5.34 0.05 0.04
query23 16.17 0.29 0.10
query24 0.92 0.23 0.60
query25 0.09 0.07 0.10
query26 0.15 0.13 0.14
query27 0.09 0.08 0.05
query28 4.17 1.09 0.89
query29 12.53 3.94 3.14
query30 0.27 0.14 0.11
query31 2.81 0.64 0.39
query32 3.25 0.55 0.46
query33 3.04 3.01 3.00
query34 15.80 5.09 4.47
query35 4.50 4.45 4.46
query36 0.65 0.50 0.50
query37 0.10 0.07 0.06
query38 0.08 0.04 0.04
query39 0.04 0.03 0.03
query40 0.16 0.14 0.13
query41 0.10 0.03 0.03
query42 0.05 0.03 0.03
query43 0.05 0.04 0.04
Total cold run time: 96.65 s
Total hot run time: 26.69 s
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [Feature](function) Support function DEFAULT [doris]
Posted by "zclllyybb (via GitHub)" <gi...@apache.org>.
zclllyybb commented on code in PR #57531:
URL: https://github.com/apache/doris/pull/57531#discussion_r2715379691
##########
regression-test/suites/nereids_p0/expression/test_default_expr.groovy:
##########
Review Comment:
测一下调整各种常量折叠参数,例如打开BE折叠,还能正常执行。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org