AMashenkov commented on code in PR #4807:
URL: https://github.com/apache/ignite-3/pull/4807#discussion_r1863668049


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/SqlRowHandler.java:
##########
@@ -107,12 +107,16 @@ public RowWrapper concat(RowWrapper left, RowWrapper 
right) {
     @Override
     public RowWrapper map(RowWrapper row, int[] mapping) {
         Object[] fields = new Object[mapping.length];
+        Builder schemaBuilder = RowSchema.builder();
+        List<TypeSpec> originalFields = row.rowSchema().fields();
 
         for (int i = 0; i < mapping.length; i++) {
-            fields[i] = row.get(mapping[i]);
+            int mappedIdx = mapping[i];
+            fields[i] = row.get(mappedIdx);
+            schemaBuilder.addField(originalFields.get(mappedIdx));
         }
 
-        return new ObjectsArrayRowWrapper(row.rowSchema(), fields);
+        return new ObjectsArrayRowWrapper(schemaBuilder.build(), fields);

Review Comment:
   Why do we have this method here, but not in RowFactory, 
   where we could validate given row schema and desired new row schema?
   
   This change will also help to avoid schema creation on every map() method 
call.
   WDYT?



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to