@@ -24,6 +24,16 @@ import org.scalatest.FunSuite
24
24
import org .apache .spark .sql .catalyst .expressions ._
25
25
import org .apache .spark .sql .catalyst .types .{StringType , NullType }
26
26
27
+ case class Dummy (optKey : Option [Expression ]) extends Expression {
28
+ def children = optKey.toSeq
29
+ def references = Set .empty[Attribute ]
30
+ def nullable = true
31
+ def dataType = NullType
32
+ override lazy val resolved = true
33
+ type EvaluatedType = Any
34
+ def eval (input : Row ) = null .asInstanceOf [Any ]
35
+ }
36
+
27
37
class TreeNodeSuite extends FunSuite {
28
38
test(" top node changed" ) {
29
39
val after = Literal (1 ) transform { case Literal (1 , _) => Literal (2 ) }
@@ -78,15 +88,6 @@ class TreeNodeSuite extends FunSuite {
78
88
}
79
89
80
90
test(" transform works on nodes with Option children" ) {
81
- case class Dummy (optKey : Option [Expression ]) extends Expression {
82
- def children = optKey.toSeq
83
- def references = Set .empty[Attribute ]
84
- def nullable = true
85
- def dataType = NullType
86
- override lazy val resolved = true
87
- type EvaluatedType = Any
88
- def eval (input : Row ) = null .asInstanceOf [Any ]
89
- }
90
91
val dummy1 = Dummy (Some (Literal (" 1" , StringType )))
91
92
val dummy2 = Dummy (None )
92
93
val toZero : PartialFunction [Expression , Expression ] = { case Literal (_, _) => Literal (0 ) }
0 commit comments