Skip to content

Commit

Permalink
Fixed type casting.
Browse files Browse the repository at this point in the history
  • Loading branch information
rxin committed Jul 19, 2015
1 parent 3ae85f7 commit 83fd950
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ abstract class DataType extends AbstractDataType {

override private[sql] def defaultConcreteType: DataType = this

override private[sql] def acceptsType(other: DataType): Boolean = this == other
override private[sql] def acceptsType(other: DataType): Boolean = sameType(other)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class HiveTypeCoercionSuite extends PlanTest {
shouldCast(NullType, IntegerType, IntegerType)
shouldCast(NullType, DecimalType, DecimalType.Unlimited)

// TODO: write the entire implicit cast table out for test cases.
shouldCast(ByteType, IntegerType, IntegerType)
shouldCast(IntegerType, IntegerType, IntegerType)
shouldCast(IntegerType, LongType, LongType)
Expand Down Expand Up @@ -86,6 +85,16 @@ class HiveTypeCoercionSuite extends PlanTest {
DecimalType.Unlimited, DecimalType(10, 2)).foreach { tpe =>
shouldCast(tpe, NumericType, tpe)
}

shouldCast(
ArrayType(StringType, false),
TypeCollection(ArrayType(StringType), StringType),
ArrayType(StringType, false))

shouldCast(
ArrayType(StringType, true),
TypeCollection(ArrayType(StringType), StringType),
ArrayType(StringType, true))
}

test("ineligible implicit type cast") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class StringExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
testConcatWs("a哈哈b哈哈c", "哈哈", Seq("a", null, "b"), null, "c", Seq.empty[String])
testConcatWs("a哈哈b哈哈c", "哈哈", Seq("a", null, "b"), null, "c", Seq[String](null))
// scalastyle:on

}

test("StringComparison") {
Expand Down

0 comments on commit 83fd950

Please sign in to comment.