Skip to content

Commit

Permalink
Merge pull request apache#1 from marmbrus/pr/1074
Browse files Browse the repository at this point in the history
Fix testcase
  • Loading branch information
concretevitamin committed Jun 14, 2014
2 parents ab78420 + 73133c2 commit ef27b85
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ import org.scalatest.FunSuite
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.types.{StringType, NullType}

case class Dummy(optKey: Option[Expression]) extends Expression {
def children = optKey.toSeq
def references = Set.empty[Attribute]
def nullable = true
def dataType = NullType
override lazy val resolved = true
type EvaluatedType = Any
def eval(input: Row) = null.asInstanceOf[Any]
}

class TreeNodeSuite extends FunSuite {
test("top node changed") {
val after = Literal(1) transform { case Literal(1, _) => Literal(2) }
Expand Down Expand Up @@ -78,15 +88,6 @@ class TreeNodeSuite extends FunSuite {
}

test("transform works on nodes with Option children") {
case class Dummy(optKey: Option[Expression]) extends Expression {
def children = optKey.toSeq
def references = Set.empty[Attribute]
def nullable = true
def dataType = NullType
override lazy val resolved = true
type EvaluatedType = Any
def eval(input: Row) = null.asInstanceOf[Any]
}
val dummy1 = Dummy(Some(Literal("1", StringType)))
val dummy2 = Dummy(None)
val toZero: PartialFunction[Expression, Expression] = { case Literal(_, _) => Literal(0) }
Expand Down

0 comments on commit ef27b85

Please sign in to comment.