@@ -53,12 +53,9 @@ class SparkSqlSerializer2DataTypeSuite extends FunSuite {
5353 checkSupported(TimestampType , isSupported = true )
5454 checkSupported(StringType , isSupported = true )
5555 checkSupported(BinaryType , isSupported = true )
56+ checkSupported(DecimalType (10 , 5 ), isSupported = true )
57+ checkSupported(DecimalType .Unlimited , isSupported = true )
5658
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 )
6259 // For now, ArrayType, MapType, and StructType are not supported.
6360 checkSupported(ArrayType (DoubleType , true ), isSupported = false )
6461 checkSupported(ArrayType (StringType , false ), isSupported = false )
@@ -84,7 +81,8 @@ abstract class SparkSqlSerializer2Suite extends QueryTest with BeforeAndAfterAll
8481 val supportedTypes =
8582 Seq (StringType , BinaryType , NullType , BooleanType ,
8683 ByteType , ShortType , IntegerType , LongType ,
87- FloatType , DoubleType , DateType , TimestampType )
84+ FloatType , DoubleType , DecimalType .Unlimited , DecimalType (6 , 5 ),
85+ DateType , TimestampType )
8886
8987 val fields = supportedTypes.zipWithIndex.map { case (dataType, index) =>
9088 StructField (s " col $index" , dataType, true )
@@ -103,9 +101,11 @@ abstract class SparkSqlSerializer2Suite extends QueryTest with BeforeAndAfterAll
103101 i.toByte,
104102 i.toShort,
105103 i,
106- i.toLong,
104+ Long . MaxValue - i.toLong,
107105 (i + 0.25 ).toFloat,
108106 (i + 0.75 ),
107+ BigDecimal (Long .MaxValue .toString + " .12345" ),
108+ new java.math.BigDecimal (s " ${i % 9 + 1 }" + " .23456" ),
109109 new Date (i),
110110 new Timestamp (i))
111111 }
@@ -159,7 +159,7 @@ abstract class SparkSqlSerializer2Suite extends QueryTest with BeforeAndAfterAll
159159 checkSerializer(df.queryExecution.executedPlan, serializerClass)
160160 checkAnswer(
161161 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 ))
163163 }
164164}
165165
0 commit comments