[SPARK-9101] [PySpark] Add missing NullType
JIRA: https://issues.apache.org/jira/browse/SPARK-9101 Author: Mateusz Buśkiewicz <mateusz.buskiewicz@getbase.com> Closes #7499 from sixers/spark-9101 and squashes the following commits: dd75aa6 [Mateusz Buśkiewicz] [SPARK-9101] [PySpark] Test for selecting null literal 97e3f2f [Mateusz Buśkiewicz] [SPARK-9101] [PySpark] Add missing NullType to _atomic_types in pyspark.sql.types
This commit is contained in:
parent
80e2568b25
commit
02181fb6d1
|
@ -333,6 +333,10 @@ class SQLTests(ReusedPySparkTestCase):
|
|||
df = self.sqlCtx.inferSchema(rdd)
|
||||
self.assertEquals(Row(field1=1, field2=u'row1'), df.first())
|
||||
|
||||
def test_select_null_literal(self):
|
||||
df = self.sqlCtx.sql("select null as col")
|
||||
self.assertEquals(Row(col=None), df.first())
|
||||
|
||||
def test_apply_schema(self):
|
||||
from datetime import date, datetime
|
||||
rdd = self.sc.parallelize([(127, -128, -32768, 32767, 2147483647, 1.0,
|
||||
|
|
|
@ -642,7 +642,7 @@ class UserDefinedType(DataType):
|
|||
|
||||
|
||||
_atomic_types = [StringType, BinaryType, BooleanType, DecimalType, FloatType, DoubleType,
|
||||
ByteType, ShortType, IntegerType, LongType, DateType, TimestampType]
|
||||
ByteType, ShortType, IntegerType, LongType, DateType, TimestampType, NullType]
|
||||
_all_atomic_types = dict((t.typeName(), t) for t in _atomic_types)
|
||||
_all_complex_types = dict((v.typeName(), v)
|
||||
for v in [ArrayType, MapType, StructType])
|
||||
|
|
Loading…
Reference in a new issue