korlov42 commented on a change in pull request #201:
URL: https://github.com/apache/ignite-3/pull/201#discussion_r672158874



##########
File path: 
modules/schema/src/main/java/org/apache/ignite/internal/schema/mapping/ColumnMapperImpl.java
##########
@@ -17,34 +17,56 @@
 
 package org.apache.ignite.internal.schema.mapping;
 
+import org.apache.ignite.internal.schema.Column;
+import org.apache.ignite.internal.schema.SchemaDescriptor;
+import org.jetbrains.annotations.NotNull;
+
 /**
  * Column mapper implementation.
  */
 class ColumnMapperImpl implements ColumnMapper, ColumnMapperBuilder {
     /** Mapping. */
     private final int[] mapping;
 
+    /** Mapped columns. */
+    private final Column[] cols;
+
     /**
-     * @param cols Number of columns.
+     * @param schema Schema descriptor.
      */
-    ColumnMapperImpl(int cols) {
-        mapping = new int[cols];
+    ColumnMapperImpl(SchemaDescriptor schema) {
+        mapping = new int[schema.length()];
+        cols = new Column[schema.length()];
 
-        for (int i = 0; i < mapping.length; i++)
+        for (int i = 0; i < mapping.length; i++) {
             mapping[i] = i;
+            cols[i] = schema.column(i);
+        }
     }
 
     /** {@inheritDoc} */
-    @Override public void add(int from, int to) {
+    @Override public ColumnMapperImpl add(@NotNull Column col) {
+        add(col.schemaIndex(), -1, col);

Review comment:
       this invocation violates contract from javadoc: `col` is a target column 
descriptor, but if there is no such column in target (to==-1), then there 
should not be any descriptor




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


Reply via email to