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

    https://github.com/apache/spark/pull/1055#discussion_r13821017
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala ---
    @@ -917,6 +919,19 @@ private[hive] object HiveQl {
         case Token(OR(), left :: right:: Nil) => Or(nodeToExpr(left), 
nodeToExpr(right))
         case Token(NOT(), child :: Nil) => Not(nodeToExpr(child))
     
    +    /* Case statements */
    +    case Token("TOK_FUNCTION", Token(WHEN(), Nil) :: branches) =>
    +      CaseWhen(branches.map(nodeToExpr))
    +    case Token("TOK_FUNCTION", Token(CASE(), Nil) :: branches) =>
    +      val transformed = branches.drop(1).sliding(2, 2).map {
    +        case Seq(condVal, value) =>
    +          // FIXME?: the key will get evaluated for multiple times in 
CaseWhen's eval(). Optimize?
    +          Seq(Equals(nodeToExpr(branches(0)), nodeToExpr(condVal)),
    --- End diff --
    
    Yeah, that is a very good point. I have updated the comment accordingly & 
added [this JIRA](https://issues.apache.org/jira/browse/SPARK-2155) to track 
this.


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