zstan commented on code in PR #3335:
URL: https://github.com/apache/ignite-3/pull/3335#discussion_r1523011346
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/DestinationFactory.java:
##########
@@ -91,21 +91,26 @@ Destination<RowT> createDestination(IgniteDistribution
distribution, ColocationG
assert !nullOrEmpty(group.assignments()) && !nullOrEmpty(keys);
- List<String> assignments =
Commons.transform(group.assignments(), NodeWithConsistencyToken::name);
-
if (function.affinity()) {
int tableId = ((AffinityDistribution) function).tableId();
Supplier<PartitionCalculator> calculator =
dependencies.partitionCalculator(tableId);
TableDescriptor tableDescriptor =
dependencies.tableDescriptor(tableId);
var resolver = new
TablePartitionExtractor<>(calculator.get(), keys.toIntArray(), tableDescriptor,
rowHandler);
- return new Partitioned<>(assignments, resolver);
+ return new Partitioned<>(group.assignments(), resolver);
}
var resolver = new
RehashingPartitionExtractor<>(group.nodeNames().size(), keys.toIntArray(),
rowHandler);
- return new Partitioned<>(group.nodeNames(), resolver);
+ Int2ObjectMap<NodeWithConsistencyToken> assignments = new
Int2ObjectOpenHashMap<>();
+ int pos = 0;
+
+ for (String name : group.nodeNames()) {
+ assignments.put(pos++, new NodeWithConsistencyToken(name,
0));
Review Comment:
fixed
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/DestinationFactory.java:
##########
@@ -91,21 +91,26 @@ Destination<RowT> createDestination(IgniteDistribution
distribution, ColocationG
assert !nullOrEmpty(group.assignments()) && !nullOrEmpty(keys);
- List<String> assignments =
Commons.transform(group.assignments(), NodeWithConsistencyToken::name);
-
if (function.affinity()) {
int tableId = ((AffinityDistribution) function).tableId();
Supplier<PartitionCalculator> calculator =
dependencies.partitionCalculator(tableId);
TableDescriptor tableDescriptor =
dependencies.tableDescriptor(tableId);
var resolver = new
TablePartitionExtractor<>(calculator.get(), keys.toIntArray(), tableDescriptor,
rowHandler);
- return new Partitioned<>(assignments, resolver);
+ return new Partitioned<>(group.assignments(), resolver);
}
var resolver = new
RehashingPartitionExtractor<>(group.nodeNames().size(), keys.toIntArray(),
rowHandler);
- return new Partitioned<>(group.nodeNames(), resolver);
+ Int2ObjectMap<NodeWithConsistencyToken> assignments = new
Int2ObjectOpenHashMap<>();
+ int pos = 0;
+
+ for (String name : group.nodeNames()) {
+ assignments.put(pos++, new NodeWithConsistencyToken(name,
0));
Review Comment:
enlistmentConsistencyToken is not used in Partitioned class logic, seems to
be more clear we need new map here but reuse already existing structure is also
good as for me - reduce gc pressure, 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]