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

    https://github.com/apache/spark/pull/19971#discussion_r156970863
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/TPCDSQuerySuite.scala ---
    @@ -348,13 +351,41 @@ class TPCDSQuerySuite extends QueryTest with 
SharedSQLContext with BeforeAndAfte
         "q81", "q82", "q83", "q84", "q85", "q86", "q87", "q88", "q89", "q90",
         "q91", "q92", "q93", "q94", "q95", "q96", "q97", "q98", "q99")
     
    +  private def checkGeneratedCode(plan: SparkPlan): Unit = {
    +    val codegenSubtrees = new 
collection.mutable.HashSet[WholeStageCodegenExec]()
    +    plan foreach {
    +      case s: WholeStageCodegenExec =>
    +        codegenSubtrees += s
    +      case s => s
    +    }
    +    codegenSubtrees.toSeq.foreach { subtree =>
    +      val code = subtree.doCodeGen()._2
    +      try {
    +        // Just check the generated code can be properly compiled
    +        CodeGenerator.compile(code)
    +      } catch {
    +        case e: Exception =>
    +          val msg =
    +            s"""
    +               |failed to compile:
    +               |Subtree:
    +               |$subtree
    +               |Generated code:
    +               |${CodeFormatter.format(code)}
    +             """
    --- End diff --
    
    Good catch, while I am using IntelliJ...


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to