itamarst commented on a change in pull request #24981: [SPARK-27463][PYTHON] 
Support Dataframe Cogroup via Pandas UDFs
URL: https://github.com/apache/spark/pull/24981#discussion_r308891246
 
 

 ##########
 File path: python/pyspark/worker.py
 ##########
 @@ -359,10 +417,24 @@ def map_batch(batch):
         arg_offsets, udf = read_single_udf(
             pickleSer, infile, eval_type, runner_conf, udf_index=0)
         udfs['f'] = udf
-        split_offset = arg_offsets[0] + 1
-        arg0 = ["a[%d]" % o for o in arg_offsets[1: split_offset]]
-        arg1 = ["a[%d]" % o for o in arg_offsets[split_offset:]]
-        mapper_str = "lambda a: f([%s], [%s])" % (", ".join(arg0), ", 
".join(arg1))
+        parsed_offsets = extract_key_value_indexes()
+        keys = ["a[%d]" % o for o in parsed_offsets[0][0]]
 
 Review comment:
   It's good habit when doing single % string interpolation to wrap the thing 
in a tuple (i.e. `"a[%d]" % (o,)`), because otherwise one day you'll do 
`"debug: %s" % o` and it'll work fine for most objects but blow up if `o` is a 
tuple with more than one item.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to