Skip to content

Conversation

@chenhao7253886
Copy link
Contributor

Status codegen_compare_fn(
RuntimeState* state, llvm::Function** fn, llvm::CmpInst::Predicate pred);

bool get_result_for_null(const AnyVal& v1, const AnyVal& v2, BooleanVal* result) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please add comment to explain the meaning of the return value of this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok.

RuntimeState* state, llvm::Function** fn, llvm::CmpInst::Predicate pred);

bool get_result_for_null(const AnyVal& v1, const AnyVal& v2, BooleanVal* result) {
if (is_safe_for_null) { \
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (is_safe_for_null) { \
if (is_safe_for_null) {

if (v2.is_null) { \
return BooleanVal::null(); \
BooleanVal result; \
if (get_result_for_null(v1, v2, &result)) { \
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's not a good way to add safe is null. I prefer to adding another function to handle this. For performance we should avoid branch and function call here. So you can find the proper function to handle this in Frontend when analyzing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's inappropriate to add an new operator for BinaryPredicate, because in most conditions we can't know whether the children is null when analyze BinaryPredicate.

imay
imay previously approved these changes Jul 30, 2019
return BooleanVal(false); \
} \
return BooleanVal(v1.val OP v2.val); \
} \
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the \ at the end of MACRO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, i will remove it.

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@chenhao7253886 chenhao7253886 merged commit 2cb82c5 into apache:master Jul 30, 2019
morningman pushed a commit to baidu-doris/incubator-doris that referenced this pull request Aug 5, 2019
* Fix bug that <=> operator and in operator get wrong result

* Add some comment to get_result_for_null

* Add an new Binary Operator to replace is_safe_for_null for handleing '<=>' operator

* Add EQ_FOR_NULL to TExprOpcode

* Remove macro definition last backslash
swjtu-zhanglei pushed a commit to swjtu-zhanglei/incubator-doris that referenced this pull request Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants