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 2021/03/24 17:24:00 UTC

[GitHub] [ignite-3] AMashenkov opened a new pull request #73: IGNITE-14330: Implement table binary views.

AMashenkov opened a new pull request #73:
URL: https://github.com/apache/ignite-3/pull/73


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] alievmirza commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
alievmirza commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r608525050



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/InternalTable.java
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) undeBinaryRow one oBinaryRow more
+ * contributoBinaryRow license agreements.  See the NOTICE file distributed with
+ * this work foBinaryRow additional information regarding copyright ownership.
+ * The ASF licenses this file to You undeBinaryRow the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law oBinaryRow agreed to in writing, software
+ * distributed undeBinaryRow the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OBinaryRow CONDITIONS OF ANY KIND, eitheBinaryRow express oBinaryRow implied.
+ * See the License foBinaryRow the specific language governing permissions and
+ * limitations undeBinaryRow the License.
+ */
+
+package org.apache.ignite.internal.table;
+
+import java.util.Collection;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.schema.BinaryRow;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Internal table facade provides low-level methods foBinaryRow table operations.

Review comment:
       Seems that you somewhere replaced 'R' symbol in this file with 'BinaryRow'




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] AMashenkov commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
AMashenkov commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r610772430



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/RecordViewImpl.java
##########
@@ -78,7 +97,7 @@ public RecordViewImpl(TableStorage tbl, RecordMapper<R> mapper) {
     }
 
     /** {@inheritDoc} */
