Skip to content

Conversation

@zhangstar333
Copy link
Contributor

@zhangstar333 zhangstar333 commented Oct 16, 2024

Proposed changes

    void resize_fill(size_t n, const T& value) {
        size_t old_size = this->size();
        if (n > old_size) {
            this->reserve(n);
            std::fill(t_end(), t_end() + n - old_size, value);
        }
        this->c_end = this->c_start + this->byte_size(n);
    }

if n is not greater than old_size,
it's will not fill the data with value.

so it's not set the null_map flag to 1, it's can't return NULL

mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6;
+---------------------+--------------------+
| k11                 | hour_floor(k11, 0) |
+---------------------+--------------------+
| 2015-03-13 12:36:38 |                    |
+---------------------+--------------------+
1 row in set (0.03 se

after fix:

mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6;
+---------------------+--------------------+
| k11                 | hour_floor(k11, 0) |
+---------------------+--------------------+
| 2015-03-13 12:36:38 | NULL               |
+---------------------+--------------------+
1 row in set (0.03 sec)

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@zhangstar333 zhangstar333 changed the title Fix date floor [bug](function)fix date_floor function return wrong result Oct 16, 2024
@zhangstar333
Copy link
Contributor Author

run buildall

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.46% (9707/25914)
Line Coverage: 28.73% (80618/280606)
Region Coverage: 28.16% (41700/148071)
Branch Coverage: 24.75% (21206/85698)
Coverage Report: http://coverage.selectdb-in.cc/coverage/13fe6046686c488e5ce48e4f5d40c33d6d04c364_13fe6046686c488e5ce48e4f5d40c33d6d04c364/report/index.html

@zhangstar333
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 37.47% (9711/25919)
Line Coverage: 28.72% (80595/280613)
Region Coverage: 28.17% (41716/148085)
Branch Coverage: 24.75% (21207/85698)
Coverage Report: http://coverage.selectdb-in.cc/coverage/13fe6046686c488e5ce48e4f5d40c33d6d04c364_13fe6046686c488e5ce48e4f5d40c33d6d04c364/report/index.html

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Oct 17, 2024
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@HappenLee HappenLee merged commit 07fe7c0 into apache:master Oct 17, 2024
zhangstar333 added a commit to zhangstar333/incubator-doris that referenced this pull request Oct 18, 2024
)

```
    void resize_fill(size_t n, const T& value) {
        size_t old_size = this->size();
        if (n > old_size) {
            this->reserve(n);
            std::fill(t_end(), t_end() + n - old_size, value);
        }
        this->c_end = this->c_start + this->byte_size(n);
    }
```
if n is not greater than old_size,
it's will not fill the data with value.

so it's not set the null_map flag to 1, it's can't return NULL
```
mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6;
+---------------------+--------------------+
| k11                 | hour_floor(k11, 0) |
+---------------------+--------------------+
| 2015-03-13 12:36:38 |                    |
+---------------------+--------------------+
1 row in set (0.03 se
```

after fix:

```
mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6;
+---------------------+--------------------+
| k11                 | hour_floor(k11, 0) |
+---------------------+--------------------+
| 2015-03-13 12:36:38 | NULL               |
+---------------------+--------------------+
1 row in set (0.03 sec)

```
yiguolei pushed a commit that referenced this pull request Oct 18, 2024
…41948) (#42065)

## Proposed changes

cherry-pick from master #41948

<!--Describe your changes.-->
@yiguolei yiguolei mentioned this pull request Nov 6, 2024
zhangstar333 added a commit to zhangstar333/incubator-doris that referenced this pull request Nov 11, 2024
)

```
    void resize_fill(size_t n, const T& value) {
        size_t old_size = this->size();
        if (n > old_size) {
            this->reserve(n);
            std::fill(t_end(), t_end() + n - old_size, value);
        }
        this->c_end = this->c_start + this->byte_size(n);
    }
```
if n is not greater than old_size,
it's will not fill the data with value.

so it's not set the null_map flag to 1, it's can't return NULL
```
mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6;
+---------------------+--------------------+
| k11                 | hour_floor(k11, 0) |
+---------------------+--------------------+
| 2015-03-13 12:36:38 |                    |
+---------------------+--------------------+
1 row in set (0.03 se
```


after fix:

```
mysql [test_query_qa]>select k11,hour_floor(k11,0) from baseall where k1 = 6;
+---------------------+--------------------+
| k11                 | hour_floor(k11, 0) |
+---------------------+--------------------+
| 2015-03-13 12:36:38 | NULL               |
+---------------------+--------------------+
1 row in set (0.03 sec)

```
zhangstar333 added a commit that referenced this pull request Nov 11, 2024
@gavinchou gavinchou mentioned this pull request Nov 26, 2024
@yiguolei yiguolei mentioned this pull request Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/2.1.7-merged dev/3.0.3-merged p0_w reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants