Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Mar 18, 2016
1 parent c2f9b05 commit b4e6033
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.apache.spark.sql.catalyst.dsl.expressions._
import org.apache.spark.sql.catalyst.dsl.plans._
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.plans.logical._
import org.apache.spark.sql.types.LongType

class ConstraintPropagationSuite extends SparkFunSuite {

Expand Down Expand Up @@ -217,4 +218,12 @@ class ConstraintPropagationSuite extends SparkFunSuite {
IsNotNull(resolveColumn(tr, "a")),
IsNotNull(resolveColumn(tr, "b")))))
}

test("infer constraints on cast") {
val tr = LocalRelation('a.int, 'b.long)
verifyConstraints(tr.where('a.attr === 'b.attr).analyze.constraints,
ExpressionSet(Seq(Cast(resolveColumn(tr, "a"), LongType) === resolveColumn(tr, "b"),
IsNotNull(resolveColumn(tr, "a")),
IsNotNull(resolveColumn(tr, "b")))))
}
}

0 comments on commit b4e6033

Please sign in to comment.