AMashenkov commented on code in PR #1700:
URL: https://github.com/apache/ignite-3/pull/1700#discussion_r1115936451
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/IgniteMdFragmentMapping.java:
##########
@@ -219,6 +221,26 @@ public FragmentMapping fragmentMapping(IgniteValues rel,
RelMetadataQuery mq, Ma
return FragmentMapping.create(rel.sourceId(), group);
}
+ /**
+ * See {@link IgniteMdFragmentMapping#fragmentMapping(RelNode,
RelMetadataQuery, MappingQueryContext)}.
+ */
+ public FragmentMapping fragmentMapping(IgniteTableModify rel,
RelMetadataQuery mq, MappingQueryContext ctx) {
+ FragmentMapping mapping =
fragmentMappingForMetadataQuery(rel.getInput(), mq, ctx);
+
+ // In case of the statement like UPDATE t SET a = a + 1
+ // this will be the second call to the collation group, hence the
result may differ.
+ // But such query should be rejected during execution, since we will
try to do RW read
+ // from replica that is not primary anymore.
+ List<NodeWithTerm> assignments =
rel.getTable().unwrap(IgniteTable.class)
+ .colocationGroup(ctx).assignments().stream()
+ .map(CollectionUtils::first)
+ .collect(Collectors.toList());
Review Comment:
I think we should revisit all the places where we process assignment and
replace streams with iteration to avoid possible redundant array allocations.
Maybe CollectionUtils is a good place for a new function that will collect
1-st items from lists.
--
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]