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

    https://github.com/apache/spark/pull/1146#discussion_r14007759
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveTypeCoercionSuite.scala
 ---
    @@ -28,4 +32,23 @@ class HiveTypeCoercionSuite extends HiveComparisonTest {
           createQueryTest(s"$i + $j", s"SELECT $i + $j FROM src LIMIT 1")
         }
       }
    +
    +  test("[SPARK-2210] boolean cast on boolean value should be removed") {
    +    val q = "select cast(cast(key=0 as boolean) as boolean) from src"
    +    val project = TestHive.hql(q).queryExecution.executedPlan.collect { 
case e: Project => e }.head
    +
    +    // No cast expression introduced
    +    project.transformAllExpressions { case c: Cast =>
    +      assert(false, "unexpected cast " + c)
    --- End diff --
    
    `fail(s"unexpected cast $c")` would be more concise.


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

Reply via email to