luoyuxia commented on code in PR #2464:
URL: https://github.com/apache/fluss/pull/2464#discussion_r2740698175


##########
fluss-client/src/test/java/org/apache/fluss/client/table/FlussTableITCase.java:
##########
@@ -305,10 +310,16 @@ void testPutAndPrefixLookup() throws Exception {
         createTable(tablePath, descriptor, false);
         Table table = conn.getTable(tablePath);
         TableInfo tableInfo = table.getTableInfo();
-        verifyPutAndLookup(table, new Object[] {1, "a", 1L, "value1"});
-        verifyPutAndLookup(table, new Object[] {1, "a", 2L, "value2"});
-        verifyPutAndLookup(table, new Object[] {1, "a", 3L, "value3"});
-        verifyPutAndLookup(table, new Object[] {2, "a", 4L, "value4"});
+
+        // We use strings with length > 7 (e.g., "valuevalue1") to properly 
test prefix lookup.
+        // Previously, short strings like "value1" hid a bug: Paimon's encoder 
stores strings
+        // longer than 7 characters in a variable-length area, which breaks 
prefix lookup since
+        // the encoded bucket key bytes are no longer a prefix of the encoded 
primary key bytes.
+        // Using longer strings ensures we catch such issues.
+        verifyPutAndLookup(table, new Object[] {1, "a", 1L, "valuevalue1"});
+        verifyPutAndLookup(table, new Object[] {1, "a", 2L, "valuevalue2"});
+        verifyPutAndLookup(table, new Object[] {1, "a", 3L, "valuevalue3"});
+        verifyPutAndLookup(table, new Object[] {2, "a", 4L, "valuevalue4"});

Review Comment:
   Thanks for pointing that. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to