This is an automated email from the ASF dual-hosted git repository.

ibessonov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 56ee65d1e06 IGNITE-26028 Support partial comparison in JitComparator 
(#6515)
56ee65d1e06 is described below

commit 56ee65d1e06f4f841e989752c96632f0962c6b4e
Author: Ivan Bessonov <bessonov...@gmail.com>
AuthorDate: Fri Aug 29 18:54:53 2025 +0300

    IGNITE-26028 Support partial comparison in JitComparator (#6515)
---
 .../internal/schema/BinaryTupleComparatorTest.java |   5 +
 .../schema/PartialBinaryTupleMatcherTest.java      | 134 +-------------------
 .../schema/BinaryTupleComparatorBaseTest.java      | 139 +++++++++++++++++++++
 .../sorted/comparator/JitComparatorGenerator.java  |  46 ++++++-
 .../sorted/comparator/JitComparatorOptions.java    |  24 +++-
 .../index/sorted/comparator/JitComparatorTest.java |   6 +
 6 files changed, 220 insertions(+), 134 deletions(-)

diff --git 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/BinaryTupleComparatorTest.java
 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/BinaryTupleComparatorTest.java
index 356ca57bf84..1d5b413937b 100644
--- 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/BinaryTupleComparatorTest.java
+++ 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/BinaryTupleComparatorTest.java
@@ -34,4 +34,9 @@ public class BinaryTupleComparatorTest extends 
BinaryTupleComparatorBaseTest {
     ) {
         return new BinaryTupleComparator(columnCollations, columnTypes);
     }
+
+    @Override
+    protected boolean supportsPartialComparison() {
+        return false;
+    }
 }
diff --git 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/PartialBinaryTupleMatcherTest.java
 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/PartialBinaryTupleMatcherTest.java
index d70f1e20add..be7756760a0 100644
--- 
a/modules/schema/src/test/java/org/apache/ignite/internal/schema/PartialBinaryTupleMatcherTest.java
+++ 
b/modules/schema/src/test/java/org/apache/ignite/internal/schema/PartialBinaryTupleMatcherTest.java
@@ -19,19 +19,12 @@ package org.apache.ignite.internal.schema;
 
 import static 
org.apache.ignite.internal.binarytuple.BinaryTupleCommon.PREFIX_FLAG;
 import static 
org.apache.ignite.internal.schema.BinaryTupleComparatorUtils.isFlagSet;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
-import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
 import org.apache.ignite.internal.catalog.descriptors.CatalogColumnCollation;
 import org.apache.ignite.internal.type.NativeType;
-import org.apache.ignite.internal.type.NativeTypes;
-import org.junit.jupiter.api.Test;
 
 /** Tests for {@link PartialBinaryTupleMatcher}. */
 public class PartialBinaryTupleMatcherTest extends 
BinaryTupleComparatorBaseTest {
@@ -42,129 +35,8 @@ public class PartialBinaryTupleMatcherTest extends 
BinaryTupleComparatorBaseTest
         return (l, r) -> isFlagSet(l, PREFIX_FLAG) ? -matcher.match(r, l) : 
matcher.match(l, r);
     }
 
-    @Test
-    public void partialComparatorAsciiTest() {
-        PartialBinaryTupleMatcher partialBinaryTupleMatcher = new 
PartialBinaryTupleMatcher(
-                List.of(CatalogColumnCollation.ASC_NULLS_LAST),
-                List.of(NativeTypes.STRING)
-        );
-
-        ByteBuffer tupleReference = new BinaryTupleBuilder(1)
-                .appendString("qwertyuiop".repeat(10))
-                .build();
-
-        ByteBuffer tupleWithEmptyStringReference = new BinaryTupleBuilder(1)
-                .appendString("")
-                .build();
-
-        ByteBuffer tuple1 = new BinaryTupleBuilder(1)
-                .appendString("qwertyuiop")
-                .build();
-
-        ByteBuffer tuple2 = new BinaryTupleBuilder(1)
-                .appendString("rxfsuzvjpq".repeat(2))
-                .build();
-
-        ByteBuffer tuple3 = new BinaryTupleBuilder(1)
-                .appendString("qwertyuiop".repeat(15))
-                .build();
-
-        assertTrue(partialBinaryTupleMatcher.match(tuple1, tupleReference) < 
0);
-        assertTrue(partialBinaryTupleMatcher.match(tuple2, tupleReference) > 
0);
-        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),
-                tupleWithEmptyStringReference
-        ) > 0);
-        assertEquals(0, 
partialBinaryTupleMatcher.match(tuple3.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference));
-        
assertTrue(partialBinaryTupleMatcher.match(tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
-        assertTrue(partialBinaryTupleMatcher.match(
-                tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
-                tupleWithEmptyStringReference
-        ) > 0);
-    }
-
-    @Test
-    public void partialComparatorUnicodeTest() {
-        PartialBinaryTupleMatcher partialBinaryTupleMatcher = new 
PartialBinaryTupleMatcher(
-                List.of(CatalogColumnCollation.ASC_NULLS_LAST),
-                List.of(NativeTypes.STRING)
-        );
-
-        ByteBuffer tupleReference = new BinaryTupleBuilder(1)
-                .appendString("йцукенгшщз".repeat(10))
-                .build();
-
-        ByteBuffer tuple1 = new BinaryTupleBuilder(1)
-                .appendString("йцукенгшщз")
-                .build();
-
-        ByteBuffer tuple2 = new BinaryTupleBuilder(1)
-                .appendString("кчфлёодщъи".repeat(2))
-                .build();
-
-        ByteBuffer tuple3 = new BinaryTupleBuilder(1)
-                .appendString("йцукенгшщз".repeat(15))
-                .build();
-
-        assertTrue(partialBinaryTupleMatcher.match(tuple1, tupleReference) < 
0);
-        assertTrue(partialBinaryTupleMatcher.match(tuple2, tupleReference) > 
0);
-        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);
-        assertEquals(0, 
partialBinaryTupleMatcher.match(tuple3.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference));
-        
assertTrue(partialBinaryTupleMatcher.match(tuple3.limit(220).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
-    }
-
-    @Test
-    public void partialComparatorBytesTest() {
-        PartialBinaryTupleMatcher partialBinaryTupleMatcher = new 
PartialBinaryTupleMatcher(
-                List.of(CatalogColumnCollation.ASC_NULLS_LAST),
-                List.of(NativeTypes.BYTES)
-        );
-
-        byte[] bytes = new byte[150];
-
-        for (int i = 0; i < bytes.length; i++) {
-            bytes[i] = (byte) (i % 10);
-        }
-
-        ByteBuffer tupleReference = new BinaryTupleBuilder(1)
-                .appendBytes(Arrays.copyOfRange(bytes, 0, 100))
-                .build();
-
-        ByteBuffer tupleWithEmptyArrayReference = new BinaryTupleBuilder(1)
-                .appendBytes(new byte[0])
-                .build();
-
-        ByteBuffer tuple1 = new BinaryTupleBuilder(1)
-                .appendBytes(Arrays.copyOfRange(bytes, 0, 10))
-                .build();
-
-        ByteBuffer tuple2 = new BinaryTupleBuilder(1)
-                .appendBytes(Arrays.copyOfRange(bytes, 1, 21))
-                .build();
-
-        ByteBuffer tuple3 = new BinaryTupleBuilder(1)
-                .appendBytes(bytes)
-                .build();
-
-        assertTrue(partialBinaryTupleMatcher.match(tuple1, tupleReference) < 
0);
-        assertTrue(partialBinaryTupleMatcher.match(tuple2, tupleReference) > 
0);
-        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),
-                tupleWithEmptyArrayReference
-        ) > 0);
-        assertEquals(0, 
partialBinaryTupleMatcher.match(tuple3.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference));
-        
assertTrue(partialBinaryTupleMatcher.match(tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
-        assertTrue(partialBinaryTupleMatcher.match(
-                tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
-                tupleWithEmptyArrayReference
-        ) > 0);
+    @Override
+    protected boolean supportsPartialComparison() {
+        return true;
     }
 }
diff --git 
a/modules/schema/src/testFixtures/java/org/apache/ignite/internal/schema/BinaryTupleComparatorBaseTest.java
 
b/modules/schema/src/testFixtures/java/org/apache/ignite/internal/schema/BinaryTupleComparatorBaseTest.java
index 31ec7cef621..c49843294ed 100644
--- 
a/modules/schema/src/testFixtures/java/org/apache/ignite/internal/schema/BinaryTupleComparatorBaseTest.java
+++ 
b/modules/schema/src/testFixtures/java/org/apache/ignite/internal/schema/BinaryTupleComparatorBaseTest.java
@@ -21,13 +21,18 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.greaterThanOrEqualTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.lessThanOrEqualTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 import java.math.BigDecimal;
 import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
+import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
 import java.util.UUID;
@@ -322,6 +327,138 @@ public abstract class BinaryTupleComparatorBaseTest {
         assertThat(comparator.compare(tuple1, tuple2), 
is(greaterThanOrEqualTo(-1)));
     }
 
+    @Test
+    public void partialComparatorAsciiTest() {
+        assumeTrue(supportsPartialComparison());
+
+        Comparator<ByteBuffer> comparator = newComparator(
+                List.of(CatalogColumnCollation.ASC_NULLS_LAST),
+                List.of(NativeTypes.STRING)
+        );
+
+        ByteBuffer tupleReference = new BinaryTupleBuilder(1)
+                .appendString("qwertyuiop".repeat(10))
+                .build();
+
+        ByteBuffer tupleWithEmptyStringReference = new BinaryTupleBuilder(1)
+                .appendString("")
+                .build();
+
+        ByteBuffer tuple1 = new BinaryTupleBuilder(1)
+                .appendString("qwertyuiop")
+                .build();
+
+        ByteBuffer tuple2 = new BinaryTupleBuilder(1)
+                .appendString("rxfsuzvjpq".repeat(2))
+                .build();
+
+        ByteBuffer tuple3 = new BinaryTupleBuilder(1)
+                .appendString("qwertyuiop".repeat(15))
+                .build();
+
+        assertTrue(comparator.compare(tuple1, tupleReference) < 0);
+        assertTrue(comparator.compare(tuple2, tupleReference) > 0);
+        assertTrue(comparator.compare(tuple3, tupleReference) > 0);
+        assertEquals(0, 
comparator.compare(tuple1.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), 
tupleReference));
+        
assertTrue(comparator.compare(tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
+        assertTrue(comparator.compare(
+                tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
+                tupleWithEmptyStringReference
+        ) > 0);
+        assertEquals(0, 
comparator.compare(tuple3.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), 
tupleReference));
+        
assertTrue(comparator.compare(tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
+        assertTrue(comparator.compare(
+                tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
+                tupleWithEmptyStringReference
+        ) > 0);
+    }
+
+    @Test
+    public void partialComparatorUnicodeTest() {
+        assumeTrue(supportsPartialComparison());
+
+        Comparator<ByteBuffer> comparator = newComparator(
+                List.of(CatalogColumnCollation.ASC_NULLS_LAST),
+                List.of(NativeTypes.STRING)
+        );
+
+        ByteBuffer tupleReference = new BinaryTupleBuilder(1)
+                .appendString("йцукенгшщз".repeat(10))
+                .build();
+
+        ByteBuffer tuple1 = new BinaryTupleBuilder(1)
+                .appendString("йцукенгшщз")
+                .build();
+
+        ByteBuffer tuple2 = new BinaryTupleBuilder(1)
+                .appendString("кчфлёодщъи".repeat(2))
+                .build();
+
+        ByteBuffer tuple3 = new BinaryTupleBuilder(1)
+                .appendString("йцукенгшщз".repeat(15))
+                .build();
+
+        assertTrue(comparator.compare(tuple1, tupleReference) < 0);
+        assertTrue(comparator.compare(tuple2, tupleReference) > 0);
+        assertTrue(comparator.compare(tuple3, tupleReference) > 0);
+        assertEquals(0, 
comparator.compare(tuple1.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), 
tupleReference));
+        
assertTrue(comparator.compare(tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
+        assertEquals(0, 
comparator.compare(tuple3.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), 
tupleReference));
+        
assertTrue(comparator.compare(tuple3.limit(220).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
+    }
+
+    @Test
+    public void partialComparatorBytesTest() {
+        assumeTrue(supportsPartialComparison());
+
+        Comparator<ByteBuffer> comparator = newComparator(
+                List.of(CatalogColumnCollation.ASC_NULLS_LAST),
+                List.of(NativeTypes.BYTES)
+        );
+
+        byte[] bytes = new byte[150];
+
+        for (int i = 0; i < bytes.length; i++) {
+            bytes[i] = (byte) (i % 10);
+        }
+
+        ByteBuffer tupleReference = new BinaryTupleBuilder(1)
+                .appendBytes(Arrays.copyOfRange(bytes, 0, 100))
+                .build();
+
+        ByteBuffer tupleWithEmptyArrayReference = new BinaryTupleBuilder(1)
+                .appendBytes(new byte[0])
+                .build();
+
+        ByteBuffer tuple1 = new BinaryTupleBuilder(1)
+                .appendBytes(Arrays.copyOfRange(bytes, 0, 10))
+                .build();
+
+        ByteBuffer tuple2 = new BinaryTupleBuilder(1)
+                .appendBytes(Arrays.copyOfRange(bytes, 1, 21))
+                .build();
+
+        ByteBuffer tuple3 = new BinaryTupleBuilder(1)
+                .appendBytes(bytes)
+                .build();
+
+        assertTrue(comparator.compare(tuple1, tupleReference) < 0);
+        assertTrue(comparator.compare(tuple2, tupleReference) > 0);
+        assertTrue(comparator.compare(tuple3, tupleReference) > 0);
+        assertEquals(0, 
comparator.compare(tuple1.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), 
tupleReference));
+        
assertTrue(comparator.compare(tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
+        assertTrue(comparator.compare(
+                tuple2.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN),
+                tupleWithEmptyArrayReference
+        ) > 0);
+        assertEquals(0, 
comparator.compare(tuple3.limit(8).slice().order(ByteOrder.LITTLE_ENDIAN), 
tupleReference));
+        
assertTrue(comparator.compare(tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
 tupleReference) > 0);
+        assertTrue(comparator.compare(
+                tuple3.limit(120).slice().order(ByteOrder.LITTLE_ENDIAN),
+                tupleWithEmptyArrayReference
+        ) > 0);
+    }
+
     protected final Comparator<ByteBuffer> 
createSingleColumnComparator(NativeType type, CatalogColumnCollation collation) 
{
         return newComparator(List.of(collation), List.of(type));
     }
@@ -330,4 +467,6 @@ public abstract class BinaryTupleComparatorBaseTest {
             List<CatalogColumnCollation> columnCollations,
             List<NativeType> columnTypes
     );
+
+    protected abstract boolean supportsPartialComparison();
 }
diff --git 
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorGenerator.java
 
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorGenerator.java
index e90cc745862..d02c476a924 100644
--- 
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorGenerator.java
+++ 
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorGenerator.java
@@ -26,6 +26,7 @@ import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.consta
 import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.constantInt;
 import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.constantString;
 import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.equal;
+import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.greaterThan;
 import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.inlineIf;
 import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.invokeStatic;
 import static 
com.facebook.presto.bytecode.expression.BytecodeExpressions.newInstance;
@@ -416,6 +417,14 @@ public class JitComparatorGenerator {
         
body.append(outerEntryBaseStart.set(constantInt(BinaryTupleCommon.HEADER_SIZE + 
outerEntrySize * columnsSize)));
         
body.append(innerEntryBaseStart.set(constantInt(BinaryTupleCommon.HEADER_SIZE + 
innerEntrySize * columnsSize)));
 
+        if (options.supportPartialComparison()) {
+            // Return 0 immediately if inner tuple is only partially available 
and we have no column values to compare.
+            body.append(new IfStatement()
+                    .condition(greaterThan(innerEntryBaseStart, innerSize))
+                    .ifTrue(constantInt(0).ret())
+            );
+        }
+
         Variable cmp = scope.declareVariable(int.class, "cmp");
 
         Variable outerEntryBaseEnd = scope.declareVariable(int.class, 
"outerEntryBaseEnd");
@@ -427,7 +436,7 @@ public class JitComparatorGenerator {
             boolean lastIteration = i == columnsSize - 1;
             LabelNode endOfBlockLabel = new LabelNode();
 
-            if (lastIteration) {
+            if (lastIteration && !options.supportPartialComparison()) {
                 body.append(outerEntryBaseEnd.set(outerSize));
                 body.append(innerEntryBaseEnd.set(innerSize));
             } else {
@@ -444,6 +453,19 @@ public class JitComparatorGenerator {
             CatalogColumnCollation collation = 
options.columnCollations().get(i);
             NativeType columnType = options.columnTypes().get(i);
 
+            if (options.supportPartialComparison()) {
+                body.append(new IfStatement()
+                        .condition(greaterThan(innerEntryBaseEnd, innerSize))
+                        .ifTrue(comparePartialTupleElement(
+                                collation, columnType,
+                                new ComparisonVariables(
+                                        outerAccessor, outerEntryBaseStart, 
outerEntryBaseEnd,
+                                        innerAccessor, innerEntryBaseStart, 
innerEntryBaseEnd
+                                )
+                        ).ret())
+                );
+            }
+
             // Nullability check.
             if (options.nullableFlags().get(i)) {
                 body.append(outerInNull.set(equal(outerEntryBaseStart, 
outerEntryBaseEnd)));
@@ -604,6 +626,28 @@ public class JitComparatorGenerator {
         }
     }
 
+    /**
+     * Generates an expression that compares a specific element of two binary 
tuples, assuming that inner element is partial.
+     */
+    private static BytecodeExpression comparePartialTupleElement(
+            CatalogColumnCollation collation,
+            NativeType nativeType,
+            ComparisonVariables vars
+    ) {
+        switch (nativeType.spec()) {
+            case TIMESTAMP:
+                return staticCompare(collation, vars, UTILS_TIMESTAMP_COMPARE, 
true);
+            case UUID:
+                return staticCompare(collation, vars, UTILS_UUID_COMPARE, 
false);
+            case STRING:
+                return staticCompare(collation, vars, UTILS_STRING_COMPARE, 
true);
+            case BYTE_ARRAY:
+                return staticCompare(collation, vars, UTILS_BYTES_COMPARE, 
true);
+            default:
+                return constantInt(0);
+        }
+    }
+
     /**
      * Generates an expression for comparison that looks like this: {@code 
comparator(extractor(value 1), extractor(value 2))}, where values
      * will be chosen depending on column's collation. "Composite" means the 
usage of methods composition in generated code.
diff --git 
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorOptions.java
 
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorOptions.java
index cbe7e9c6640..284af0464be 100644
--- 
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorOptions.java
+++ 
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorOptions.java
@@ -37,18 +37,22 @@ public class JitComparatorOptions {
 
     private final boolean supportPrefixes;
 
+    private final boolean supportPartialComparison;
+
     private JitComparatorOptions(
             List<CatalogColumnCollation> columnCollations,
             List<NativeType> columnTypes,
             List<Boolean> nullableFlags,
             String className,
-            boolean supportPrefixes
+            boolean supportPrefixes,
+            boolean supportPartialComparison
     ) {
         this.columnCollations = columnCollations;
         this.columnTypes = columnTypes;
         this.nullableFlags = nullableFlags;
         this.className = className;
         this.supportPrefixes = supportPrefixes;
+        this.supportPartialComparison = supportPartialComparison;
     }
 
     public List<CatalogColumnCollation> columnCollations() {
@@ -71,6 +75,10 @@ public class JitComparatorOptions {
         return supportPrefixes;
     }
 
+    public boolean supportPartialComparison() {
+        return supportPartialComparison;
+    }
+
     /**
      * Creates a builder for {@link JitComparatorOptions}.
      *
@@ -89,6 +97,7 @@ public class JitComparatorOptions {
         private List<Boolean> nullableFlags;
         private String className;
         private boolean supportPrefixes;
+        private boolean supportPartialComparison;
 
         public JitComparatorOptionsBuilder 
columnCollations(List<CatalogColumnCollation> columnCollations) {
             this.columnCollations = columnCollations;
@@ -115,6 +124,11 @@ public class JitComparatorOptions {
             return this;
         }
 
+        public JitComparatorOptionsBuilder supportPartialComparison(boolean 
supportPartialComparison) {
+            this.supportPartialComparison = supportPartialComparison;
+            return this;
+        }
+
         /**
          * Builds a new {@link JitComparatorOptions} instance.
          */
@@ -127,7 +141,13 @@ public class JitComparatorOptions {
                 throw new IllegalArgumentException("Column collations, types, 
and nullable flags must have the same size");
             }
 
-            return new JitComparatorOptions(columnCollations, columnTypes, 
nullableFlags, className, supportPrefixes);
+            return new JitComparatorOptions(
+                    columnCollations,
+                    columnTypes,
+                    nullableFlags,
+                    className,
+                    supportPrefixes,
+                    supportPartialComparison);
         }
     }
 }
diff --git 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorTest.java
 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorTest.java
index 21fc84706fa..1eeca31dab2 100644
--- 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorTest.java
+++ 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorTest.java
@@ -41,6 +41,7 @@ public class JitComparatorTest extends 
BinaryTupleComparatorBaseTest {
                 .columnTypes(columnTypes)
                 .nullableFlags(Collections.nCopies(columnTypes.size(), true))
                 .supportPrefixes(true)
+                .supportPartialComparison(true)
                 .build()
         );
 
@@ -55,4 +56,9 @@ public class JitComparatorTest extends 
BinaryTupleComparatorBaseTest {
                     : comparator.compare(leftAccessor, left.capacity(), 
rightAccessor, right.capacity());
         };
     }
+
+    @Override
+    protected boolean supportsPartialComparison() {
+        return true;
+    }
 }

Reply via email to