korlov42 commented on a change in pull request #8590:
URL: https://github.com/apache/ignite/pull/8590#discussion_r548869041



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteExchange.java
##########
@@ -72,9 +74,19 @@ public IgniteExchange(RelInput input) {
 
     /** {@inheritDoc} */
     @Override public RelOptCost computeSelfCost(RelOptPlanner planner, 
RelMetadataQuery mq) {
-        double rowCount = mq.getRowCount(this);
-        double bytesPerRow = getRowType().getFieldCount() * 4 * 
(TraitUtils.distribution(this) == IgniteDistributions.broadcast() ? 10 : 1);
-        return planner.getCostFactory().makeCost(rowCount * bytesPerRow, 
rowCount, 0);
+        double rowCount = mq.getRowCount(getInput());
+        double bytesPerRow = getRowType().getFieldCount() * 
IgniteCost.AVERAGE_FIELD_SIZE;
+        double totalBytes = rowCount * bytesPerRow;
+
+        IgniteCostFactory costFactory = 
(IgniteCostFactory)planner.getCostFactory();
+
+        if (RelDistributions.BROADCAST_DISTRIBUTED.equals(distribution))
+            // With broadcast distribution each row will be sent to the each 
distination node,
+            // thus the total bytes amount will be multiplies of the 
destination nodes count.
+            // We have no such information, so let's just multiply it by 5.
+            totalBytes *= 5;

Review comment:
       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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to