-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[opt](nereids) compare literal not convert to legacy literal and fix ip literal compareTo always equals 0 #46482
Conversation
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
1 similar comment
run buildall |
TPC-H: Total hot run time: 33001 ms
|
TPC-DS: Total hot run time: 196459 ms
|
ClickBench: Total hot run time: 31.42 s
|
run buildall |
2 similar comments
run buildall |
run buildall |
TPC-H: Total hot run time: 32945 ms
|
TPC-DS: Total hot run time: 190010 ms
|
ClickBench: Total hot run time: 31.42 s
|
run buildall |
TPC-H: Total hot run time: 32593 ms
|
TPC-DS: Total hot run time: 189945 ms
|
ClickBench: Total hot run time: 30.98 s
|
run buildall |
2 similar comments
run buildall |
run buildall |
TPC-H: Total hot run time: 32749 ms
|
TPC-DS: Total hot run time: 194359 ms
|
ClickBench: Total hot run time: 31.87 s
|
run buildall |
TPC-H: Total hot run time: 32736 ms
|
TPC-DS: Total hot run time: 194436 ms
|
ClickBench: Total hot run time: 32.08 s
|
run external |
try { | ||
return BooleanLiteral.of(((ComparableLiteral) equalTo.left()) | ||
.compareTo((ComparableLiteral) equalTo.right()) == 0); | ||
} catch (Exception e) { | ||
// left and right maybe not comparable | ||
return BooleanLiteral.of(equalTo.left().equals(equalTo.right())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add this to try best to avoid throw exception because throw exception are too slow, similar modifications also need to be made in this way
if (equalTo.left() instanceof ComparableLiteral && equalsTo.right() instanceof ComparableLiteral) {
try {
return BooleanLiteral.of(((ComparableLiteral) equalTo.left())
.compareTo((ComparableLiteral) equalTo.right()) == 0);
} catch (Exception e) {
return BooleanLiteral.of(equalTo.left().equals(equalTo.right()));
}
} else {
return BooleanLiteral.of(equalTo.left().equals(equalTo.right()));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add this to try best to avoid throw exception because throw exception are too slow, similar modifications also need to be made in this way
if (equalTo.left() instanceof ComparableLiteral && equalsTo.right() instanceof ComparableLiteral) { try { return BooleanLiteral.of(((ComparableLiteral) equalTo.left()) .compareTo((ComparableLiteral) equalTo.right()) == 0); } catch (Exception e) { return BooleanLiteral.of(equalTo.left().equals(equalTo.right())); } } else { return BooleanLiteral.of(equalTo.left().equals(equalTo.right())); }
fix
thisBytes = getStringValue().getBytes("UTF-8"); | ||
otherBytes = ((Literal) other).getStringValue().getBytes("UTF-8"); | ||
} catch (UnsupportedEncodingException e) { | ||
Preconditions.checkState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not eat the exception. new AnalysisException and wrap UnsupportedEncodingException and then throw it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not eat the exception. new AnalysisException and wrap UnsupportedEncodingException and then throw it
fix
run buildall |
TPC-H: Total hot run time: 33447 ms
|
TPC-DS: Total hot run time: 188563 ms
|
ClickBench: Total hot run time: 31.32 s
|
run cloud_p0 |
run p0 |
1 similar comment
run p0 |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
c97b0f5
to
2dd034b
Compare
run buildall |
TPC-H: Total hot run time: 32246 ms
|
TPC-DS: Total hot run time: 184776 ms
|
ClickBench: Total hot run time: 30.64 s
|
run cloud_p0 |
2 similar comments
run cloud_p0 |
run cloud_p0 |
…ip literal compareTo always equals 0 (apache#46482) ### What problem does this PR solve? Problem Summary: as apache#45181 mention, when sorting literals, toLegacyLiteral may cost a lot of time, so compare literal don't use toLegacyLiteral any more. legacy literal may have an unknown behaviour comparing two values with different data type. for neredis literals, different data type value compare will throw an exception, it support valid compare with data types: 1. boolean vs boolean; 2. numeric vs numeric; 3. string like vs string like; 4. date like vs date like; 5. ipv4 vs ipv4; 6. ipv6 vs ipv6; 7. array vs array; 8. above data types vs null and max; what's more, this pr also: 1. nereids literal remove implements Comparable<Literal>; 2. add a new interface ComparableLiteral, and the above type literals will implement it; 3. fix ipv4 / ipv6 / map / struct compareTo always return 0;
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
as #45181 mention, when sorting literals, toLegacyLiteral may cost a lot of time, so compare literal don't use toLegacyLiteral any more.
legacy literal may have an unknown behaviour comparing two values with different data type.
for neredis literals, different data type value compare will throw an exception, it support valid compare with data types:
what's more, this pr also:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)