HyukjinKwon commented on a change in pull request #35454:
URL: https://github.com/apache/spark/pull/35454#discussion_r803543568



##########
File path: python/pyspark/sql/tests/test_functions.py
##########
@@ -233,31 +233,32 @@ def test_rand_functions(self):
         self.assertEqual(sorted(rndn1), sorted(rndn2))
 
     def test_string_functions(self):
-        from pyspark.sql import functions
-        from pyspark.sql.functions import col, lit
-
-        string_functions = [
-            "upper",
-            "lower",
-            "ascii",
-            "base64",
-            "unbase64",
-            "ltrim",
-            "rtrim",
-            "trim",
-        ]
-
-        df = self.spark.createDataFrame([["nick"]], schema=["name"])
-        self.assertRaisesRegex(
-            TypeError, "must be the same type", lambda: 
df.select(col("name").substr(0, lit(1)))
-        )
-
-        for name in string_functions:
-            self.assertEqual(
-                df.select(getattr(functions, name)("name")).first()[0],
-                df.select(getattr(functions, name)(col("name"))).first()[0],
+        with self.sql_conf({"spark.sql.ansi.enabled": False}):
+            from pyspark.sql import functions
+            from pyspark.sql.functions import col, lit
+
+            string_functions = [
+                "upper",
+                "lower",
+                "ascii",
+                "base64",

Review comment:
       This seems like just testing roundtrip. Please fix the test instead of 
just disabling `spark.sql.ansi.enabled`




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to