allisonwang-db commented on code in PR #41867:
URL: https://github.com/apache/spark/pull/41867#discussion_r1261865836


##########
python/pyspark/worker.py:
##########
@@ -461,24 +462,53 @@ def assign_cols_by_name(runner_conf):
 # ensure the UDTF is valid. This function also prepares a mapper function for 
applying
 # the UDTF logic to input rows.
 def read_udtf(pickleSer, infile, eval_type):
+    if eval_type == PythonEvalType.SQL_ARROW_TABLE_UDF:
+        runner_conf = {}
+        # Load conf used for arrow evaluation.
+        num_conf = read_int(infile)
+        for i in range(num_conf):
+            k = utf8_deserializer.loads(infile)
+            v = utf8_deserializer.loads(infile)
+            runner_conf[k] = v
+
+        # NOTE: if timezone is set here, that implies respectSessionTimeZone 
is True
+        timezone = runner_conf.get("spark.sql.session.timeZone", None)
+        safecheck = (
+            
runner_conf.get("spark.sql.execution.pandas.convertToArrowArraySafely", 
"false").lower()
+            == "true"
+        )
+        ser = ArrowStreamPandasUDTFSerializer(
+            timezone,
+            safecheck,
+            assign_cols_by_name(runner_conf),

Review Comment:
   That's right. I am assuming this config is only useful when the output data 
frame has specific column names like `pd.DataFrame([(1,2),(2,3)], columns=["a", 
"b"])`?



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