tkalkirill commented on code in PR #12926:
URL: https://github.com/apache/ignite/pull/12926#discussion_r2996157248


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/IndexScan.java:
##########
@@ -486,4 +500,48 @@ private int compare(IndexRow o1, IndexRow o2) {
             throw new IgniteException(e);
         }
     }
+
+    /** */
+    private Row unwrapKeyFieldForPkIndex(Row row) {
+        RowHandler<Row> rowHnd = ectx.rowHandler();
+
+        Object key = rowHnd.get(QueryUtils.KEY_COL, row);
+        assert key != null : String.format("idxName=%s, row=%s", idx.name(), 
rowHnd.toString(row));
+
+        if (key instanceof BinaryObject)
+            return toRowForPk((BinaryObject)key);
+
+        return toRowForPk(key);
+    }
+
+    /** */
+    private Row toRowForPk(BinaryObject o) {
+        assert 
o.type().typeName().equals(idx.indexDefinition().typeDescriptor().keyTypeName())
 : String.format(
+            "idx=%s, o=%s, oType=%s, idxKeyType=%s",
+            idx.name(), o, o.type().typeName(), 
idx.indexDefinition().typeDescriptor().keyTypeName()
+        );
+
+        RowHandler<Row> rowHnd = ectx.rowHandler();
+        Row row = factory.create();
+
+        for (String keyName : 
idx.indexDefinition().indexKeyDefinitions().keySet()) {
+            ColumnDescriptor fieldDesc = desc.columnDescriptor(keyName);
+            assert fieldDesc != null : String.format("idx=%s, o=%s, 
keyName=%s", idx.name(), o, keyName);
+
+            rowHnd.set(fieldDesc.fieldIndex(), row, o.field(keyName));
+        }
+
+        return row;
+    }
+
+    /** */
+    // TODO: IGNITE-28374 Fix it
+    private Row toRowForPk(Object o) {
+        assert 
o.getClass().getName().equals(idx.indexDefinition().typeDescriptor().keyTypeName())
 : String.format(
+            "idx=%s, o=%s, oType=%s, idxKeyType=%s",
+            idx.name(), o, o.getClass().getName(), 
idx.indexDefinition().typeDescriptor().keyTypeName()
+        );
+
+        throw new 
UnsupportedOperationException("https://issues.apache.org/jira/browse/IGNITE-28374";);

Review Comment:
   I checked the test after removing my modification.
   The result will be empty, so I'll probably leave the behavior as is.



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