Skip to content

Conversation

@zhiqiang-hhhh
Copy link
Contributor

No description provided.

@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.

@zhiqiang-hhhh
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: 35.27% (8729/24749)
Line Coverage: 27.09% (71476/263872)
Region Coverage: 26.32% (37078/140874)
Branch Coverage: 23.23% (18963/81626)
Coverage Report: http://coverage.selectdb-in.cc/coverage/bec8d225df9f022f6c69fe1af58463673dc3805d_bec8d225df9f022f6c69fe1af58463673dc3805d/report/index.html

Copy link
Contributor

@zclllyybb zclllyybb 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
Copy link
Contributor

PR approved by anyone and no changes requested.

#else
if (typeid(*from) == typeid(std::remove_pointer_t<To>)) {
requires std::is_pointer_v<To>
To typeid_cast(From* from) noexcept {
Copy link
Contributor

Choose a reason for hiding this comment

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

In debug mode, the previous code will print exception. It is useful to help us debug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont know whether typeid_cast(nullptr) is designed as a common use scenario

To typeid_cast(From* from) noexcept {
if ((typeid(From) == typeid(std::remove_pointer_t<To>)) ||
(from && typeid(*from) == typeid(std::remove_pointer_t<To>)))
return static_cast<To>(from);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could always throw exception, not return nullptr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we could always throw exception, not return nullptr.

if (typeid_cast<const ColumnUInt8*>(data.get()))

the users of typeid_cast sometimes relay on the nullptr as their control flow, exception has bad performance when it is used as control flow.

Copy link
Contributor

Choose a reason for hiding this comment

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

不是的,我们抛异常是在入参为空指针的时候才会抛。以前的行为,如果typeid不同,就是返回空指针。因为现在这个新写法应该不会带来更多的风险,应该是靠谱的。空指针的话肯定是代码有错才会出,这种情况下前、后的使用肯定会出问题,不必在这里处理成异常的。

@github-actions
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants