@@ -67,8 +67,7 @@ def _get_scala_type_string(self):
6767 return "BooleanType"
6868
6969class TimestampType (object ):
70- """Spark SQL TimestampType
71- """
70+ """Spark SQL TimestampType"""
7271 __metaclass__ = PrimitiveTypeSingleton
7372
7473 def _get_scala_type_string (self ):
@@ -159,11 +158,12 @@ class ArrayType(object):
159158
160159 """
161160 def __init__ (self , elementType , containsNull ):
162- """
163- Create an ArrayType
161+ """Creates an ArrayType
162+
164163 :param elementType: the data type of elements.
165164 :param containsNull: indicates whether the list contains null values.
166165 :return:
166+
167167 >>> ArrayType(StringType, True) == ArrayType(StringType, False)
168168 False
169169 >>> ArrayType(StringType, True) == ArrayType(StringType, True)
@@ -192,11 +192,11 @@ class MapType(object):
192192
193193 """
194194 def __init__ (self , keyType , valueType ):
195- """
196- Create a MapType
195+ """Creates a MapType
197196 :param keyType: the data type of keys.
198197 :param valueType: the data type of values.
199198 :return:
199+
200200 >>> MapType(StringType, IntegerType) == MapType(StringType, IntegerType)
201201 True
202202 >>> MapType(StringType, IntegerType) == MapType(StringType, FloatType)
@@ -224,12 +224,12 @@ class StructField(object):
224224
225225 """
226226 def __init__ (self , name , dataType , nullable ):
227- """
228- Create a StructField
227+ """Creates a StructField
229228 :param name: the name of this field.
230229 :param dataType: the data type of this field.
231230 :param nullable: indicates whether values of this field can be null.
232231 :return:
232+
233233 >>> StructField("f1", StringType, True) == StructField("f1", StringType, True)
234234 True
235235 >>> StructField("f1", StringType, True) == StructField("f2", StringType, True)
@@ -260,10 +260,10 @@ class StructType(object):
260260
261261 """
262262 def __init__ (self , fields ):
263- """
264- Create a StructType
263+ """Creates a StructType
265264 :param fields:
266265 :return:
266+
267267 >>> struct1 = StructType([StructField("f1", StringType, True)])
268268 >>> struct2 = StructType([StructField("f1", StringType, True)])
269269 >>> struct1 == struct2
@@ -313,6 +313,7 @@ def _parse_datatype_string(datatype_string):
313313 """Parses the given data type string.
314314 :param datatype_string:
315315 :return:
316+
316317 >>> def check_datatype(datatype):
317318 ... scala_datatype = sqlCtx._ssql_ctx.parseDataType(datatype._get_scala_type_string())
318319 ... python_datatype = _parse_datatype_string(scala_datatype.toString())
@@ -516,6 +517,7 @@ def applySchema(self, rdd, schema):
516517 :param rdd:
517518 :param schema:
518519 :return:
520+
519521 >>> schema = StructType([StructField("field1", IntegerType(), False),
520522 ... StructField("field2", StringType(), False)])
521523 >>> srdd = sqlCtx.applySchema(rdd, schema)
@@ -867,6 +869,7 @@ def saveAsTable(self, tableName):
867869 self ._jschema_rdd .saveAsTable (tableName )
868870
869871 def schema (self ):
872+ """Returns the schema of this SchemaRDD (represented by a L{StructType})."""
870873 return _parse_datatype_string (self ._jschema_rdd .schema ().toString ())
871874
872875 def schemaString (self ):
0 commit comments