korlov42 commented on code in PR #1191:
URL: https://github.com/apache/ignite-3/pull/1191#discussion_r1000412219
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java:
##########
@@ -364,15 +295,79 @@ public void onShutdown() {
}
}
- /**
- * Extracts a key and a value from the {@link BinaryRow} and wraps it in a
{@link DataRow}.
- *
- * @param row Binary row.
- * @return Data row.
- */
- @NotNull
- private static DataRow extractAndWrapKeyValue(@NotNull BinaryRow row) {
- return new DelegatingDataRow(new BinarySearchRow(row), row.bytes());
+ private void addToIndexes(BinaryRow tableRow, RowId rowId) {
+ List<IndexStorage> indexes = activeIndexes.get();
+
+ if (nullOrEmpty(indexes)) {
+ return;
+ }
+
+ for (IndexStorage index : indexes) {
+ IndexRow indexRow = toIndexRow(index, tableRow, rowId);
+
+ assert indexRow != null;
+
+ index.put(indexRow);
+ }
+ }
+
+ private @Nullable IndexRow toIndexRow(IndexStorage storage, BinaryRow
tableRow, RowId rowId) {
+ SchemaDescriptor descriptor =
schemaProvider.apply(tableRow.schemaVersion());
+
+ int[] indexedColumns = resolveIndexColumns(descriptor, storage);
+
+ if (indexedColumns == null) {
+ return null;
+ }
+
+ BinaryTupleSchema tupleSchema =
BinaryTupleSchema.createSchema(descriptor, indexedColumns);
+
+ var converter = new BinaryConverter(descriptor, tupleSchema);
+
+ ByteBuffer buffer = converter.toTuple(tableRow);
+
+ return new IndexRowImpl(new BinaryTuple(tupleSchema, buffer), rowId);
+ }
+
+ private int @Nullable [] resolveIndexColumns(SchemaDescriptor descriptor,
IndexStorage indexStorage) {
Review Comment:
yep, it was. Now this is fixed
--
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]