Skip to content

Commit 896c7b7

Browse files
committed
fix NullType MatchError in JavaSchemaRDD when sql has null
1 parent 6e643f8 commit 896c7b7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

sql/core/src/main/scala/org/apache/spark/sql/package.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ package object sql {
263263
@DeveloperApi
264264
val ShortType = catalyst.types.ShortType
265265

266+
/**
267+
* :: DeveloperApi ::
268+
*
269+
* The data type representing `NULL` values.
270+
*
271+
* @group dataType
272+
*/
273+
@DeveloperApi
274+
val NullType = catalyst.types.NullType
275+
266276
/**
267277
* :: DeveloperApi ::
268278
*

sql/core/src/main/scala/org/apache/spark/sql/types/util/DataTypeConversions.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ protected[sql] object DataTypeConversions {
6262
case IntegerType => JDataType.IntegerType
6363
case LongType => JDataType.LongType
6464
case ShortType => JDataType.ShortType
65+
case NullType => JDataType.StringType
6566

6667
case arrayType: ArrayType => JDataType.createArrayType(
6768
asJavaDataType(arrayType.elementType), arrayType.containsNull)

0 commit comments

Comments
 (0)