ademakov commented on code in PR #898:
URL: https://github.com/apache/ignite-3/pull/898#discussion_r905991878
##########
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:
Is is specified this way in IEP-92:
https://cwiki.apache.org/confluence/display/IGNITE/IEP-92%3A+Binary+Tuple+Format#IEP92:BinaryTupleFormat-NumberandDecimalrepresentation
If you don't agree with this approach let's discuss it at some IEP-92
related place. On slack, wiki, dev-list, or whatever works best.
##########
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:
It is specified this way in IEP-92:
https://cwiki.apache.org/confluence/display/IGNITE/IEP-92%3A+Binary+Tuple+Format#IEP92:BinaryTupleFormat-NumberandDecimalrepresentation
If you don't agree with this approach let's discuss it at some IEP-92
related place. On slack, wiki, dev-list, or whatever works best.
--
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]