Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18164#discussion_r119800139
  
    --- Diff: python/pyspark/sql/tests.py ---
    @@ -1697,40 +1697,56 @@ def test_fillna(self):
             schema = StructType([
                 StructField("name", StringType(), True),
                 StructField("age", IntegerType(), True),
    -            StructField("height", DoubleType(), True)])
    +            StructField("height", DoubleType(), True),
    +            StructField("spy", BooleanType(), True)])
     
             # fillna shouldn't change non-null values
    -        row = self.spark.createDataFrame([(u'Alice', 10, 80.1)], 
schema).fillna(50).first()
    +        row = self.spark.createDataFrame([(u'Alice', 10, 80.1, True)], 
schema).fillna(50).first()
             self.assertEqual(row.age, 10)
     
             # fillna with int
    -        row = self.spark.createDataFrame([(u'Alice', None, None)], 
schema).fillna(50).first()
    +        row = self.spark.createDataFrame([(u'Alice', None, None, None)], 
schema).fillna(50).first()
             self.assertEqual(row.age, 50)
             self.assertEqual(row.height, 50.0)
     
             # fillna with double
    -        row = self.spark.createDataFrame([(u'Alice', None, None)], 
schema).fillna(50.1).first()
    +        row = self.spark.createDataFrame([(u'Alice', None, None, None)], 
schema).fillna(50.1).first()
             self.assertEqual(row.age, 50)
             self.assertEqual(row.height, 50.1)
     
    +        # fillna with bool
    +        row = self.spark.createDataFrame([(u'Alice', None, None, None)], 
schema).fillna(True).first()
    +        self.assertEqual(row.age, None)
    +        self.assertEqual(row.spy, True)
    +
             # fillna with string
    -        row = self.spark.createDataFrame([(None, None, None)], 
schema).fillna("hello").first()
    +        row = self.spark.createDataFrame([(None, None, None, None)], 
schema).fillna("hello").first()
             self.assertEqual(row.name, u"hello")
             self.assertEqual(row.age, None)
     
             # fillna with subset specified for numeric cols
             row = self.spark.createDataFrame(
    -            [(None, None, None)], schema).fillna(50, subset=['name', 
'age']).first()
    +            [(None, None, None, None)], schema).fillna(50, subset=['name', 
'age']).first()
             self.assertEqual(row.name, None)
             self.assertEqual(row.age, 50)
             self.assertEqual(row.height, None)
    +        self.assertEqual(row.spy, None)
     
    -        # fillna with subset specified for numeric cols
    +        # fillna with subset specified for string cols
             row = self.spark.createDataFrame(
    -            [(None, None, None)], schema).fillna("haha", subset=['name', 
'age']).first()
    +            [(None, None, None, None)], schema).fillna("haha", 
subset=['name', 'age']).first()
             self.assertEqual(row.name, "haha")
             self.assertEqual(row.age, None)
             self.assertEqual(row.height, None)
    +        self.assertEqual(row.spy, None)
    +
    +        # fillna with subset specified for bool cols
    +        row = self.spark.createDataFrame(
    +            [(None, None, None, None)], schema).fillna(True, 
subset=['name', 'age']).first()
    +        self.assertEqual(row.name, None)
    +        self.assertEqual(row.age, None)
    +        self.assertEqual(row.height, None)
    +        self.assertEqual(row.spy, True)
    --- End diff --
    
    Well, I think this fails :
    
    ```
    ======================================================================
    ERROR [0.452s]: test_fillna (pyspark.sql.tests.SQLTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File ".../spark/python/pyspark/sql/tests.py", line 1749, in test_fillna
        self.assertEqual(row.spy, True)
    AssertionError: None != True
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to