You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/12/04 08:31:35 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #26747: [SPARK-29188][PYTHON] toPandas (without Arrow) gets wrong dtypes when applied on empty DF

HyukjinKwon commented on a change in pull request #26747: [SPARK-29188][PYTHON] toPandas (without Arrow) gets wrong dtypes when applied on empty DF
URL: https://github.com/apache/spark/pull/26747#discussion_r353604628
 
 

 ##########
 File path: python/pyspark/sql/tests/test_dataframe.py
 ##########
 @@ -547,6 +547,27 @@ def test_to_pandas_avoid_astype(self):
         self.assertEquals(types[1], np.object)
         self.assertEquals(types[2], np.float64)
 
+    @unittest.skipIf(not have_pandas, pandas_requirement_message)
+    def test_to_pandas_from_empty_dataframe(self):
+        # SPARK-29188 test that toPandas() on an empty dataframe had the correct dtypes
+        import numpy as np
+        schema = StructType([
+            StructField('double', DoubleType(), True),
+            StructField('float', FloatType(), True),
+            StructField('byte', ByteType(), True),
+            StructField('integer', IntegerType(), True),
+            StructField('long', LongType(), True),
+            StructField('short', ShortType(), True),
+        ])
 
 Review comment:
   @dlindelof How does it work for decimal and other types? You're fixing a fundamental problem (see https://github.com/apache/spark/pull/26747#discussion_r353500751)
   
   Can you test other type combinations, and make sure non-empty and empty types are same?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org