Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10989#discussion_r51356688
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/BenchmarkWholeStageCodegen.scala
 ---
    @@ -81,6 +82,30 @@ class BenchmarkWholeStageCodegen extends SparkFunSuite {
         benchmark.run()
       }
     
    +  def testBroadcastHashJoin(values: Int): Unit = {
    +    val benchmark = new Benchmark("BroadcastHashJoin", values)
    +
    +    val dim = broadcast(sqlContext.range(1 << 16).selectExpr("id as k", 
"cast(id as string) as v"))
    +
    +    benchmark.addCase("BroadcastHashJoin w/o codegen") { iter =>
    +      sqlContext.setConf("spark.sql.codegen.wholeStage", "false")
    +      sqlContext.range(values).join(dim, (col("id") % 60000) === 
col("k")).count()
    +    }
    +    benchmark.addCase(s"BroadcastHashJoin w codegen") { iter =>
    +      sqlContext.setConf("spark.sql.codegen.wholeStage", "true")
    +      sqlContext.range(values).join(dim, (col("id") % 60000) === 
col("k")).count()
    +    }
    +
    +    /*
    +      Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
    +      BroadcastHashJoin:                 Avg Time(ms)    Avg Rate(M/s)  
Relative Rate
    +      
-------------------------------------------------------------------------------
    +      BroadcastHashJoin w/o codegen           3053.41             3.43     
    1.00 X
    +      BroadcastHashJoin w codegen             1028.40            10.20     
    2.97 X
    --- End diff --
    
    Since the dimension table is pretty small, overhead of broadcast is also 
low, when I ran it with larger range, the improvements did not change much, 
because looking up in BytesToBytes is the bottleneck. I will have another PR to 
improve the join with small dimension table.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to