zhengruifeng commented on code in PR #52001:
URL: https://github.com/apache/spark/pull/52001#discussion_r2303810134


##########
python/pyspark/sql/tests/test_udtf.py:
##########
@@ -2923,6 +2923,44 @@ def eval(self):
                     err_type=Exception,
                 )
 
+    def test_udtf_with_collated_string_types(self):
+        @udtf(
+            "out1 string, out2 string collate UTF8_BINARY, out3 string collate 
UTF8_LCASE,"
+            " out4 string collate UNICODE"
+        )
+        class MyUDTF:
+            def eval(self, v1, v2, v3, v4):
+                yield (v1 + "1", v2 + "2", v3 + "3", v4 + "4")
+
+        schema = StructType(
+            [
+                StructField("col1", StringType(), True),
+                StructField("col2", StringType("UTF8_BINARY"), True),
+                StructField("col3", StringType("UTF8_LCASE"), True),
+                StructField("col4", StringType("UNICODE"), True),
+            ]
+        )
+        df = self.spark.createDataFrame([("hello",) * 4], schema=schema)
+
+        df_out = df.lateralJoin(
+            MyUDTF(
+                col("col1").outer(), col("col2").outer(), col("col3").outer(), 
col("col4").outer()
+            )
+        ).select("out1", "out2", "out3", "out4")
+        result_df = df_out.select("out.*")

Review Comment:
   ```suggestion
           result_df = df.lateralJoin(
               MyUDTF(
                   col("col1").outer(), col("col2").outer(), 
col("col3").outer(), col("col4").outer()
               )
           ).select("out1", "out2", "out3", "out4")
   ```



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to