korlov42 commented on code in PR #2728:
URL: https://github.com/apache/ignite-3/pull/2728#discussion_r1369990552
##########
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:
I'm not sure what exactly you are asking...
as utility method, it must cover all possible inputs. In that particular
case, size of the given BinaryTuple may be greater, lesser, or equal to desired
number of elements in prefix. NB: I refer to `number of elements` as to size of
the full schema of search bound, not the actual number of elements in prefix
as user of this method, I want to have convenient utility method to convert
given BinaryTuple which contains only relevant fields to a proper prefix
--
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]