AMashenkov commented on a change in pull request #201:
URL: https://github.com/apache/ignite-3/pull/201#discussion_r672181286
##########
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 means a new column was added and the old schema has no column the
given one is mapped to.
So, we have to save the poison index (-1) and the current descriptor to be
able to see a correct default value during further updates.
--
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]