[fix](fe) Inconsistent behavior for string comparison in FE and BE (#13604)
This commit is contained in:
@ -96,9 +96,9 @@ public class StringLiteral extends LiteralExpr {
|
||||
int minLength = Math.min(thisBytes.length, otherBytes.length);
|
||||
int i = 0;
|
||||
for (i = 0; i < minLength; i++) {
|
||||
if (thisBytes[i] < otherBytes[i]) {
|
||||
if (Byte.toUnsignedInt(thisBytes[i]) < Byte.toUnsignedInt(otherBytes[i])) {
|
||||
return -1;
|
||||
} else if (thisBytes[i] > otherBytes[i]) {
|
||||
} else if (Byte.toUnsignedInt(thisBytes[i]) > Byte.toUnsignedInt(otherBytes[i])) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,3 +7,6 @@
|
||||
2022-01-01 1
|
||||
汇总 1
|
||||
|
||||
-- !sort_string_on_fe --
|
||||
true
|
||||
|
||||
|
||||
@ -22,4 +22,5 @@
|
||||
suite("sort") {
|
||||
qt_sort_string_single_column """ select * from ( select '汇总' as a union all select '2022-01-01' as a ) a order by 1 """
|
||||
qt_sort_string_multiple_columns """ select * from ( select '汇总' as a,1 as b union all select '2022-01-01' as a,1 as b ) a order by 1,2 """
|
||||
qt_sort_string_on_fe """ select '汇总' > '2022-01-01' """
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user