This is an automated email from the ASF dual-hosted git repository.
gabriellee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new f2a0adf34e [fix](fe) Inconsistent behavior for string comparison in FE
and BE (#13604)
f2a0adf34e is described below
commit f2a0adf34e6a5170fc4ccf2d3ba56a577d26e7c6
Author: xueweizhang <[email protected]>
AuthorDate: Wed Nov 2 15:32:13 2022 +0800
[fix](fe) Inconsistent behavior for string comparison in FE and BE (#13604)
---
fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java | 4 ++--
regression-test/data/query_p0/sort/sort.out | 3 +++
regression-test/suites/query_p0/sort/sort.groovy | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
index 3a6dcd6094..9761a43725 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
@@ -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;
}
}
diff --git a/regression-test/data/query_p0/sort/sort.out
b/regression-test/data/query_p0/sort/sort.out
index b4a5c9ee01..4e898a3f62 100644
--- a/regression-test/data/query_p0/sort/sort.out
+++ b/regression-test/data/query_p0/sort/sort.out
@@ -7,3 +7,6 @@
2022-01-01 1
汇总 1
+-- !sort_string_on_fe --
+true
+
diff --git a/regression-test/suites/query_p0/sort/sort.groovy
b/regression-test/suites/query_p0/sort/sort.groovy
index b967c93137..2d41adf192 100644
--- a/regression-test/suites/query_p0/sort/sort.groovy
+++ b/regression-test/suites/query_p0/sort/sort.groovy
@@ -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' """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]