@@ -53,12 +53,9 @@ class SparkSqlSerializer2DataTypeSuite extends FunSuite {
53
53
checkSupported(TimestampType , isSupported = true )
54
54
checkSupported(StringType , isSupported = true )
55
55
checkSupported(BinaryType , isSupported = true )
56
+ checkSupported(DecimalType (10 , 5 ), isSupported = true )
57
+ checkSupported(DecimalType .Unlimited , isSupported = true )
56
58
57
- // Because at the runtime we accepts three kinds of Decimals
58
- // (Java BigDecimal, Scala BigDecimal, and Spark SQL's Decimal), we do support DecimalType
59
- // right now. We will support it once we fixed the internal type.
60
- checkSupported(DecimalType (10 , 5 ), isSupported = false )
61
- checkSupported(DecimalType .Unlimited , isSupported = false )
62
59
// For now, ArrayType, MapType, and StructType are not supported.
63
60
checkSupported(ArrayType (DoubleType , true ), isSupported = false )
64
61
checkSupported(ArrayType (StringType , false ), isSupported = false )
@@ -84,7 +81,8 @@ abstract class SparkSqlSerializer2Suite extends QueryTest with BeforeAndAfterAll
84
81
val supportedTypes =
85
82
Seq (StringType , BinaryType , NullType , BooleanType ,
86
83
ByteType , ShortType , IntegerType , LongType ,
87
- FloatType , DoubleType , DateType , TimestampType )
84
+ FloatType , DoubleType , DecimalType .Unlimited , DecimalType (6 , 5 ),
85
+ DateType , TimestampType )
88
86
89
87
val fields = supportedTypes.zipWithIndex.map { case (dataType, index) =>
90
88
StructField (s " col $index" , dataType, true )
@@ -103,9 +101,11 @@ abstract class SparkSqlSerializer2Suite extends QueryTest with BeforeAndAfterAll
103
101
i.toByte,
104
102
i.toShort,
105
103
i,
106
- i.toLong,
104
+ Long . MaxValue - i.toLong,
107
105
(i + 0.25 ).toFloat,
108
106
(i + 0.75 ),
107
+ BigDecimal (Long .MaxValue .toString + " .12345" ),
108
+ new java.math.BigDecimal (s " ${i % 9 + 1 }" + " .23456" ),
109
109
new Date (i),
110
110
new Timestamp (i))
111
111
}
@@ -159,7 +159,7 @@ abstract class SparkSqlSerializer2Suite extends QueryTest with BeforeAndAfterAll
159
159
checkSerializer(df.queryExecution.executedPlan, serializerClass)
160
160
checkAnswer(
161
161
df,
162
- Row (1000 , 1000 , 0 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 ))
162
+ Row (1000 , 1000 , 0 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 , 1000 ))
163
163
}
164
164
}
165
165
0 commit comments