You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ibessonov (via GitHub)" <gi...@apache.org> on 2023/06/07 14:43:17 UTC

[GitHub] [ignite-3] ibessonov commented on a diff in pull request #2150: IGNITE-19657 Remove schema from BinaryTuple implementation

ibessonov commented on code in PR #2150:
URL: https://github.com/apache/ignite-3/pull/2150#discussion_r1221549641


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTuplePrefix.java:
##########
@@ -75,17 +71,17 @@ public static BinaryTuplePrefix fromBinaryTuple(BinaryTuple tuple) {
 
         prefixBuffer.put(0, (byte) (flags | PREFIX_FLAG));
 
-        return new BinaryTuplePrefix(tuple.schema(), prefixBuffer);
+        return new BinaryTuplePrefix(tuple.elementCount(), prefixBuffer);
     }
 
     @Override
-    public int count() {
-        return elementCount();
+    public BigDecimal decimalValue(int col) {
+        throw new UnsupportedOperationException("Must never be called, use BinaryTupleSchema#decimalValue instead");
     }
 
     @Override
-    public BigDecimal decimalValue(int index) {
-        return decimalValue(index, schema.element(index).decimalScale);
+    public int count() {
+        return elementCount();

Review Comment:
   What is the reason for having two different methods for count?
   Would it be difficult to unite them?



##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTuple.java:
##########
@@ -27,59 +27,33 @@
  * elements as objects.
  */
 public class BinaryTuple extends BinaryTupleReader implements InternalTuple {
-    /** Tuple schema. */
-    private final BinaryTupleSchema schema;
-
     /**
      * Constructor.
      *
-     * @param schema Tuple schema.
+     * @param elementCount Number of tuple elements.
      * @param bytes Binary tuple.
      */
-    public BinaryTuple(BinaryTupleSchema schema, byte[] bytes) {
-        super(schema.elementCount(), bytes);
-        this.schema = schema;
+    public BinaryTuple(int elementCount, byte[] bytes) {
+        super(elementCount, bytes);
     }
 
     /**
      * Constructor.
      *
-     * @param schema Tuple schema.
+     * @param elementCount Number of tuple elements.
      * @param buffer Buffer with a binary tuple.
      */
-    public BinaryTuple(BinaryTupleSchema schema, ByteBuffer buffer) {
-        super(schema.elementCount(), buffer);
-        this.schema = schema;
+    public BinaryTuple(int elementCount, ByteBuffer buffer) {
+        super(elementCount, buffer);
     }
 
-    /** {@inheritDoc} */
     @Override
-    public int count() {
-        return elementCount();
+    public BigDecimal decimalValue(int col) {

Review Comment:
   What if we add a precision here as a parameter? Otherwise the method makes no sense



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