From 4c0445540381de0d45a69630ad3e287bd7d1e5fb Mon Sep 17 00:00:00 2001 From: obdev Date: Sun, 11 Jul 2021 21:15:12 +0800 Subject: [PATCH] fix collation free compare with rowkey helper --- src/storage/ob_sstable_rowkey_helper.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/storage/ob_sstable_rowkey_helper.cpp b/src/storage/ob_sstable_rowkey_helper.cpp index b6b7a543f8..06dab25e78 100644 --- a/src/storage/ob_sstable_rowkey_helper.cpp +++ b/src/storage/ob_sstable_rowkey_helper.cpp @@ -120,7 +120,12 @@ int ObRowkeyObjComparer::sstable_oracle_collation_free_cmp_func( // int32_t is always capable of stroing the max lenth of varchar or char for (int32_t i = 0; i < left_len; ++i) { if (*(uptr + i) != ' ') { - cmp = lhs_len > cmp_len ? ObObjCmpFuncs::CR_GT : ObObjCmpFuncs::CR_LT; + // mysql特殊行为:a\1 < a,但ab > a + if (*(uptr + i) < ' ') { + cmp = lhs_len > cmp_len ? ObObjCmpFuncs::CR_LT : ObObjCmpFuncs::CR_GT; + } else { + cmp = lhs_len > cmp_len ? ObObjCmpFuncs::CR_GT : ObObjCmpFuncs::CR_LT; + } break; } } -- GitLab