You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/06/24 09:27:48 UTC

[GitHub] [ignite-3] AMashenkov commented on a diff in pull request #898: IGNITE-17192 Binary Tuple Implementation

AMashenkov commented on code in PR #898:
URL: https://github.com/apache/ignite-3/pull/898#discussion_r905889680


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryTuple.java:
##########
@@ -0,0 +1,58 @@
+package org.apache.ignite.internal.schema;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import org.apache.ignite.internal.schema.row.InternalTuple;
+
+/**
+ * Utility for access to binary tuple elements as typed values and with schema knowledge that allows to read
+ * elements as objects.
+ */
+public class BinaryTuple extends BinaryTupleReader implements InternalTuple {
+    /** Tuple schema. */
+    private final BinaryTupleSchema schema;
+
+    /**
+     * Constructor.
+     *
+     * @param schema Tuple schema.
+     * @param bytes Binary tuple.
+     */
+    public BinaryTuple(BinaryTupleSchema schema, byte[] bytes) {
+        super(schema.elementCount(), bytes);
+        this.schema = schema;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param schema Tuple schema.
+     * @param buffer Buffer with a binary tuple.
+     */
+    public BinaryTuple(BinaryTupleSchema schema, ByteBuffer buffer) {
+        super(schema.elementCount(), buffer);
+        this.schema = schema;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int count() {
+        return elementCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public BigDecimal decimalValue(int index) {
+        return decimalValue(index, schema.element(index).decimalScale);

Review Comment:
   Why a scale is not a part of decimal value?



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