You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "vldpyatkov (via GitHub)" <gi...@apache.org> on 2025/05/08 15:30:16 UTC

[PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

vldpyatkov opened a new pull request, #5792:
URL: https://github.com/apache/ignite-3/pull/5792

   https://issues.apache.org/jira/browse/IGNITE-25340


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov commented on code in PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792#discussion_r2083224193


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTupleComparatorUtils.java:
##########
@@ -122,6 +122,12 @@ static int compareAsString(BinaryTupleReader tuple, int colIndex, String cmp, bo
         byte[] bytes = tuple.bytesValue(begin, begin + trimmedSize);
         char[] cmpArray = cmp.toCharArray();
 
+        if (bytes.length < trimmedSize) {
+            assert bytes.length == trimmedSize - 1 : "Only one first byte can have a special value.";
+
+            fullSrtLength--;

Review Comment:
   Renamed to fullStrLength



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov commented on code in PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792#discussion_r2081375915


##########
modules/schema/src/test/java/org/apache/ignite/internal/schema/BinaryTupleComparatorTest.java:
##########
@@ -348,8 +352,16 @@ public void partialComparatorAsciiTest() {
         assertTrue(partialBinaryTupleMatcher.match(tuple3, tupleReference) > 0);
         assertEquals(0, partialBinaryTupleMatcher.match(tuple1.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), tupleReference));
         assertTrue(partialBinaryTupleMatcher.match(tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), tupleReference) > 0);
+        assertTrue(partialBinaryTupleMatcher.match(
+                tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),

Review Comment:
   From my mind.
   It is an imitation of truncated value in B-tree entry inline.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792#discussion_r2081449858


##########
modules/schema/src/test/java/org/apache/ignite/internal/schema/BinaryTupleComparatorTest.java:
##########
@@ -348,8 +352,16 @@ public void partialComparatorAsciiTest() {
         assertTrue(partialBinaryTupleMatcher.match(tuple3, tupleReference) > 0);
         assertEquals(0, partialBinaryTupleMatcher.match(tuple1.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), tupleReference));
         assertTrue(partialBinaryTupleMatcher.match(tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), tupleReference) > 0);
+        assertTrue(partialBinaryTupleMatcher.match(
+                tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),

Review Comment:
   Don't we have a constant or configuration value for 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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792#discussion_r2081362953


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTupleComparatorUtils.java:
##########
@@ -122,6 +122,12 @@ static int compareAsString(BinaryTupleReader tuple, int colIndex, String cmp, bo
         byte[] bytes = tuple.bytesValue(begin, begin + trimmedSize);
         char[] cmpArray = cmp.toCharArray();
 
+        if (bytes.length < trimmedSize) {
+            assert bytes.length == trimmedSize - 1 : "Only one first byte can have a special value.";
+
+            fullSrtLength--;

Review Comment:
   I don't understand the variable name, shouldn't it be `fullStrLength`?



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov commented on code in PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792#discussion_r2081373776


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTupleComparatorUtils.java:
##########
@@ -122,6 +122,12 @@ static int compareAsString(BinaryTupleReader tuple, int colIndex, String cmp, bo
         byte[] bytes = tuple.bytesValue(begin, begin + trimmedSize);
         char[] cmpArray = cmp.toCharArray();
 
+        if (bytes.length < trimmedSize) {

Review Comment:
   Added comment.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov merged PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on code in PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792#discussion_r2081210199


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTupleComparatorUtils.java:
##########
@@ -122,6 +122,12 @@ static int compareAsString(BinaryTupleReader tuple, int colIndex, String cmp, bo
         byte[] bytes = tuple.bytesValue(begin, begin + trimmedSize);
         char[] cmpArray = cmp.toCharArray();
 
+        if (bytes.length < trimmedSize) {
+            assert bytes.length == trimmedSize - 1 : "Only one first byte can have a special value.";
+
+            fullSrtLength--;

Review Comment:
   What's "srt"?



##########
modules/schema/src/test/java/org/apache/ignite/internal/schema/BinaryTupleComparatorTest.java:
##########
@@ -348,8 +352,16 @@ public void partialComparatorAsciiTest() {
         assertTrue(partialBinaryTupleMatcher.match(tuple3, tupleReference) > 0);
         assertEquals(0, partialBinaryTupleMatcher.match(tuple1.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), tupleReference));
         assertTrue(partialBinaryTupleMatcher.match(tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), tupleReference) > 0);
+        assertTrue(partialBinaryTupleMatcher.match(
+                tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),

Review Comment:
   Where do these limit values come from?



##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTupleComparatorUtils.java:
##########
@@ -122,6 +122,12 @@ static int compareAsString(BinaryTupleReader tuple, int colIndex, String cmp, bo
         byte[] bytes = tuple.bytesValue(begin, begin + trimmedSize);
         char[] cmpArray = cmp.toCharArray();
 
+        if (bytes.length < trimmedSize) {

Review Comment:
   Please add a comment that this "if" does and why it is needed



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-25340 Incorrect tuple comparison in B-tree prefix [ignite-3]

Posted by "vldpyatkov (via GitHub)" <gi...@apache.org>.
vldpyatkov commented on code in PR #5792:
URL: https://github.com/apache/ignite-3/pull/5792#discussion_r2081347612


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTupleComparatorUtils.java:
##########
@@ -122,6 +122,12 @@ static int compareAsString(BinaryTupleReader tuple, int colIndex, String cmp, bo
         byte[] bytes = tuple.bytesValue(begin, begin + trimmedSize);
         char[] cmpArray = cmp.toCharArray();
 
+        if (bytes.length < trimmedSize) {
+            assert bytes.length == trimmedSize - 1 : "Only one first byte can have a special value.";
+
+            fullSrtLength--;

Review Comment:
   It is a reduction of the full size of string value in bytes.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org