Skip to content

Commit

Permalink
sql-case22
Browse files Browse the repository at this point in the history
  • Loading branch information
watermen committed Feb 4, 2015
1 parent e380d2d commit c5cd5bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ package org.apache.spark.sql.catalyst.expressions
import org.apache.spark.sql.catalyst.analysis.UnresolvedException
import org.apache.spark.sql.types._

case class UnaryPlus(child: Expression) extends UnaryExpression {
type EvaluatedType = Any

def dataType = child.dataType
override def foldable = child.foldable
def nullable = child.nullable
override def toString = s"+$child"

override def eval(input: Row): Any = {
n1(child, input, _)
}
}

case class UnaryMinus(child: Expression) extends UnaryExpression {
type EvaluatedType = Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
Cast(nodeToExpr(arg), DateType)

/* Arithmetic */
case Token("+", child :: Nil) => UnaryPlus(nodeToExpr(child))
case Token("-", child :: Nil) => UnaryMinus(nodeToExpr(child))
case Token("~", child :: Nil) => BitwiseNot(nodeToExpr(child))
case Token("+", left :: right:: Nil) => Add(nodeToExpr(left), nodeToExpr(right))
Expand Down

0 comments on commit c5cd5bc

Please sign in to comment.