machielg commented on a change in pull request #25496:  [PYTHON][WIP] pyspark 
schema.toDDL() and DataType.fromDDL(ddl)
URL: https://github.com/apache/spark/pull/25496#discussion_r345142007
 
 

 ##########
 File path: python/pyspark/sql/tests/test_types.py
 ##########
 @@ -713,6 +713,27 @@ def assertCollectSuccess(typecode, value):
                 a = array.array(t)
                 self.spark.createDataFrame([Row(myarray=a)]).collect()
 
+    def test_to_ddl(self):
+        schemaExpected=StructType([
+            StructField("string",StringType(),True),
+            StructField("long",LongType(),True),
+            StructField("decimal",DecimalType(10,2),True),
+            StructField("timestamp",TimestampType(),True),
+            StructField("array1",ArrayType(StructType([
+                StructField("item1",LongType(),True),
+                StructField("array2",ArrayType(StructType([
+                    StructField("item2",LongType(),True),
+                    StructField("array2",ArrayType(StructType([
+                        StructField("item3",LongType(),True),
+                        StructField("item4",StringType(),True),
+                    ]),True),True),
+                ]),True),True),
+            ]),True),True)
+        ])
+        ddl=schemaExpected.toDDL()
+        schemaActual=_parse_datatype_string(ddl)
+        self.assertEqual(schemaExpected, schemaActual)
 
 Review comment:
   I was expecting the schemaExpected to be string, not a result of calling the 
method under test.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to