Description
How to reproduce:
bin/spark-shell --conf spark.sql.cbo.enabled=true
import org.apache.spark.sql.execution.joins.BroadcastHashJoinExec spark.sql("CREATE TABLE small (c1 bigint) TBLPROPERTIES ('numRows'='3', 'rawDataSize'='600','totalSize'='800')") // Big table with wrong statistics, numRows=0 spark.sql("CREATE TABLE big (c1 bigint) TBLPROPERTIES ('numRows'='0', 'rawDataSize'='60000000000', 'totalSize'='8000000000000')") val plan = spark.sql("select * from small t1 join big t2 on (t1.c1 = t2.c1)").queryExecution.executedPlan val buildSide = plan.children.head.asInstanceOf[BroadcastHashJoinExec].buildSide println(buildSide)
The result is BuildRight, but the right side is the big table.