-    @Override public @NotNull IgniteFuture<Collection<R>> getAllAsync(Collection<R> keyRecs) {
+    @Override public @NotNull CompletableFuture<Collection<R>> getAllAsync(Collection<R> keyRecs) {

Review comment:
       Oh, Gotcha!
   Implementaion is incomplete yet, I'll throw an exception.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sk0x50 commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
sk0x50 commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r609789094



##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java
##########
@@ -338,6 +340,17 @@ public void appendBitmask(BitSet bitSet) {
      * @return Serialized row.
      */
     public byte[] build() {
+        if (schema.keyColumns() == curCols)
+            throw new IllegalStateException("Key column missed: colIdx=" + curCol);
+        else {
+            if (curCol == 0)
+                flags |= BinaryRow.RowFlags.NULL_VALUE;
+            else if (schema.valueColumns().length() != curCol)
+            throw new IllegalStateException("Value column missed: colIdx=" + curCol);

Review comment:
       Well, it seems that we need IGNITE-14495 to be merged first.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] AMashenkov commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
AMashenkov commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r610752303



##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java
##########
@@ -17,167 +17,217 @@
 
 package org.apache.ignite.internal.schema;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
 import java.util.BitSet;
 import java.util.UUID;
 
 /**
+ * Schema-aware row.
+ *
  * The class contains non-generic methods to read boxed and unboxed primitives based on the schema column types.
  * Any type conversions and coercions should be implemented outside the row by the key-value or query runtime.
  * When a non-boxed primitive is read from a null column value, it is converted to the primitive type default value.
  */
-public abstract class Row {
-    /** */
-    public static final int SCHEMA_VERSION_OFFSET = 0;
-
-    /** */
-    public static final int FLAGS_FIELD_OFFSET = SCHEMA_VERSION_OFFSET + 2;
-
-    /** */
-    public static final int KEY_HASH_FIELD_OFFSET = FLAGS_FIELD_OFFSET + 2;
-
-    /** */
-    public static final int KEY_CHUNK_OFFSET = KEY_HASH_FIELD_OFFSET + 4;
-
-    /** */
-    public static final int TOTAL_LEN_FIELD_SIZE = 4;
-
-    /** */
-    public static final int VARLEN_TABLE_SIZE_FIELD_SIZE = 2;
-
-    /** */
-    public static final int VARLEN_COLUMN_OFFSET_FIELD_SIZE = 2;
+public class Row implements BinaryRow {
+    /** Schema descriptor. */
+    private final SchemaDescriptor schema;
 
-    /** */
-    public static final class RowFlags {
-        /** Tombstone flag. */
-        public static final int TOMBSTONE = 1;
+    /** Binary row. */
+    private final BinaryRow row;
 
-        /** Null-value flag. */
-        public static final int NULL_VALUE = 1 << 1;
+    /**
+     * Constructor.
+     *
+     * @param schema Schema.
+     * @param row Binary row representation.
+     */
+    public Row(SchemaDescriptor schema, BinaryRow row) {
+        assert row.schemaVersion() == schema.version();
 
-        /** Stub. */
-        private RowFlags() {
-        }
+        this.row = row;
+        this.schema = schema;
     }
 
-    /** Schema descriptor for which this row was created. */
-    private final SchemaDescriptor schema;
-
     /**
-     * @param schema Schema instance.
+     * @return Row schema.
      */
-    protected Row(SchemaDescriptor schema) {
-        this.schema = schema;
+    public SchemaDescriptor rowSchema() {
+        return schema;
     }
 
     /**
      * @return {@code True} if row has non-null value, {@code false} otherwise.
      */
-    public boolean hasValue() {
-        short flags = readShort(FLAGS_FIELD_OFFSET);
-
-        return (flags & (RowFlags.NULL_VALUE | RowFlags.TOMBSTONE)) == 0;
+    @Override public boolean hasValue() {
+        return row.hasValue();
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public byte byteValue(int col) {
+    public byte byteValue(int col) throws InvalidTypeException {
         long off = findColumn(col, NativeTypeSpec.BYTE);
 
         return off < 0 ? 0 : readByte(offset(off));
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public Byte byteValueBoxed(int col) {
+    public Byte byteValueBoxed(int col) throws InvalidTypeException {
         long off = findColumn(col, NativeTypeSpec.BYTE);
 
         return off < 0 ? null : readByte(offset(off));
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public short shortValue(int col) {
+    public short shortValue(int col) throws InvalidTypeException {
         long off = findColumn(col, NativeTypeSpec.SHORT);
 
         return off < 0 ? 0 : readShort(offset(off));
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public Short shortValueBoxed(int col) {
+    public Short shortValueBoxed(int col) throws InvalidTypeException {

Review comment:
       "shortValue()" can't return 'null' but column can be NULLABLE.
   But we can't leave "shortValueBoxed()" only to avoid unwanted boxing/unboxing in some scenarios.
   E.g. to read a value from Row and write it directly to user POJO via reflection/VahHandle.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sk0x50 commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
sk0x50 commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r609746143



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/InternalTable.java
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) undeBinaryRow one oBinaryRow more
+ * contributoBinaryRow license agreements.  See the NOTICE file distributed with
+ * this work foBinaryRow additional information regarding copyright ownership.
+ * The ASF licenses this file to You undeBinaryRow the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law oBinaryRow agreed to in writing, software
+ * distributed undeBinaryRow the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OBinaryRow CONDITIONS OF ANY KIND, eitheBinaryRow express oBinaryRow implied.
+ * See the License foBinaryRow the specific language governing permissions and
+ * limitations undeBinaryRow the License.
+ */
+
+package org.apache.ignite.internal.table;
+
+import java.util.Collection;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.schema.BinaryRow;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Internal table facade provides low-level methods foBinaryRow table operations.
+ * The facade hides TX/replication protocol oBinaryRow table storage abstractions.
+ */
+public interface InternalTable {
+    /**
+     * Asynchronously gets a record with same key columns values as given one from the table.

Review comment:
       It seems to me that `record` should be changed to `row`.

##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java
##########
@@ -338,6 +340,17 @@ public void appendBitmask(BitSet bitSet) {
      * @return Serialized row.
      */
     public byte[] build() {
+        if (schema.keyColumns() == curCols)
+            throw new IllegalStateException("Key column missed: colIdx=" + curCol);
+        else {
+            if (curCol == 0)
+                flags |= BinaryRow.RowFlags.NULL_VALUE;
+            else if (schema.valueColumns().length() != curCol)
+            throw new IllegalStateException("Value column missed: colIdx=" + curCol);

Review comment:
       Does it make sense to change `IllegalStateException` to a new `IgniteInternalException`?

##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRow.java
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.schema;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+/**
+ * Binary row interface.
+ * The class contains low-level methods to read row data.
+ */
+public interface BinaryRow {
+    /** */
+    int SCHEMA_VERSION_OFFSET = 0;
+    /** */
+    int FLAGS_FIELD_OFFSET = SCHEMA_VERSION_OFFSET + 2;
+    /** */
+    int KEY_HASH_FIELD_OFFSET = FLAGS_FIELD_OFFSET + 2;
+    /** */
+    int KEY_CHUNK_OFFSET = KEY_HASH_FIELD_OFFSET + 4;
+    /** */
+    int TOTAL_LEN_FIELD_SIZE = 4;
+    /** */
+    int VARLEN_TABLE_SIZE_FIELD_SIZE = 2;
+    /** */
+    int VARLEN_COLUMN_OFFSET_FIELD_SIZE = 2;
+
+    /**
+     * @return Row schema version.
+     */
+    int schemaVersion();
+
+    /**
+     * @return {@code True} if row has non-null value, {@code false} otherwise.
+     */
+    boolean hasValue();
+
+    // TODO: IGNITE-14199. Add row version.
+    //GridRowVersion version();
+
+    /**
+     * Row hash code is a result of hash function applied to the row affinity columns values.
+     *
+     * @return Row hash code.
+     */
+    int hash();
+
+    /**
+     * @return ByteBuffer slice representing the key chunk.
+     */
+    ByteBuffer keySlice();
+
+    /**
+     * @return ByteBuffer slice representing the value chunk.
+     */
+    ByteBuffer valueSlice();
+
+    /**
+     * Writes binary row to given stream.
+     *
+     * @throws IOException If write operation fails.
+     */
+    // TODO: support other target types in writeTo() if needed.

Review comment:
       It would be nice to have a Jira ticket for all TODOs

##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java
##########
@@ -17,69 +17,55 @@
 
 package org.apache.ignite.internal.schema;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
 import java.util.BitSet;
 import java.util.UUID;
 
 /**
+ * Schema-aware row.
+ *
  * The class contains non-generic methods to read boxed and unboxed primitives based on the schema column types.
  * Any type conversions and coercions should be implemented outside the row by the key-value or query runtime.
  * When a non-boxed primitive is read from a null column value, it is converted to the primitive type default value.
  */
-public abstract class Row {
-    /** */
-    public static final int SCHEMA_VERSION_OFFSET = 0;
-
-    /** */
-    public static final int FLAGS_FIELD_OFFSET = SCHEMA_VERSION_OFFSET + 2;
-
-    /** */
-    public static final int KEY_HASH_FIELD_OFFSET = FLAGS_FIELD_OFFSET + 2;
-
-    /** */
-    public static final int KEY_CHUNK_OFFSET = KEY_HASH_FIELD_OFFSET + 4;
-
-    /** */
-    public static final int TOTAL_LEN_FIELD_SIZE = 4;
-
-    /** */
-    public static final int VARLEN_TABLE_SIZE_FIELD_SIZE = 2;
-
-    /** */
-    public static final int VARLEN_COLUMN_OFFSET_FIELD_SIZE = 2;
+public class Row implements BinaryRow {
+    /** Schema descriptor. */
+    private final SchemaDescriptor schema;
 
-    /** */
-    public static final class RowFlags {
-        /** Tombstone flag. */
-        public static final int TOMBSTONE = 1;
+    /** Binary row. */
+    private final BinaryRow row;
 
-        /** Null-value flag. */
-        public static final int NULL_VALUE = 1 << 1;
+    /**
+     * Constructor.
+     *
+     * @param schema Schema.
+     * @param row Binary row representation.
+     */
+    public Row(SchemaDescriptor schema, BinaryRow row) {
+        assert row.schemaVersion() == schema.version();
 
-        /** Stub. */
-        private RowFlags() {
-        }
+        this.row = row;
+        this.schema = schema;
     }
 
-    /** Schema descriptor for which this row was created. */
-    private final SchemaDescriptor schema;
-
     /**
-     * @param schema Schema instance.
+     * @return Row schema.
      */
-    protected Row(SchemaDescriptor schema) {
-        this.schema = schema;
+    public SchemaDescriptor rowSchema() {
+        return schema;
     }
 
     /**
      * @return {@code True} if row has non-null value, {@code false} otherwise.
      */
-    public boolean hasValue() {
-        short flags = readShort(FLAGS_FIELD_OFFSET);
-
-        return (flags & (RowFlags.NULL_VALUE | RowFlags.TOMBSTONE)) == 0;
+    @Override public boolean hasValue() {
+        return row.hasValue();
     }
 
     /**
+     *

Review comment:
       Please describe the contract of this method.
   What happens if the required column has a different type.
   What happens if the row does not have a value.

##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/InternalTable.java
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) undeBinaryRow one oBinaryRow more
+ * contributoBinaryRow license agreements.  See the NOTICE file distributed with
+ * this work foBinaryRow additional information regarding copyright ownership.
+ * The ASF licenses this file to You undeBinaryRow the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law oBinaryRow agreed to in writing, software
+ * distributed undeBinaryRow the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OBinaryRow CONDITIONS OF ANY KIND, eitheBinaryRow express oBinaryRow implied.
+ * See the License foBinaryRow the specific language governing permissions and
+ * limitations undeBinaryRow the License.
+ */
+
+package org.apache.ignite.internal.table;
+
+import java.util.Collection;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.schema.BinaryRow;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Internal table facade provides low-level methods foBinaryRow table operations.

Review comment:
       What do `foBinaryRow` and `oBinaryRow` mean?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] ascherbakoff commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
ascherbakoff commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r610670298



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/RecordViewImpl.java
##########
@@ -78,7 +97,7 @@ public RecordViewImpl(TableStorage tbl, RecordMapper<R> mapper) {
     }
 
     /** {@inheritDoc} */
-    @Override public @NotNull IgniteFuture<Collection<R>> getAllAsync(Collection<R> keyRecs) {
+    @Override public @NotNull CompletableFuture<Collection<R>> getAllAsync(Collection<R> keyRecs) {

Review comment:
       Why null is returned but the annotation specifies notnull ?

##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/Row.java
##########
@@ -17,167 +17,217 @@
 
 package org.apache.ignite.internal.schema;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
 import java.util.BitSet;
 import java.util.UUID;
 
 /**
+ * Schema-aware row.
+ *
  * The class contains non-generic methods to read boxed and unboxed primitives based on the schema column types.
  * Any type conversions and coercions should be implemented outside the row by the key-value or query runtime.
  * When a non-boxed primitive is read from a null column value, it is converted to the primitive type default value.
  */
-public abstract class Row {
-    /** */
-    public static final int SCHEMA_VERSION_OFFSET = 0;
-
-    /** */
-    public static final int FLAGS_FIELD_OFFSET = SCHEMA_VERSION_OFFSET + 2;
-
-    /** */
-    public static final int KEY_HASH_FIELD_OFFSET = FLAGS_FIELD_OFFSET + 2;
-
-    /** */
-    public static final int KEY_CHUNK_OFFSET = KEY_HASH_FIELD_OFFSET + 4;
-
-    /** */
-    public static final int TOTAL_LEN_FIELD_SIZE = 4;
-
-    /** */
-    public static final int VARLEN_TABLE_SIZE_FIELD_SIZE = 2;
-
-    /** */
-    public static final int VARLEN_COLUMN_OFFSET_FIELD_SIZE = 2;
+public class Row implements BinaryRow {
+    /** Schema descriptor. */
+    private final SchemaDescriptor schema;
 
-    /** */
-    public static final class RowFlags {
-        /** Tombstone flag. */
-        public static final int TOMBSTONE = 1;
+    /** Binary row. */
+    private final BinaryRow row;
 
-        /** Null-value flag. */
-        public static final int NULL_VALUE = 1 << 1;
+    /**
+     * Constructor.
+     *
+     * @param schema Schema.
+     * @param row Binary row representation.
+     */
+    public Row(SchemaDescriptor schema, BinaryRow row) {
+        assert row.schemaVersion() == schema.version();
 
-        /** Stub. */
-        private RowFlags() {
-        }
+        this.row = row;
+        this.schema = schema;
     }
 
-    /** Schema descriptor for which this row was created. */
-    private final SchemaDescriptor schema;
-
     /**
-     * @param schema Schema instance.
+     * @return Row schema.
      */
-    protected Row(SchemaDescriptor schema) {
-        this.schema = schema;
+    public SchemaDescriptor rowSchema() {
+        return schema;
     }
 
     /**
      * @return {@code True} if row has non-null value, {@code false} otherwise.
      */
-    public boolean hasValue() {
-        short flags = readShort(FLAGS_FIELD_OFFSET);
-
-        return (flags & (RowFlags.NULL_VALUE | RowFlags.TOMBSTONE)) == 0;
+    @Override public boolean hasValue() {
+        return row.hasValue();
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public byte byteValue(int col) {
+    public byte byteValue(int col) throws InvalidTypeException {
         long off = findColumn(col, NativeTypeSpec.BYTE);
 
         return off < 0 ? 0 : readByte(offset(off));
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public Byte byteValueBoxed(int col) {
+    public Byte byteValueBoxed(int col) throws InvalidTypeException {
         long off = findColumn(col, NativeTypeSpec.BYTE);
 
         return off < 0 ? null : readByte(offset(off));
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public short shortValue(int col) {
+    public short shortValue(int col) throws InvalidTypeException {
         long off = findColumn(col, NativeTypeSpec.SHORT);
 
         return off < 0 ? 0 : readShort(offset(off));
     }
 
     /**
+     * Reads value for specified column.
+     *
+     * @param col Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the requested column type.
      */
-    public Short shortValueBoxed(int col) {
+    public Short shortValueBoxed(int col) throws InvalidTypeException {

Review comment:
       What is the point in having *Boxed methods ?
   Boxed value will be created by autoboxing:
   Short val = shortValue(0);

##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/KVViewImpl.java
##########
@@ -222,7 +235,42 @@ public KVViewImpl(TableStorage tbl, KeyMapper<K> keyMapper, ValueMapper<V> value
     /**
      * @return Marshaller.
      */
-    private Marshaller marshaller() {
+    private KVSerializer<K, V> marshaller() {
         return null;        // table.schemaManager().marshaller();
     }
+
+    /**
+     * @param row Binary row.
+     * @return Schema-aware row.
+     */
+    private Row wrap(BinaryRow row) {
+        if (row == null)
+            return null;
+
+        final SchemaDescriptor rowSchema = schemaMgr.schema(row.schemaVersion()); // Get a schema for row.
+
+        return new Row(rowSchema, row);
+    }
+
+    /**
+     * Waits for operation completion.
+     *
+     * @param fut Future to wait to.
+     * @return Future result.
+     */
+    private <T> T sync(CompletableFuture<T> fut) {

Review comment:
       This method has occured 4 times. Can the copy paste be removed ?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] AMashenkov merged pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
AMashenkov merged pull request #73:
URL: https://github.com/apache/ignite-3/pull/73


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] alievmirza commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
alievmirza commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r608538095



##########
File path: modules/core/src/main/java/org/apache/ignite/lang/IgniteRuntimeException.java
##########
@@ -17,11 +17,18 @@
 
 package org.apache.ignite.lang;
 
-import java.util.concurrent.CompletionStage;
-import java.util.concurrent.Future;
-
 /**
- * Future providing chaining capabilities for the construction of computation pipelines.
+ * Ignite runtime exception base class.
  */
-public interface IgniteFuture<T> extends CompletionStage<T>, Future<T> {
+public class IgniteRuntimeException extends RuntimeException {

Review comment:
       seems that we can reuse `IgniteInternalException`




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sk0x50 commented on a change in pull request #73: IGNITE-14330: Implement table binary views.

Posted by GitBox <gi...@apache.org>.
sk0x50 commented on a change in pull request #73:
URL: https://github.com/apache/ignite-3/pull/73#discussion_r609789094



##########
File path: modules/schema/src/main/java/org/apache/ignite/internal/schema/RowAssembler.java
##########
@@ -338,6 +340,17 @@ public void appendBitmask(BitSet bitSet) {
      * @return Serialized row.
      */
     public byte[] build() {
+        if (schema.keyColumns() == curCols)
+            throw new IllegalStateException("Key column missed: colIdx=" + curCol);
+        else {
+            if (curCol == 0)
+                flags |= BinaryRow.RowFlags.NULL_VALUE;
+            else if (schema.valueColumns().length() != curCol)
+            throw new IllegalStateException("Value column missed: colIdx=" + curCol);

Review comment:
       Well, it seems that we need IGNITE-14495 to be merged.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org