korlov42 commented on code in PR #2728:
URL: https://github.com/apache/ignite-3/pull/2728#discussion_r1370039959


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTuplePrefix.java:
##########
@@ -51,13 +52,36 @@ public BinaryTuplePrefix(int elementCount, ByteBuffer 
buffer) {
         super(elementCount, buffer);
     }
 
+    /**
+     * Creates a prefix from provided {@link BinaryTuple}. If given tuple has 
lesser or equal number of
+     * columns, then all elements will be used in resulting prefix. If given 
tuple has more columns, then
+     * excess columns will be truncated.
+     *
+     * @param size The size of the complete tuple.
+     * @param tuple Tuple to create a prefix from.
+     * @return Prefix, created from provided tuple with regards to desired 
size.
+     */
+    public static BinaryTuplePrefix fromBinaryTuple(int size, BinaryTuple 
tuple) {
+        if (size == tuple.elementCount()) {
+            return entireTuple(tuple);
+        } else if (size > tuple.elementCount()) {

Review Comment:
   because, although they have pretty similar name, it's a complete different 
object. Prefix is a part of index api, it represents partially filled search 
bound of a particular index. BinaryTuple, on the other hand, is a general 
purpose container.
   
   So we have general purpose container that we want to reuse as search bound, 
but we got only relevant fields in it. In that case, size of BinaryTuple will 
be less than full size of index-related BinaryTuplePrefix



-- 
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