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



##########
File path: 
modules/schema/src/main/java/org/apache/ignite/internal/schema/registry/UpgradingRowAdapter.java
##########
@@ -31,21 +36,339 @@
     /** Column mapper. */
     private final ColumnMapper mapper;
 
+    /** Adapter schema. */
+    private final SchemaDescriptor schema;
+
     /**
-     * @param schema Schema descriptor of new version.
+     * @param schema Row adapter schema descriptor.
+     * @param rowSchema Row schema descriptor.
      * @param row Row.
      * @param mapper Column mapper.
      */
-    UpgradingRowAdapter(SchemaDescriptor schema, BinaryRow row, ColumnMapper 
mapper) {
-        super(schema, row);
+    UpgradingRowAdapter(SchemaDescriptor schema, SchemaDescriptor rowSchema, 
BinaryRow row, ColumnMapper mapper) {
+        super(rowSchema, row);
 
+        this.schema = schema;
         this.mapper = mapper;
     }
 
     /** {@inheritDoc} */
-    @Override protected long findColumn(int colIdx, NativeTypeSpec type) 
throws InvalidTypeException {
-        int mapIdx = mapper.map(colIdx);
+    @Override public SchemaDescriptor rowSchema() {
+        return schema;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int schemaVersion() {
+        return schema.version();
+    }
+
+    /**
+     * Map column.
+     *
+     * @param colIdx Column index in source schema.
+     * @return Column index in targer schema.
+     */
+    private int mapColumn(int colIdx) throws InvalidTypeException {
+        return mapper.map(colIdx);
+    }
+
+    /**
+     * Reads value for specified column.
+     *
+     * @param colIdx Column index.
+     * @return Column value.
+     * @throws InvalidTypeException If actual column type does not match the 
requested column type.
+     */
+    @Override public byte byteValue(int colIdx) throws InvalidTypeException {
+        int mappedId = mapColumn(colIdx);
+
+        Column column = mappedId < 0 ? mapper.mappedColumn(colIdx) : 
super.rowSchema().column(mappedId);

Review comment:
       looks like this could be simplified to `Column column = 
mapper.mappedColumn(colIdx)`




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