Mryange opened a new pull request, #60643:
URL: https://github.com/apache/doris/pull/60643
### What problem does this PR solve?
The implementation of width_bucket requires the fourth argument to be
constant but did not enforce this; a regular column can be passed in, however
width_bucket will only use the first row.
before
```sql
mysql> SELECT k1, v1, v2, v3, width_bucket(v1, date('2023-11-18'),
date('2027-11-18'), v4) AS w FROM width_bucket_test ORDER BY k1;
+------+------------+-----------+--------+------+
| k1 | v1 | v2 | v3 | w |
+------+------------+-----------+--------+------+
| 1 | 2022-11-18 | 290000 | 290000 | 0 |
| 2 | 2023-11-18 | 320000 | 320000 | 1 |
| 3 | 2024-11-18 | 399999.99 | 399999 | 1 |
| 4 | 2025-11-18 | 400000 | 400000 | 1 |
| 5 | 2026-11-18 | 470000 | 470000 | 1 |
| 6 | 2027-11-18 | 510000 | 510000 | 2 |
| 7 | 2028-11-18 | 610000 | 610000 | 2 |
| 8 | NULL | NULL | NULL | NULL |
+------+------------+-----------+--------+------+
```
now
```sql
mysql> SELECT k1, v1, v2, v3, width_bucket(v1, date('2023-11-18'),
date('2027-11-18'), v4) AS w FROM width_bucket_test ORDER BY k1;
ERROR 1105 (HY000): errCode = 2, detailMessage = The fourth argument of
WidthBucket must be a constant.
```
### 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.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]