Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
address comments
  • Loading branch information
Davies Liu committed Aug 28, 2015
commit 32ddc9f5ee870a44b87ec88881402c96ef404d2c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class CollectionFunctionsSuite extends SparkFunSuite with ExpressionEvalHelper {
val a0 = Literal.create(Seq(1, 2, 3), ArrayType(IntegerType))
val a1 = Literal.create(Seq[String](null, ""), ArrayType(StringType))
val a2 = Literal.create(Seq(null), ArrayType(LongType))
val a3 = Literal.create(null, ArrayType(StringType))

checkEvaluation(ArrayContains(a0, Literal(1)), true)
checkEvaluation(ArrayContains(a0, Literal(0)), false)
Expand All @@ -81,5 +82,8 @@ class CollectionFunctionsSuite extends SparkFunSuite with ExpressionEvalHelper {

checkEvaluation(ArrayContains(a2, Literal(1L)), null)
checkEvaluation(ArrayContains(a2, Literal.create(null, LongType)), null)

checkEvaluation(ArrayContains(a3, Literal("")), null)
checkEvaluation(ArrayContains(a3, Literal.create(null, StringType)), null)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,24 +250,19 @@ class ConstantFoldingSuite extends PlanTest {
}

test("Constant folding test: Fold In(v, list) into true or false") {
var originalQuery =
val originalQuery =
testRelation
.select('a)
.where(In(Literal(1), Seq(Literal(1), Literal(2))))

var optimized = Optimize.execute(originalQuery.analyze)
val optimized = Optimize.execute(originalQuery.analyze)

var correctAnswer =
val correctAnswer =
testRelation
.select('a)
.where(Literal(true))
.analyze

comparePlans(optimized, correctAnswer)

originalQuery =
testRelation
.select('a)
.where(In(Literal(1), Seq(Literal(1), 'a.attr)))
}
}