Skip to content
Snippets Groups Projects
Commit 02181fb6 authored by Mateusz Buśkiewicz's avatar Mateusz Buśkiewicz Committed by Reynold Xin
Browse files

[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
parent 80e2568b
No related branches found
No related tags found
No related merge requests found
...@@ -333,6 +333,10 @@ class SQLTests(ReusedPySparkTestCase): ...@@ -333,6 +333,10 @@ class SQLTests(ReusedPySparkTestCase):
df = self.sqlCtx.inferSchema(rdd) df = self.sqlCtx.inferSchema(rdd)
self.assertEquals(Row(field1=1, field2=u'row1'), df.first()) 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): def test_apply_schema(self):
from datetime import date, datetime from datetime import date, datetime
rdd = self.sc.parallelize([(127, -128, -32768, 32767, 2147483647, 1.0, rdd = self.sc.parallelize([(127, -128, -32768, 32767, 2147483647, 1.0,
......
...@@ -642,7 +642,7 @@ class UserDefinedType(DataType): ...@@ -642,7 +642,7 @@ class UserDefinedType(DataType):
_atomic_types = [StringType, BinaryType, BooleanType, DecimalType, FloatType, DoubleType, _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_atomic_types = dict((t.typeName(), t) for t in _atomic_types)
_all_complex_types = dict((v.typeName(), v) _all_complex_types = dict((v.typeName(), v)
for v in [ArrayType, MapType, StructType]) for v in [ArrayType, MapType, StructType])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment