danny0405 commented on a change in pull request #13577:
URL: https://github.com/apache/flink/pull/13577#discussion_r505244379



##########
File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/batch/BatchExecNestedLoopJoin.scala
##########
@@ -94,7 +94,13 @@ class BatchExecNestedLoopJoin(
       (buildRowSize + BinaryRowDataSerializer.LENGTH_SIZE_IN_BYTES) * 
shuffleBuildCount(mq)
     val cpuCost = leftRowCnt * rightRowCnt
     val costFactory = planner.getCostFactory.asInstanceOf[FlinkCostFactory]
-    costFactory.makeCost(mq.getRowCount(this), cpuCost, 0, 0, memoryCost)
+    val cost = costFactory.makeCost(mq.getRowCount(this), cpuCost, 0, 0, 
memoryCost)
+    if (singleRowJoin) {
+      // Make single row join more preferable than non-single row join.
+      cost.multiplyBy(0.99)
+    } else {
+      cost
+    }

Review comment:
       Without this change, the single row join plan can not be picked.




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