diff --git a/src/codec/Common.h b/src/codec/Common.h index 328231dd971..0e56686ff30 100644 --- a/src/codec/Common.h +++ b/src/codec/Common.h @@ -77,5 +77,35 @@ inline std::string toHexStr(folly::StringPiece str) { return buf; } +// If v is longer than maxLen, return a safepoint to be cut which contains legal utf-8 characters, +// and make sure the returned size is less than or equal to maxLen +inline size_t utf8CutSize(folly::StringPiece v, size_t maxLen) { + DCHECK_GT(v.size(), maxLen); + size_t len = 0; + size_t curLen = 0; // current length of utf-8 character + while (len < maxLen) { + auto tmp = static_cast(v[len]); + if (tmp >= 0xFC) { + curLen = 6; + } else if (tmp >= 0xF8) { + curLen = 5; + } else if (tmp >= 0xF0) { + curLen = 4; + } else if (tmp >= 0xE0) { + curLen = 3; + } else if (tmp >= 0xC0) { + curLen = 2; + } else { + curLen = 1; + } + if (len + curLen <= maxLen) { + len += curLen; + } else { + break; + } + } + return len; +} + } // namespace nebula #endif // CODEC_COMMON_H_ diff --git a/src/codec/RowWriterV2.cpp b/src/codec/RowWriterV2.cpp index 9e0818521e5..1368661ae53 100644 --- a/src/codec/RowWriterV2.cpp +++ b/src/codec/RowWriterV2.cpp @@ -7,6 +7,7 @@ #include +#include "codec/Common.h" #include "common/time/TimeUtils.h" #include "common/time/WallClock.h" #include "common/utils/DefaultValueContext.h" @@ -679,7 +680,7 @@ WriteResult RowWriterV2::write(ssize_t index, folly::StringPiece v) noexcept { case PropertyType::FIXED_STRING: { // In-place string. If the pass-in string is longer than the pre-defined // fixed length, the string will be truncated to the fixed length - size_t len = v.size() > field->size() ? field->size() : v.size(); + size_t len = v.size() > field->size() ? utf8CutSize(v, field->size()) : v.size(); strncpy(&buf_[offset], v.data(), len); if (len < field->size()) { memset(&buf_[offset + len], 0, field->size() - len); diff --git a/tests/tck/features/fetch/FetchEmpty.feature b/tests/tck/features/fetch/FetchEmpty.feature index d024e0b9c9a..6827f3f4d2f 100644 --- a/tests/tck/features/fetch/FetchEmpty.feature +++ b/tests/tck/features/fetch/FetchEmpty.feature @@ -80,3 +80,95 @@ Feature: Fetch prop on empty tag/edge | e | | [:zero_prop_edge "1"->"2" @0{}] | And drop the used space + + Scenario: Tag Fixed String Property + When executing query: + """ + CREATE TAG tag_with_fixed_string(col1 fixed_string(5)); + """ + And wait 5 seconds + When executing query: + """ + INSERT VERTEX tag_with_fixed_string(col1) + VALUES + "1": ("😀😀"), + "2": ("😂😂"), + "3": ("įžŠįžŠįžŠ"), + "4": ("🐏🐏🐏"); + """ + Then the execution should be successful + When executing query: + """ + FETCH PROP on tag_with_fixed_string "1" yield tag_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "😀" | + When executing query: + """ + FETCH PROP on tag_with_fixed_string "2" yield tag_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "😂" | + When executing query: + """ + FETCH PROP on tag_with_fixed_string "3" yield tag_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "įžŠ" | + When executing query: + """ + FETCH PROP on tag_with_fixed_string "4" yield tag_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "🐏" | + And drop the used space + + Scenario: Edge Fixed String Property + When executing query: + """ + CREATE EDGE edge_with_fixed_string(col1 fixed_string(5)); + """ + And wait 5 seconds + When executing query: + """ + INSERT EDGE edge_with_fixed_string(col1) + VALUES + "1" -> "1": ("😀😀"), + "2" -> "2": ("😂😂"), + "3" -> "3": ("įžŠįžŠįžŠ"), + "4" -> "4": ("🐏🐏🐏"); + """ + Then the execution should be successful + When executing query: + """ + FETCH PROP on edge_with_fixed_string "1" -> "1" yield edge_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "😀" | + When executing query: + """ + FETCH PROP on edge_with_fixed_string "2" -> "2" yield edge_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "😂" | + When executing query: + """ + FETCH PROP on edge_with_fixed_string "3" -> "3" yield edge_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "įžŠ" | + When executing query: + """ + FETCH PROP on edge_with_fixed_string "4" -> "4" yield edge_with_fixed_string.col1 as col1 + """ + Then the result should be, in any order: + | col1 | + | "🐏" | + And drop the used space diff --git a/tests/tck/features/index/Index.feature b/tests/tck/features/index/Index.feature index 7c3c21913cb..cc05630a200 100644 --- a/tests/tck/features/index/Index.feature +++ b/tests/tck/features/index/Index.feature @@ -1197,3 +1197,951 @@ Feature: IndexTest_Vid_String | "1" | "2" | | "2" | "1" | Then drop the used space + + Scenario: IndexTest TagStringIndexWithTruncate + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(30) | + | charset | utf8 | + | collate | utf8_bin | + And having executed: + """ + CREATE TAG t1(col1 string); + """ + When executing query: + """ + CREATE TAG INDEX ti1 ON t1(col1(5)); + """ + Then the execution should be successful + And wait 5 seconds + When executing query: + """ + INSERT VERTEX t1(col1) + VALUES + "1": ("aaa"), + "2": ("aaaaa"), + "3": ("aaaaaaa"), + "4": ("abc"), + "5": ("abcde"), + "6": ("abcdefg"); + """ + Then the execution should be successful + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "aaa" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "aaaaa" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "2" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "aaaaaaa" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "3" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "abc" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "4" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "abcde" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "5" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "abcdefg" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "6" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 > "aaaaa" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "3" | + | "4" | + | "5" | + | "6" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 >= "aaaaa" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "2" | + | "3" | + | "4" | + | "5" | + | "6" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 < "abcde" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + | "2" | + | "3" | + | "4" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 <= "abcde" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + | "2" | + | "3" | + | "4" | + | "5" | + When executing query: + """ + LOOKUP ON t1 WHERE "aaaaa" < t1.col1 AND t1.col1 < "abcde" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "3" | + | "4" | + When executing query: + """ + LOOKUP ON t1 WHERE "aaaaa" <= t1.col1 AND t1.col1 < "abcde" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "2" | + | "3" | + | "4" | + When executing query: + """ + LOOKUP ON t1 WHERE "aaaaa" < t1.col1 AND t1.col1 <= "abcde" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "3" | + | "4" | + | "5" | + When executing query: + """ + LOOKUP ON t1 WHERE "aaaaa" <= t1.col1 AND t1.col1 <= "abcde" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "2" | + | "3" | + | "4" | + | "5" | + Then drop the used space + + Scenario: IndexTest EdgeStringIndexWithTruncate + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(30) | + | charset | utf8 | + | collate | utf8_bin | + And having executed: + """ + CREATE EDGE e1(col1 string); + """ + When executing query: + """ + CREATE EDGE INDEX ei1 ON e1(col1(5)); + """ + Then the execution should be successful + And wait 5 seconds + When executing query: + """ + INSERT EDGE e1(col1) + VALUES + "1" -> "1": ("aaa"), + "2" -> "2": ("aaaaa"), + "3" -> "3": ("aaaaaaa"), + "4" -> "4": ("abc"), + "5" -> "5": ("abcde"), + "6" -> "6": ("abcdefg"); + """ + Then the execution should be successful + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "aaa" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "aaaaa" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "2" | "2" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "aaaaaaa" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "3" | "3" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "abc" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "4" | "4" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "abcde" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "5" | "5" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "abcdefg" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "6" | "6" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 > "aaaaa" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "3" | "3" | + | "4" | "4" | + | "5" | "5" | + | "6" | "6" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 >= "aaaaa" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + | "5" | "5" | + | "6" | "6" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 < "abcde" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 <= "abcde" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + | "5" | "5" | + When executing query: + """ + LOOKUP ON e1 WHERE "aaaaa" < e1.col1 AND e1.col1 < "abcde" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "3" | "3" | + | "4" | "4" | + When executing query: + """ + LOOKUP ON e1 WHERE "aaaaa" <= e1.col1 AND e1.col1 < "abcde" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + When executing query: + """ + LOOKUP ON e1 WHERE "aaaaa" < e1.col1 AND e1.col1 <= "abcde" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "3" | "3" | + | "4" | "4" | + | "5" | "5" | + When executing query: + """ + LOOKUP ON e1 WHERE "aaaaa" <= e1.col1 AND e1.col1 <= "abcde" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + | "5" | "5" | + Then drop the used space + + Scenario: IndexTest TagStringIndexWithTruncateUTF8 + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(10) | + | charset | utf8 | + | collate | utf8_bin | + And having executed: + """ + CREATE TAG t1(col1 string); + """ + When executing query: + """ + CREATE TAG INDEX ti1 ON t1(col1(5)); + """ + Then the execution should be successful + And wait 5 seconds + # Unicode of įžŠ is\u7f8a, 🐏 is \ud83d\udc0f + When executing query: + """ + INSERT VERTEX t1(col1) + VALUES + "1": ("įžŠ"), + "2": ("įžŠįžŠ"), + "3": ("įžŠįžŠįžŠ"), + "4": ("įžŠįžŠđŸ"), + "5": ("įžŠđŸ"), + "6": ("įžŠđŸįžŠ"), + "7": ("įžŠđŸđŸ"), + "8": ("🐏"), + "9": ("🐏įžŠ"), + "10": ("🐏įžŠįžŠ"), + "11": ("🐏įžŠđŸ"), + "12": ("🐏🐏"), + "13": ("🐏🐏įžŠ"), + "14": ("🐏🐏🐏"); + """ + Then the execution should be successful + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "2" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠįžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "3" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠđŸ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "5" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "🐏" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "8" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "🐏🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "13" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 > "🐏įžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "11" | + | "12" | + | "13" | + | "14" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 >= "🐏įžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "10" | + | "11" | + | "12" | + | "13" | + | "14" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 < "įžŠđŸ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + | "2" | + | "3" | + | "4" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 <= "įžŠđŸ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + | "2" | + | "3" | + | "4" | + | "5" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" < t1.col1 and t1.col1 < "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "7" | + | "8" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" <= t1.col1 and t1.col1 < "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "6" | + | "7" | + | "8" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" < t1.col1 and t1.col1 <= "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "7" | + | "8" | + | "9" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" <= t1.col1 and t1.col1 <= "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "6" | + | "7" | + | "8" | + | "9" | + Then drop the used space + + Scenario: IndexTest TagStringIndexWithoutTruncateUTF8AndCertain + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(10) | + | charset | utf8 | + | collate | utf8_bin | + And having executed: + """ + CREATE TAG t1(col1 string); + """ + When executing query: + """ + CREATE TAG INDEX ti1 ON t1(col1(16)); + """ + Then the execution should be successful + And wait 5 seconds + # Unicode of įžŠ is\u7f8a, 🐏 is \ud83d\udc0f + When executing query: + """ + INSERT VERTEX t1(col1) + VALUES + "1": ("įžŠ"), + "2": ("įžŠįžŠ"), + "3": ("įžŠįžŠįžŠ"), + "4": ("įžŠįžŠđŸ"), + "5": ("įžŠđŸ"), + "6": ("įžŠđŸįžŠ"), + "7": ("įžŠđŸđŸ"), + "8": ("🐏"), + "9": ("🐏įžŠ"), + "10": ("🐏įžŠįžŠ"), + "11": ("🐏įžŠđŸ"), + "12": ("🐏🐏"), + "13": ("🐏🐏įžŠ"), + "14": ("🐏🐏🐏"); + """ + Then the execution should be successful + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "2" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠįžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "3" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "įžŠđŸ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "5" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "🐏" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "8" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 == "🐏🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "13" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 > "🐏įžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "11" | + | "12" | + | "13" | + | "14" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 >= "🐏įžŠįžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "10" | + | "11" | + | "12" | + | "13" | + | "14" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 < "įžŠđŸ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + | "2" | + | "3" | + | "4" | + When executing query: + """ + LOOKUP ON t1 WHERE t1.col1 <= "įžŠđŸ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "1" | + | "2" | + | "3" | + | "4" | + | "5" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" < t1.col1 and t1.col1 < "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "7" | + | "8" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" <= t1.col1 and t1.col1 < "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "6" | + | "7" | + | "8" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" < t1.col1 and t1.col1 <= "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "7" | + | "8" | + | "9" | + When executing query: + """ + LOOKUP ON t1 WHERE "įžŠđŸįžŠ" <= t1.col1 and t1.col1 <= "🐏įžŠ" YIELD id(vertex) as id + """ + Then the result should be, in any order: + | id | + | "6" | + | "7" | + | "8" | + | "9" | + Then drop the used space + + Scenario: IndexTest EdgeStringIndexWithTruncateUTF8 + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(10) | + | charset | utf8 | + | collate | utf8_bin | + And having executed: + """ + CREATE EDGE e1(col1 string); + """ + When executing query: + """ + CREATE EDGE INDEX ei1 ON e1(col1(5)); + """ + Then the execution should be successful + And wait 5 seconds + # Unicode of įžŠ is\u7f8a, 🐏 is \ud83d\udc0f + When executing query: + """ + INSERT EDGE e1(col1) + VALUES + "1" -> "1" : ("įžŠ"), + "2" -> "2" : ("įžŠįžŠ"), + "3" -> "3" : ("įžŠįžŠįžŠ"), + "4" -> "4" : ("įžŠįžŠđŸ"), + "5" -> "5" : ("įžŠđŸ"), + "6" -> "6" : ("įžŠđŸįžŠ"), + "7" -> "7" : ("įžŠđŸđŸ"), + "8" -> "8" : ("🐏"), + "9" -> "9" : ("🐏įžŠ"), + "10" -> "10": ("🐏įžŠįžŠ"), + "11" -> "11": ("🐏įžŠđŸ"), + "12" -> "12": ("🐏🐏"), + "13" -> "13": ("🐏🐏įžŠ"), + "14" -> "14": ("🐏🐏🐏"); + """ + Then the execution should be successful + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "2" | "2" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠįžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "3" | "3" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠđŸ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "5" | "5" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "🐏" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "8" | "8" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "🐏🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "13" | "13" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 > "🐏įžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "11" | "11" | + | "12" | "12" | + | "13" | "13" | + | "14" | "14" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 >= "🐏įžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "10" | "10" | + | "11" | "11" | + | "12" | "12" | + | "13" | "13" | + | "14" | "14" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 < "įžŠđŸ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 <= "įžŠđŸ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + | "5" | "5" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" < e1.col1 and e1.col1 < "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "7" | "7" | + | "8" | "8" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" <= e1.col1 and e1.col1 < "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "6" | "6" | + | "7" | "7" | + | "8" | "8" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" < e1.col1 and e1.col1 <= "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "7" | "7" | + | "8" | "8" | + | "9" | "9" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" <= e1.col1 and e1.col1 <= "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "6" | "6" | + | "7" | "7" | + | "8" | "8" | + | "9" | "9" | + Then drop the used space + + Scenario: IndexTest EdgeStringIndexWithoutTruncateUTF8AndCertain + Given an empty graph + And create a space with following options: + | partition_num | 1 | + | replica_factor | 1 | + | vid_type | FIXED_STRING(10) | + | charset | utf8 | + | collate | utf8_bin | + And having executed: + """ + CREATE EDGE e1(col1 string); + """ + When executing query: + """ + CREATE EDGE INDEX ei1 ON e1(col1(16)); + """ + Then the execution should be successful + And wait 5 seconds + # Unicode of įžŠ is\u7f8a, 🐏 is \ud83d\udc0f + When executing query: + """ + INSERT EDGE e1(col1) + VALUES + "1" -> "1" : ("įžŠ"), + "2" -> "2" : ("įžŠįžŠ"), + "3" -> "3" : ("įžŠįžŠįžŠ"), + "4" -> "4" : ("įžŠįžŠđŸ"), + "5" -> "5" : ("įžŠđŸ"), + "6" -> "6" : ("įžŠđŸįžŠ"), + "7" -> "7" : ("įžŠđŸđŸ"), + "8" -> "8" : ("🐏"), + "9" -> "9" : ("🐏įžŠ"), + "10" -> "10": ("🐏įžŠįžŠ"), + "11" -> "11": ("🐏įžŠđŸ"), + "12" -> "12": ("🐏🐏"), + "13" -> "13": ("🐏🐏įžŠ"), + "14" -> "14": ("🐏🐏🐏"); + """ + Then the execution should be successful + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "2" | "2" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠįžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "3" | "3" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "įžŠđŸ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "5" | "5" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "🐏" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "8" | "8" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 == "🐏🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "13" | "13" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 > "🐏įžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "11" | "11" | + | "12" | "12" | + | "13" | "13" | + | "14" | "14" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 >= "🐏įžŠįžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "10" | "10" | + | "11" | "11" | + | "12" | "12" | + | "13" | "13" | + | "14" | "14" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 < "įžŠđŸ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + When executing query: + """ + LOOKUP ON e1 WHERE e1.col1 <= "įžŠđŸ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "1" | "1" | + | "2" | "2" | + | "3" | "3" | + | "4" | "4" | + | "5" | "5" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" < e1.col1 and e1.col1 < "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "7" | "7" | + | "8" | "8" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" <= e1.col1 and e1.col1 < "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "6" | "6" | + | "7" | "7" | + | "8" | "8" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" < e1.col1 and e1.col1 <= "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "7" | "7" | + | "8" | "8" | + | "9" | "9" | + When executing query: + """ + LOOKUP ON e1 WHERE "įžŠđŸįžŠ" <= e1.col1 and e1.col1 <= "🐏įžŠ" YIELD src(edge) as src, dst(edge) as dst + """ + Then the result should be, in any order: + | src | dst | + | "6" | "6" | + | "7" | "7" | + | "8" | "8" | + | "9" | "9" | + Then drop the used space