Vladsz83 commented on code in PR #12113:
URL: https://github.com/apache/ignite/pull/12113#discussion_r2226288173


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdRowCount.java:
##########
@@ -282,9 +288,21 @@ private static IntMap<KeyColumnOrigin> 
findOrigins(RelMetadataQuery mq, RelNode
             if (table == null)
                 continue;
 
-            int keyPos = 
keyColumns(table).indexOf(origin.getOriginColumnOrdinal());
+            int srcKeyColIdx = origin.getOriginColumnOrdinal();
+
+            RelDataType insertRowType = 
table.descriptor().insertRowType(Commons.typeFactory(joinInput));
+            RelDataType curRowType = origin.getOriginTable().getRowType();
+
+            assert curRowType.getFieldCount() >= insertRowType.getFieldCount();
+
+            if (curRowType.getFieldCount() > insertRowType.getFieldCount()) {
+                /** Current row type probably contains {@link 
QueryUtils#KEY_FIELD_NAME} and {@link QueryUtils#VAL_FIELD_NAME}. */
+                srcKeyColIdx -= curRowType.getFieldCount() - 
insertRowType.getFieldCount();
+            }

Review Comment:
   See new impl.



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