ilicmarkodb commented on code in PR #51688:
URL: https://github.com/apache/spark/pull/51688#discussion_r2303754648
##########
python/pyspark/sql/tests/test_udtf.py:
##########
@@ -3490,6 +3490,41 @@ def eval(self):
udtf(TestUDTF, returnType=ret_type)().collect()
+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.select(MyUDTF(df.col1, df.col2, df.col3, df.col4).alias("out"))
Review Comment:
PTAL https://github.com/apache/spark/pull/51688
--
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]